Home - KeesGuijt/MatrixPilot GitHub Wiki

Welcome to this MatrixPilot glider add-on wiki!

Goal: to support a Local Endurance Thermalling mission in MP

Please check:

!!!!! The code is public and free to use !!!!!

Most functions are implemented in LOGO, and some in custom C code. I tried to use standard MP options were possible, wrote C code where I had to.

This is my LOGO script for what I like to call an ATV L.E.T. - mission (Local Endurance Thermalling).

flightplan-logo.h LET Local Endurance Thermallling mission script

some explanation is included:

This script performs a LET (Local Endurance Thermalling) mission It does geofencing, motor climbs and thermalling The program navigates the area randomly to search for rising air. The program detects and then moves the glider to the center of thermals, even if the thermals drift downwind. The script has two similar sets of scripts, for two main program flows "gliding" and "motor climb" This is needed to remember a motorclimb was started in case of an interruption (there is no method to read a flag in LOGO) Two types of geofences are used: normal geofence and wind geofence The wind geofence allows for optimisation of the position of the glider, to have enough space to thermal if rising air is found. the wind geofence is only enforced if no thermals are found the soft geofences are smaller in size and are intended to position the aircraft in the geofence, crossing the bigger (real) geofence should be a rare event The motor is controlled to maintain altitude when no thermals are found. The fixed throttle climbrate is optimized for longer flights. The motor is stopped when too much sink or much lift is encountered, to preserve battery power. multiple smaller subroutines are used to allow recording as waypoints in telemetry for debugging 'Check' routines have an even number, odd numbered subroutines (actions) will be logged as waypoint 'Forward' commands are usualy timed to last about 1 sec Gps data is used to measure altitude and climbrate Glide speed control is selected by LOGO (slow, normal and fast). Flaps (camber) is controlled simultaneously (F4,F0 or F-4)

I combined the new helical turns code with some features to support a new AIRFRAME: AIRFRAME_GLIDER. Specifically to make autonomous glider landings possible without a motor. Before I was using brakes to limit altitude when in thermals. Now i use brakes to loose altitude when on a glideslope. I took the motor control logic and hacked it to control brakes. Then i needed a nice way to integrate this with LOGO. To my surprise, it can be done using only SET_ALT() and the F_LAND flag. After that i realised that while model crashes can happen sometimes, most damage is caused when the model is allowed to accelerate until it meets some unforgiving surface. Overspeed protection can prevent much damage in some cases. It uses the desiredSpeed variable and starts braking when aispeed gets above 150% of desiredSpeed. With the AIRFRAME_GLIDER i added a LOGO landing example script. It requires the WIND_FROM_ANGLE() command. The automatic landing script for LOGO allows to connect to the correct landing circuit, even if wind has shifted after a long flight. Depending on the situation of your flying field, you can script left or right circuits for multiple wind directions. If there is some charge left, it can use the motor to climb a little first, or use brakes to descend to the starting point of the circuit. The phases of the circuit are Downwind, Base and Final. Flareing is not implemented (landing is usually soft enough).

Enjoy.