85 Commits

Author SHA1 Message Date
Daniel Agar
69470f6991 land_detector use THROTTLE index 2018-03-05 15:46:24 -05:00
Dennis Mannhart
26e85736a5 land_detector: Reduce and detection false negatives due to estimator bias
Using the vertical derivative estimate prevents vertical velocity offsets caused by estimation vertical velocity errors preventing the vehicle disarming.
2017-12-12 12:14:24 +00: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
Dennis Mannhart
29cdb655c3 landdetector: remove outdated comment 2017-10-10 10:21:09 +02:00
Julian Oes
7229ec2a37 Move throttle check from land detector to posctrl
This commit is an attempt to fix a race condition happening on takeoff
between the land detector and the multicopter position controller.

Previously, an auto-takeoff leads to the following events:

1. A takeoff setpoint is given.
2. The thrust setpoint spikes because we don't enter smooth takeoff yet.
3. The land detector detects a takeoff because of the high thrust.
4. The position controller sees the landed state transition and
   initiates the smooth takeoff. Thrust goes back down.
5. Depending on control gains the takeoff is successful or fails
   if the smoothing takes too long which causes thrust to be too low, so
   the land detector detects land again.

The two obvious problems with this are:
- The intermittent spike.
- The failed takeoff because of the smoothing leads to a delay..

With this change, the logic for a takeoff detection is moved from the
land detector to the position controller.

The events are now:

1. A takeoff setpoint is given.
2. The position controller detects the takeoff setpoint and initiates
   the smooth takeoff.
3. As thrust ramps up, the land detector detects the take off.

