Automatic MOT_THST_EXPO estimation lua script

@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

an update for those following along.
I had a couple of good discussions with @Leonardthall about this approach for measuring expo. Leonard suggested we look for the ratio of acceleration between a hover1.25 and a hover1.5 pulse at zero velocity. I implemented that and we didn’t get the results we expected in SITL, so Leonard and I are trying to work out. why. I’ll do an update again when we’ve worked out the reason and we’re ready for more testing.
Many thanks to everyone who has helped with this, much appreciated!

6 Likes

Looking forward to the update! I have a hex I’m tuning up using KDEcan ESCs and am curious what sort of results I’ll get.

Hello everyone, we’ve tried the current script with our big copter:

  • Octo (X8)
  • approx 25kg takeoff-weight
  • U8II 100kV integrated motor combinations
  • 28.2x9.2 folding props

The script settled on 0.7 for expo from 0.79 after a few minutes of flight.
I can share the log privately, if desired.

I’d like to request a build for CubeOrangePlus with KDEcan. @Yuri_Rage @tridge can you help? Thanks!

Dear @tridge , i’ve been following this post since you started with the script and i would first of all like to say thank you for all your amazing work on the code.
I had not found any time till now on my test frames and i will start trying the script and also provide results, but i have a couple of questions that have been created by reading the whole chat.
Since the Voltage shag of a battery seems to be important and having mot_options set to 1 can create errors in the result, would also Min/MAX payload weight on the test cause something similar? Or am i thinking about it completely wrong? Because based on weight, the same powertrain would create different sample accel and velocity as also the time V crosses Zero would be different.
In case i am not wrong, would adding extra params to the expo such as the accel that we have for P/R/Y that you can use like (ATC_ACCEL_T_MAX(atc-accel-p-max) x (min_TOW / max_TOW)) would help it create even better results?

Ready to test board cuav x7pro
can you explain how to build the firmware ?
and the latest expo lua script thankh

@tridge is my question above valid??

@tridge Did you ever get back around to updating this?

According to @Leonardthall and the math, MOT_THST_EXPO is only half of the truth.
What people really need is a (MOT_SPIN_MIN, MOT_THST_EXPO) parameter pair.
And MOT_SPIN_MIN is missing from the spreadsheet.

1 Like

I am not sure exactly what you are referring to but I will try to clarify this.

The expo curve moves between a y = x straight line to a y = x^2 line based on the expo value.

The idealised propeller model and motor model produces a y = x^2 thrust curve but in real systems this curve is flattened out due to the various losses in the system.

When we use this thrust in a multirotor we can’t use the zero thrust point because this requires the propellers to stop spinning and esc’s don’t like trying to start again from zero rpm under load. So we set the minimum rpm and minimum static thrust using the MOT_SPIN_MIN parameter. This keeps our motors and esc’s spinning safely at our lowest thrust level.

So now the expo fitting line must match the thrust curve from some higher thrust point that the system will treat as zero thrust.

As we increase the MOT_SPIN_MIN parameter to increase the lowest point on the curve, the curve becomes closer and closer to a straight line. This means that the expo used to fit to this curve becomes closer and closer to zero (y=x).

So to get expo correct we need to move the MOT_SPIN_MIN to (0,0) before fitting the expo. If we increase our MOT_SPIN_MIN the expo will need to reduce a little to match.

Keep in mind that while our expo formulation has a very solid theoretical justification based on ideal propeller model, the real world is much more complicated. For example coax propellers increase losses and tend to drop the expo. Smaller propellers distort under load and appear to move to a lower effective pitch, flattening out the upper thrust curve. Then we start thinking about how this curve starts changing with negative inflow at high speed and … well it gets hard to know where to start.

  • Get your expo close but don’t get too hung up on getting it perfect. (we hope an approach similar to the one above will get “close enough”)
  • Get your frame built well and propellers aligned properly.
  • Set your MOT_SPIN_MIN carefully to ensure you get good low thrust but without stalling the esc’s under load.
  • Make sure your battery voltage range is setup in the MOT parameters.
  • Take your time to read, understand and follow the tuning instructions.
3 Likes

Yes, that is what I meant. They are connected and relate to each other.

Playing with the spreadsheet, I could see that a certain value of MOT_THST_EXPO (call it x_1) would match the curve. Now changing MOT_SPIN_MIN, the x_1 MOT_THST_EXPO no longer fits the curve like before. But By adjusting it, I can make it match again. Basically both values are connected and should be treated as such.

Or am I missing something? All that I am pleading here is to add MOT_SPIN_MIN to the spreadsheet.

That is correct. As you adjust the amount of curve you are fitting to using the MOT_SPIN_MIN, the curvature, defined by MOT_THST_EXPO, changes.

I think you have it all correct.

Hi @tridge, @Leonardthall,

Was this idea scraped or just put on hold?

It would be an amazing feature to have and I really hope you find the time to keep developing it. I absolutely think this has a place alongside autotune in a future release of arducopter!

@PVR2022, did you ever run the script on the T-motor arm set machines? I’ve been trying out values of 0.65-0.4 but never 0.2-0.3.

Thanks!

No, at the moment we set Mot_expo to 0.2 at starting point.
we dont test the estimation lua script.

therefore, if we use tmotor alpha/flame esc on large drone frame (greater 22inch prop) with 0.2 mot expo value works very well.

we will test the estimation lua script to verify that 0.2 its a good point.
largest values of mot expo with these ESC are known for some issues therefore mission planner make the initial parameter setup special for these esc and setup to 0.2

1 Like