Automatic MOT_THST_EXPO estimation lua script

@tridge I’ll contribute. Could you make me a build (we are using Cube orange with PMW)

yes please, I’d like to get a better understanding of how windy it can be for the expo script to be useful

sure, you didn’t say if plane or copter so I made both:
http://uav.tridgell.net/ExpoTest/
thanks for testing!

No problem, Tridge! Wind was out of the south at about 8-12 knots and pretty gusty. Before a minor crash, I felt the copter was reasonably well tuned, but it’s a bit unhappy now.
Log file (gusty wind)

EDIT:
As the sun went down, the wind died considerably, so I tested the EDU-450, which is mostly stock but has a nicer 4-in-1 ESC than the provided ones from Hexsoon. This was a much better flight with a better behaved copter!
EDU-450 log file here.

I forgot that the KakuteH7Mini-Nand doesn’t have scripting capabilities, so I won’t be able to test my little 3.5" Cinewhoop. Shame. It’s super overpowered, and I was looking forward to that!

Thank you so much, I will inform you if I need anything more and the results when I get them.

Curiously, with no changes other than favorable wind, my bigger copter performed like its old self again this evening with vibe levels back to acceptable ranges, and I got a successful test.
Log file (calm wind)

Slightly off topic - not sure if you (or anyone) saw my work on scripting a momentum drag estimator, but if my approach is sound, it might be a nice companion to this thrust expo tuner.

1 Like

Thanks @Yuri_Rage !
I notice your 11x3 copter also has the incorrect BW for dynamic harmonic and starts oscillating in roll at low throttle due to the filter causing phase lag. I suspect this is a common problem and we need to update the wiki.
I think you should set:

  • INS_HNTCH_BW=7
  • INS_HNTC2_ENABLE=0

The windy log really shows the problem with tuning expo in gusty conditions. The calm log is much better.
For the Edu450, @rmackay9 also tested that frame. Randy got an expo of 0.62 whereas you got 0.56. I think the difference is you have different MOT_SPIN_MIN and MOT_SPIN_ARM values to @rmackay9 which I know impacts the result significantly.
Can you give me some info on the 11x3 motor and ESC for this spreadsheet?

also, the .bin logs are preferred to .log files. They contain a bit more information and load faster.
Cheers, Tridge

Thanks much for the tuning advice - I was really fiddling with filtering for a while on the 11x3 copter, and it looks like maybe I left the second one enabled after messing with a static notch or something. Good catch! Interesting about the bandwidth param - I thought I had that set well and am very interested in what info you’d suggest for the wiki.

The EDU-450 actually uses an XRotor 40A ESC, which may also have a slight impact(?). If you pass the MOT_SPIN* values that Randy used, I’m happy to test again and compare results.

The 11x3 copter is a ZD550 frame with an iFlight BLITZ 80A ESC, iFlight XING 4214 660kV motors, and Master Airscrew 3x11x10 MR series props.

If I’m posting logs to a public location, I always anonymize them, which results in a .log file. I can share future logs directly with you if the need arises.

Hey @tridge here are two logs, first with MOT_OPTIONS=0 and second with MOT_OPTIONS=1. This is the Y6 I had in canberra, and both flights are off the same battery, which happen to have a fair bit of voltage sag… if that sag complicates the log data, let me know and I’ll go out with a newer battery and re-run the tests.

I’ve pushed some significant changes to the expo lua script today.
The key one is it now samples the acceleration at the zero vertical velocity point.


this means we sample the acceleration when there is no drag from vertical air flow. In the above graph you can see after the down pulse starts the copter is initially travelling upwards and there is a down force from the drag. That gives an artifically inflated acceleration reading. By waiting till the velocity crosses zero we get a more accurate sample.
I did several flights with @MichelleRos today on her 7" quad. The results were interesting as this is a very powerful quad (hover throttle is 0.12). We were surprised to find the expo came out at 0.86, much higher than the previous setting of 0.65. The data does look very clear, but I’m looking forward to discussing with @Leonardthall

1 Like

Assume you want more logs using the revised script?

i will, but hold off for a bit while I work on some other changes. I think the existing logs can be reprocessed to give me the data I need.

2 Likes

No worries. Found the source of inconsistent vibration on the ZD550 (11x3) copter and will need time to replace the ESC anyway. One of the corners of the board took enough of a bump in the aforementioned crash to delaminate it where one of the motor wires connects, causing what’s almost certainly a current spike on one phase. Was very hard to see but pretty easy to literally “sniff out” as the problem worsened.

1 Like

@tridge Hi again tridge. We were wondering, once we have the lua script already on the mission planner, how do we make sure that the script executes itself? or is it automatic once it is already on mission planner?

@J.F.A the script has nothing to do with MissionPlanner. You put the lua script in APM/scripts/ on the microSD on the flight controller and set SCR_ENABLE to 1. Then read the doc for the script:

for more information see this:
https://ardupilot.org/copter/docs/common-lua-scripts.html

Have you experienced in tmotor ESC, the need to setup MOT_THST_EXPO values too low?. The initial parameter setup always recommends values of 0,7 / 0,8 and we have try in large drones with 32 inch prop and tmotor esc, motor expo values of 0,2 with very smooth flight.

@PVR2022 if you have a tmotor setup then please run this lua script and send me a log. It would be good to find out if the expo does match the low values users often use with t-motor

1 Like

Also please indicate if you are using the Integrated Series for T-Motor or a separate motor/ESC setup. I think there is a difference between the ideal Expo for the two - but not 100% sure.

I talk about integrated tmotor system arms. motor + esc. We have a lot of aircrafts with these integrated arms and always we have to low the motor expo to 0.2/0.3 values to achieve a smooth flights.

1 Like

I’ve found 0.4 works well with the T-Motor “integrated” sets but if your ascent and descent tests work well with 0.2 then that’s OK too.
It seems when you purchase the T-Motor Alpha ESCs separately (without a motor and prop) they must have some generic firmware and up around 0.6 (or the calculated MOT_THST_EXPO) works OK.

1 Like