Consolidate _update_params() methods for improved inheritance from the LandDetector base class.
Move common uORB::Subscriptions to the base class for inheritance.
Deprecate redundant override methods.
* adds a work_queue systemcmd that will bring a tree view of all active work queues and work items
* WorkQueues now track attached WorkItems and will shutdown when the last WorkItem is detached
After landing it can happen that a second take off is detected and then the _takeoff_time is rest, resulting in a wrong total flight time counter. With this fix the flight time is reliably counted from the first take off until the vehicle is disarmed. Normally the vehicle will not spend much time armed after landing, if it does the flight time will be off but this is the same as before this fix. This fix was tested in several flight experiments.
Before that, different modules (ekf2, commander & land detector) changed
params upon different events:
- ekf2 & commander set params after disarm
- land detector set params on land detected
If the 2 events were several 100ms appart, it led to 2 param saves, and
the latter param set could have been blocked by an ongoing save. And if
the land detector was blocked, it could lead to mag timeouts.
This patch makes all modules use the same event, thus only a single param
save will happen.
If we want to have guarantees to never block, we should introduce a
param_try_set() API method.
The problem was signed vs unsigned mixing together with 64bit conversion:
int32_t flight_time = ...;
uint64_t _total_flight_time = ...;
_total_flight_time |= flight_time;
When flight_time is negative, the last line would first extend the sign
bit to the upper 32bits of the 64bit uint and then apply the bitwise OR.
The fix is to use an unsigned 32 bit value.
param_save_default() could take something like 0.5s, and because the
LandDetector is running on the HP work queue, this would block other
tasks, like RC handling or drivers.
This implementation is a baseline implementation and makes no attempt to be tamper-proof. A monotonic counter like the W25R64FV or a similar HW facility would be required to achieve this.
Ground detect: pilot want down or we are on minimum thrust by auto land but no vertical movement
-> Controller should relax x,y corrections and even ramp down desired thrust
Landed: All other conditions are eventually met