Lua Script for finding Vmin/Vstall of a Fixed Wing RC

Hello All,

I’m pretty new to using lua scripts and ardupilot in general. I was wondering if anyone has information on how a Lua Script could be implemented into a fixed wing RC’s performance testing. I’m flying a 2.5 meter sailplane and trying to validate my simulation from XFLR5 and was hoping to compare the Vstall I was getting from that with experimental data. I’d greatly appreciate any advice or recommendations.

Thanks!

If you are new to lua then my AI playbooks will help you do a pretty good job of whatever you need to - GitHub - fossuav/aap: ArduPilot AI Playbooks · GitHub

I would strongly recommend against trying to use Lua (or any other form of automation). While correctly configured and equipped with airspeed sensor, Ardupilot is pretty good at keeping away from stall region. It is very bad at recovering from developed stall.

The correct procedure for determining V_Stall is to

  1. Make sure you have an easily accessible switch to enter MANUAL mode (6Pos doesn’t count, it should be an easily accessible 2 or 3 pos toggle switch in min or max position)
  2. Make sure you know how to recover from stall and spin
  3. Climb to altitude sufficient to recover from spin plus some good margin
  4. make sure you are in FBWA
  5. Start slowing down while maintaining altitude (this will require pulling the stick back as FBWA maintains attitude)
  6. Once at the verge of stall or stalled recover in MANUAL
  7. Repeat steps 3-6 until required amount of samples is collected.
  8. Download and analyze logs to determine V_Stall.
  9. Set stall and min airspeed according to the documentation.

Optional:
Set STAB_PITCH_DOWN such that at min throttle the plane flies at or slightly above V_Min

Thanks for sharing, I will definitely check it out!

Thank you for sharing your procedure with me. The thing I’m still unsure of then would be in flight are you monitoring any values like pitch rate or airspeed or just visually observing the aircraft. Id assume when analyzing logs are you looking for a drop in altitude then? Thanks for your help!

I fly line of sight so I would look for the aircraft not maintaining attitude in flight. In the log you would look for roll or pitch actual and commanded values diverging.

BTW you should have completed autotune before doing this test in FBWA as you want good control all the way down to stall. If you want to do this test before autotuning I would do it fully in MANUAL.

Of course, the first couple of flights will be fully manual to check stability amongst other things. I appreciate your help, you wouldn’t have a similar procedure for calculating from flight parasitic drag would you? I was planning on doing an unpowered glide but I’m still iffy on the correct procedure.

You can only measure total drag in flight.

You can apply excess power model to data from a glide test to estimate sink polar. Two things to keep in mind, air has to be still or at a minimum vertical air speed has to be known (updraft can deliver significant power to the aircraft and vice versa) and vertical acceleration will cause deviation in the polar as you deviate from 1g condition of steady state flight as drag varies with angle of attack. Ideally the tests would should be done early in the morning when thermal activity is low.