In the same way, we now detect the intent to takeoff in manual,
altitude, control, position control in the position controller instead
of in the land detector.
2017-10-09 19:05:15 +02:00
Daniel Agar
b4755297ec delete control_state and cleanup vehicle_attitude (#7882) 2017-09-21 16:24:53 -04:00
Daniel Agar
f67ac8ba00 land detector clang-tidy trivial changes 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
Dennis Mannhart
e39b38ba96 landdetector groundcontact: adjust climbrate if landing speed is low 2017-08-21 20:38:07 +02:00
Dennis Mannhart
f50052f290 landdetector mc: widen acceptance threshold after landing instead of arming 2017-08-15 10:30:29 +02:00
sanderux
6ee24a0c80 Move land detector changes to vtol 2017-08-09 08:12:54 +02:00
sanderux
49d2e8a3ff Land detector fix for VTOL in FW mode 2017-08-09 08:12:54 +02:00
Dennis Mannhart
a95f02b4a1 land-detector description fix 2017-08-01 19:31:34 +02:00
Dennis Mannhart
f26972704e style fix 2017-08-01 19:31:34 +02:00
Dennis Mannhart
e6f7af2dcf landdetector + mc_pos_control cherry-pick fix 2017-08-01 19:31:34 +02:00
Dennis Mannhart
69ecfef8a4 landdetector: consider 8 second maybe_landed case only if no rotation present 2017-08-01 19:31:34 +02:00
Dennis Mannhart
9baf41bef1 landdetector: check horizontal movement as criteria to enter ground contact 2017-08-01 19:31:34 +02:00
Dennis Mannhart
bc46f13d90 landdetector: use control mode, add minimum speed to detect hit-ground 2017-08-01 19:31:34 +02:00
Dennis Mannhart
549d8da6ee landdetector: hit ground logic 2017-08-01 19:31:34 +02:00
Dennis Mannhart
2405abd859 mc landdetector description 2017-08-01 19:31:34 +02:00
Dennis Mannhart
8f7ebc1f3a mc landdetector: simplify return 2017-08-01 19:31:34 +02:00
Dennis Mannhart
411ceaa6b3 multicopter landdetector: delete PX4_INFO 2017-08-01 19:31:34 +02:00
Dennis Mannhart
f8e9f380d0 landdetector: add additional landdetection state 2017-08-01 19:31:34 +02:00
Daniel Agar
5d626bd940 clang-tidy remove redundant init 2017-06-02 19:35:18 -04:00
Daniel Agar
64ed96d81a clang-tidy readability-simplify-boolean-expr 2017-06-02 19:35:18 -04:00
Matthias Grob
caecdbd60b land_detector: treat altitude mode like position mode with vertical checks but without horizontal checks
because in altitude mode we have a baro available and can therefore check vertical movement
we can not check horizontal movement but I consider the checks for landing still pretty safe
unlike in manual mode we are not allowed to disarm before land detection in altitude mode
2017-04-20 13:20:01 +02:00
Dennis Mannhart
340773096d landdetector: exit landing state if manual.z is larger than threshold 2017-04-13 16:59:23 +02:00
Matthias Grob
2b90224075 land_detector: added parameter for manual position stick takeoff threshold 2017-02-28 13:05:33 +01:00
Dennis Mannhart
7f54f891c1 land_detector: set max height to 100 2017-02-27 22:54:19 +01:00
Dennis Mannhart
a1982e0392 land_detector: battery level status to adjust maximum altitude possible 2017-02-27 22:54:19 +01:00
Matthias Grob
e6031a97fa land_detector: added a parameter for the manual land detection stick throshold
because it is definitely something that needs to be allowed to tune or disable for different application scenarios
2017-02-23 13:18:49 +01:00
Matthias Grob
3183cbda90 land_detector: manual land detection stick throshold less strict
Even for well calibrated RC sticks 5% stick movement is a too small margin for the end user that might not land because of this.
15% is still clearly restricting the stick far down.
2017-02-22 21:56:41 +01:00
Roman
8c9f27bb8a land detector (mc): takeoff throttle should be the same for all manual,
altitude controlled modes

Signed-off-by: Roman <bapstroman@gmail.com>
2017-02-15 15:41:44 +01:00
Matthias Grob
194f0c1de8 land_detector: ground detection corrected comment and clarified condition 2017-02-13 11:34:10 +01:00
Matthias Grob
9963cf532d land_detector: refactored helper method names 2017-02-13 11:34:10 +01:00
Matthias Grob
c559f195ec land_detector: Hotfix to prevent ground contact detection when descending velocity is very slow with manual stick all the way down
Now the stick down check is only done in manual control and the thrust low is again mandatory to detect ground in any case.
2017-02-13 11:34:10 +01:00
Matthias Grob
480dd0922b Land detector: revision of the 2 stage landing mechanism
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
2017-01-28 16:23:04 +01:00
Matthias Grob
b130913090 land_detector: made sure the 2 stage landing can not happen in one hysteresis time 2017-01-28 16:23:04 +01:00
Lorenz Meier
9ef97b78c8 Land detector: Turn throttle range parameter into proper user-configurable parameter 2017-01-28 16:23:04 +01:00
Lorenz Meier
9448b8cb52 Land detector: Fix hover throttle detection 2017-01-28 16:23:04 +01:00
Dennis Mannhart
2f164602b4 LandDetector:
- constructor initalization fix
- set trigger time for ground contact hysteresis
- updated ground_contact_state logic
MulticopterLandDetector:
- added hysteresis for ground_contact
VtolLandDetector:
- get_ground_contact_state function that return the one form MultcopterLandDetector
FixedWingLandDetector:
- get_ground_contact_state with a return false: requires implementation
2017-01-28 16:23:04 +01:00
Lorenz Meier
9e9e0e23ad Land detector: Detect ground contact separately
This allows to detect ground contact before concluding the system is landed. This allows to disable some parts of the horizontal control system and only control the vertical position to avoid tipping over.
;
2017-01-28 16:23:04 +01:00
Matthias Grob
5b54d78128 land detector: changed minimum throttle threshold to have useful landing detection in real world scenarios 2017-01-16 08:25:26 -08:00
Matthias Grob
f95fb0f20f land detector: commented takeoff throttle values for each mode 2017-01-16 08:25:26 -08:00
Matthias Grob
7ab2958757 land_detector: added takeoff throttle threshold
if we control manually and are still landed, we want to stay idle until the pilot rises the throttle
2017-01-16 08:25:26 -08:00
Matthias Grob
b79e4ab506 land detector: reverted scientific notation unwanted doubles 2016-12-26 15:36:43 +01:00
Matthias Grob
03d7b65299 land detector: refactoring ff to freefall 2016-12-26 15:36:43 +01:00
Matthias Grob
808dedf441 land detector: small refactor while studying 2016-12-26 15:36:43 +01:00
Julian Oes
50cac88e5b land_detector: big refactor, share update function
This is a big refactor and general cleanup of the land detector. The
main functional change is to share the hysteresis lib across all land
detectors.
2016-07-30 12:26:56 +02:00
Julian Oes
9f928308c4 land_detector: astyle 2016-07-30 12:26:56 +02:00