Setting up a rectangular mission by switch

For various measurements on the flying aircraft, I wrote a script that creates a mission that makes the aircraft fly along an elongated rectangle:

The length of the rectangle is calculated from the desired flight time in downwind leg (Lua variable DOWNWIND_TIME) and the AP parameter ARSPD_TRIM_CM. The width of the rectangle is calculated in such a way that the aircraft can turn from the downwind leg into the upwind (and vice versa) in a half circle. The desired bank angel is specified in the variable of the same name at the beginning of the script. The parameters WP_LOITER_RAD and WP_RAD are adjusted accordingly.

This makes it easy to fly any desired distance in stable flight. Example flight:

After launch, in any mode except Auto, the creating of a new mission consisting of 4 waypoints (and a fifth DO_JUMP to the starting point of course) can be triggered by a switch on the remote control (RCn_OPTION = 300) . Waypoint one is then at the location of the trigger. The flight mode is automatically switched to Auto. By switching to another flight mode, the mission can be terminated and re-triggered as often as desired by switch again.

Even if it is scripted completely unprofessionally, it still does its job for me, for example, when measuring efficiency. Maybe someone can use something like that. The script evaluates a second switch, with which an Arduplane parameter can be changed in flight. In the example it is TECS_SYNAIRSPEED.

Rolf
WindMis.lua (5.3 KB)

1 Like

Is this something you think would add value as an applet or example, I can help polish it up. It’s a little unclear to me what measurements you’re trying to refine via its use, though the algorithm for calculating the pattern dimensions is pretty clear.

Hi Yuri,
thank you for your offer of help.
Measurements: If the aircraft is in stable straight flight on the long sides without crosswind influence, one can calibrate the airspeed sensor relatively quickly and accurately. With a very accurate airspeed, it is then possible to determine fine differences in efficiency by varying e.g. the airspeed, the centre of gravity or also e.g. different winglets.
This is only interesting for a few, so I don’t think it is of general interest as an applet.
Besides the measurement, I had the idea of having a “semi-automatic” autotune performed on the basis of the script, where the pilot no longer has to perform the stick movements himself. As it turns out Tridge also thinks of a rectangular mission planned for this. I would also like to use this flightpath to be able to determine TECS parameters quickly in a similar way.

Rolf