88 Commits

Author SHA1 Message Date
Silvan Fuhrer
bace45ba8d LandDetector: log rotational_movement
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-11-01 18:35:54 +01:00
Daniel Agar
f3e2a197ad
move vehicle at rest detection ekf2 -> land_detector
- move vehicle at reset detection ekf2 -> land_detector
 - ekf_unit: reduce init period
   - Fake fusion is when at rest is quite strong and makes the variance reduce rapidly. Reduce the amount of time we wait before checking if the variances are still large enough.
 - ekf_unit: reduce minimum vel/pos variance required after init
   - Fake pos fusion has a low observation noise, making the vel/pos variances reduce quickly.

Co-authored-by:: bresch <brescianimathieu@gmail.com>
2022-02-01 17:50:19 -05:00
Matthias Grob
bbb04ab4b8 Remove relaying of maximum altitude through land detector 2022-01-05 14:54:59 +01:00
Jukka Laitinen
532f370e7d Fix implicit float to double conversions
The both results of ?: should be of same type, and some compilers give error
on this:
	" implicit conversion from 'float' to 'double' to match other result of conditional"

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-05-05 09:31:07 +02:00
Matthias Grob
2e292abfff MulticopterLandDetector: Make land detection time configurable
The tree stages used arbitrary 350, 250 300ms totally 900ms
So this changes it to each stage to a third of the parameter.
Default it is 1 second -> 333ms per stage.
2021-05-04 16:43:33 +02:00
RomanBapst
269ce07cb5 land detector: log more states in order to facilitate debugging ground contact state
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2021-05-04 16:43:33 +02:00
RomanBapst
171c26373b land_detector: robustify land detection by using distance to ground info
- if distance to the ground is available then hysteresis times will be increased
by a factor of 3 if vehicle is higher than 1m above ground

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2021-04-27 08:19:19 +02:00
Daniel Agar
f5f2897486
land_detector: multicopter ground contact fixes, improvements, and cleanup
- if "landed" and "maybe_landed" states are false then both the "hit_ground" and the "low_thrust" condition need to be true in order to detect landing
 - ground contact MC NAN setpoint workaround
 - ground contact additionally check acceleration setpoint
 - schedule with vehicle_local_position updates (most updates require valid local position)
 - don't allow LNDMC_Z_VEL_MAX to exceed MPC_LAND_SPEED
 - ground contact horizontal movement checks default to failed if estimates aren't available
