The check if stick were touched was only working in one direction (per
axis) because fabsf was used incorrectly.
However, this check is still only a differential check triggered by
fast movement and does not trigger if someone slowly moves a stick to
the side. Also, the sensitivity depends on the rate of the commander
loop and/or the RC update loop. The correct solution would be a proper
filtering and trigger for movement.
vehicle_status_flags_pub passed to publish_status_flags() was always null,
thus orb_advertise() was called each time.
Note that it did not produce a memory leak.
* If you move in LAND, AUTO or HOLD the sticks the system will give control back to the pilot
* If you do not connect any RC the system will default to HOLD and will allow you tablet control
* If you gain position lock for the first time the system will re-evaluate the mode switch (so if you dropped down to alt hold it will now go into position)
* If the system breaches the Geofence it will now always drop back to POSCTRL if the sticks are moved
This is necessary to not have systems deep-discharge the battery while sitting idle. While at it we also deny arming in low battery conditions to ensure people who just landed with a low battery do not take off again and fail to get a successful RTL.
Move RC and DL failsafe actions handling from navigator to commander (credits to @AndreasAntener)
Separate manual kill switch handling via manual_lockdown to prevent override and release of software lockdown by RC switch
Other changes:
Add failsafe tune
Fix LED blinking for Pixracer
Return back support for rc inputs in simulator but now it is configurable via cmake
According to https://github.com/mavlink/mavlink/pull/629 the mavlink
command DO_SET_MODE should only determine the mode but not the
armed/disarmed state, so the MAV_MODE_FLAG_SAFETY_ARMED bit should be
ignored.
Instead the mavlink command COMPONENT_ARM_DISARM should be used instead.
Therefore, the commander now ignores the arm/disarm bit.
(leads to double publishing on the console when a new link is established, but this is the best compromise between fixing and completely restructuring)