Commit Graph

92 Commits

Author SHA1 Message Date
Matthias Grob f9ec0cd5ea LandDetector: use vertical velocity estimate for threshold
instead of the derivative of the vertical position which is
not the same value when using the ekf2 estimation.

Using the position derivative resulted in delayed landing because
the value for some reason often bumped over the theshold before
slowly converging towards zero while the velocity was within expected
accuary in all these cases.
2019-01-26 14:53:15 +01:00
Dennis Mannhart 5887a2393c PositionControl: skip controller only if adjusted thrust setpoint are not finite
PositionControl: update comment about the order of thrust and position

mc_pos_control: reset setpoints to NAN if required

MulticopterLandDetector: consider to be landed if vehicle is not armed

mc_pos_control: initialize landing struct with landed

mc-pos-ctrl: adjust thrust-setpoint and yaw during ground-contact/maybe-landed without capturing
that information within vehicle-local-position-setpoint topic because that information
does not belong to user intention

PositionControl: set local position/velocity setpoint to NAN if not used in the control pipeline

mc-pos-ctrl: Fill vehicle_local_position_setpoint_s structure as follow:
The message contains setpoints where each type of setpoint is either the input to the PositionController
or was generated by the PositionController and therefore corresponds to the PositioControl internal states (states that were generated by P-PID).
Example:
If the desired setpoint is position-setpoint, _local_pos_sp will contain
position-, velocity- and thrust-setpoint where the velocity- and thrust-setpoint were generated by the PositionControlller.
If the desired setpoint has a velocity-setpoint only, then _local_pos_sp will contain valid velocity- and thrust-setpoint, but the position-setpoint
will remain NAN. Given that the PositionController cannot generate a position-setpoint, this type of setpoint is always equal to the input to the
PositionController.

mc_pos_control: switch to designated initializer for landed

It's less error prone because it produces an error on every discrepancy.
2019-01-08 15:36:30 +01:00
Beat Küng a9def8be93 MC land detector: remove LNDMC_THR_RANGE param
- no airframe changes the default
- it does not make much sense to be able to configure the 0.1 threshold
  but the 0.3 threshold for ground contact detection cannot be configured.
2018-10-09 12:09:07 +02:00
Beat Küng 465d399e8f land_detector: move _parameterSub to the right place 2018-09-28 16:04:40 +02:00
Dennis Mannhart f30bf215db MulticopterLanddetector: adjust minimum throttle if climb-reate is not enabled 2018-07-20 09:26:18 +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 354584acfc MulticopterLandDetector initialize all class members 2018-03-05 15:46:24 -05:00
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