2020-08-02 13:37:23 -04:00
Daniel Agar
fa44cd5cd5 px4_work_queue: rename navigation_and_controllers -> nav_and_controllers
- keep the thread within the current NuttX max length
2020-07-14 09:48:47 -04:00
Daniel Agar
326d8efc16 move attitude controllers to new wq:attitude_ctrl 2020-04-27 21:34:35 -04:00
Nicolas de Palezieux
8d0402f274 land detector: fix ordering of hysteresis updates to ensure we report LANDED only if also MAYBE LANDED and GROUND CONTACT, and MAYBE LANDED only if also GROUND CONTACT 2020-01-17 20:46:17 +01:00
Mark Sauder
e9c9fb8239 fix multicopter land detector: do not update parameters every cycle (#13212)
And add updateParams() call in LandDetector::_update_params().
2019-10-18 09:25:41 +02:00
Matthias Grob
45a53726d6 LandDetector: switch to uORB::Publication 2019-10-16 00:47:01 -04:00
Matthias Grob
679e4fedf5 LandDetector: switch land flags to properies instead of one state 2019-10-16 00:47:01 -04:00
mcsauder
fb12ddb69a Cherry pick the directory and voted_sensors_update.h from PR #9756.
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.
2019-10-14 21:25:57 +02:00
Daniel Agar
e3bbac0447 land_detector: move to same WQ as estimator
- the primary data sources of the land detector run from the same WQ so
don't lose anything by serializing these modules
2019-10-02 19:44:46 -04:00
Daniel Agar
26364d44c9
px4_work_queue: command line status output and shutdown empty queues
* 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
2019-10-02 12:23:17 -04:00
Daniel Agar
c8e59c4e39 parameter_update use uORB::Subscription consistently 2019-09-29 10:49:03 -04:00
Maximilian Laiacker
72e93a9c36 fixed total flight time counting bug
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.
2019-09-17 14:52:27 +02:00
Beat Küng
aa86bf5f92 landdetector flight time: fix cast to 64 bits
`_param_total_flight_time_low.get()` is an int32_t and gets sign-extended
if cast directly to uint64_t. To avoid that we first cast to uint32_t.
2019-07-09 20:26:40 -04:00
Mark Sauder
1466d11acc land_detector: cleanup actuator_armed and battery_status naming
* Rename _arming -> _actuator_armed
 * Rename _battery -> _battery_status in the MulticopterLandDetector class.
2019-06-27 12:02:14 -04:00
mcsauder
df662245a2 Standardize class member variable naming convention in the LandDetector class. 2019-06-26 14:06:56 -04:00
mcsauder
d7cfebe0a3 Add check_params(true) call to the LandDetector start() method. Break out _update_total_flight_time() method in the LandDetector class. 2019-06-26 09:23:02 +02:00
mcsauder
f783982edb Revert changes to the check_params(const bool force) declaration/definition to match current PX4:master. 2019-06-26 09:23:02 +02:00
mcsauder
faa3c3dc6f Refactor the LandDetector class to
- Reduce duplicate code in LandDetector _check_params() method.
 - Standardize naming cases.
 - Implement DEFINE_PARAMETERS() macro.
2019-06-26 09:23:02 +02:00
Daniel Agar
106ee280c5
land_detector initiate cycle immediately
- fixes #12190
2019-06-15 21:30:09 -04:00
Daniel Agar
777b615cf9 land_detector move to PX4 WQ hp_default 2019-06-04 18:10:21 -04:00
Daniel Agar
53aa4130a8 land_detector move orb subscriptions to uORB::Subscription 2019-06-04 18:10:21 -04:00
Julian Oes
b29e5e3adb hysteresis: remove dependency/side effect on time 2019-05-27 09:57:50 +02:00
Roman
ecc8a696d0 added ground effect reporting to land detector
Signed-off-by: Roman <bapstroman@gmail.com>
2019-03-21 10:07:12 +01:00
Daniel Agar
184aa2861a PX4_ISFINITE use builtin everywhere 2019-02-21 14:56:08 -05:00
Beat Küng
481bfc6308 px4_module: use px4_atomic_t 2019-01-30 10:24:06 -05:00
Daniel Agar
60f2a92e3d replace <cfloat> with <float.h>
- <cfloat> isn't available in the NuttX c++ library
2019-01-06 19:20:57 -05:00
Beat Küng
465d399e8f land_detector: move _parameterSub to the right place 2018-09-28 16:04:40 +02:00
Beat Küng
b69dd50d90 land_detector: cleanup subscriptions & publications 2018-09-28 16:04:40 +02:00
Mohammed Kabir
1a2f9dd37a land_detector : use INFINITY when altitude limiting is not needed 2018-06-09 13:38:04 +02:00
Beat Küng
123f11fcdd land_detector: use user-defined literals for time constants 2018-04-14 13:45:57 +02:00
Daniel Agar
2ae5e575a5 land detector initialize landed and publish periodically 2018-01-24 17:36:53 +01:00
Beat Küng
a0afc370d0 land detector: move arming state into base class & set param when disarming
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.
2017-12-07 11:55:51 +00:00
Beat Küng
0dcf9775f1 LandDetector: make type passed to param_get() explicit 2017-10-27 10:43:15 +02:00
Daniel Agar
f67ac8ba00 land detector clang-tidy trivial changes 2017-08-31 22:49:44 -04:00
Daniel Agar
6e402bd6f4 land detector uniform initialization cleanup 2017-08-31 22:49:44 -04:00
Daniel Agar
cb8cc9a795 land detector add cycle perf 2017-08-31 22:49:44 -04:00
Daniel Agar
90819b2852 land detector move hysteresis constants into FW and MC 2017-08-31 22:49:44 -04:00
Daniel Agar
b70b8288b9 px4_includes cleanup incomplete list 2017-08-20 20:42:42 +02:00
Dennis Mannhart
f75dd37326 landdetector: delete or for ground_contact detection 2017-08-01 19:31:34 +02:00
Dennis Mannhart
f8e9f380d0 landdetector: add additional landdetection state 2017-08-01 19:31:34 +02:00
Beat Küng
8a83fb7dc2 land_detector: use ModuleBase & add module documentation 2017-07-14 11:57:11 +02:00
Beat Küng
1e2ce51c6d LandDetector: fix vehicle flight time
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.
2017-07-04 14:13:18 +02:00
Matthias Grob
d1b270d5b2 land_detector: fix sanity condition that we have ground contact when we are landed to include the hysteresis flag
because the condition was looking for the instantaneous flag and during the hysteresis time the state did not change anymore
2017-04-20 13:20:01 +02:00