111 Commits

Author SHA1 Message Date
Daniel Agar
f9794e99f8
move hover_thrust_estimator to new module (mc_hover_thrust_estimator)
* MC_HTE: unitialize with hover_thrust parameter
* MC_HTE: constrain hover thrust setter between 0.1 and 0.9
* MC_HTE: integrate with land detector and velocity controller
* MCHoverThrustEstimator: Always publish an estimate even when not fusing measurements. This is required as the land detector and the position controller need to receive a hover thrust value.

* MC_HTE: use altitude agl threshold to start the estimator
local_position.z is relative to the origin of the EKF while dist_bottom
is above ground

Co-authored-by: bresch <brescianimathieu@gmail.com>
2020-03-11 21:20:54 -04:00
Daniel Agar
635ceccfdb
land_detector: relax data timeouts uniformly
* if we're hitting these timeouts there are much larger problems in the system
2020-01-20 17:14:00 -05:00
Daniel Agar
a8ea55d9b6
remove all <cmath> usage
* the NuttX c++ library is incomplete, let's avoid including it until we have a real standard library in place
2019-11-25 10:04:04 -05:00
Daniel Agar
967446af4c clang-tidy: enable readability-simplify-boolean-expr and fix 2019-10-27 19:19:07 -04: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
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
mcsauder
f9a5c91f8c Deprecate vehicle_attitude_sub from MulticopterLandDetector as it is no longer utilized. 2019-10-09 09:48:17 +02:00
Mark Sauder
508ffa1b39 land_detector: Remove recently added vehicle_attitude.timestamp check from MulticopterLandDetector::_get_maybe_landed_state(). (#13072)
PR #12681 added a check to the MulticopterLandDetector::_get_maybe_landed_state() method for a valid vehicle_attitude.timstamp value to finish work in PR #9756. It was discovered that the addition of that check leaves it possible to fly in acro mode without a valid attitude and auto-disarm can engage, allowing the multicopter to fall out of the sky.
2019-10-02 16:31:06 -04:00
Mark Sauder
60e5e0821a land_detector: Add and max_altitude and timestamp validity checks to MulticopterLandDetector class. (#12681)
* Rename local camelCase vars to snake_case and control_mode -> vehicle_control_mode to match typdef with established class convention.
2019-09-02 00:30:46 -04:00
Mark Sauder
056c8000a1 MultiCopterLandDetector: Implement ModuleParams inheritance (#12356) 2019-08-09 07:57:42 +02:00
Daniel Agar
a917f22b65
sensors: create vehicle_acceleration module (#12597) 2019-08-07 05:05:48 -04:00
Daniel Agar
2ad12d7977
sensors: create vehicle_angular_velocity module (#12596)
* split out filtered sensor_gyro aggregation from mc_att_control and move to wq:rate_ctrl
2019-08-06 12:55:25 -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
6e9f706b12 Standardize remaining class member variable naming convention in the MulticopterLandDetector class. 2019-06-26 14:06:56 -04:00
mcsauder
6b6d82447e Standardize class member variable naming convention in the MulticopterLandDetector class. 2019-06-26 14:06:56 -04:00
Daniel Agar
53aa4130a8 land_detector move orb subscriptions to uORB::Subscription 2019-06-04 18:10:21 -04:00
Roman
6c1399b328 multicopter land detector: make threshold for _has_low_thrust
configurable

Signed-off-by: Roman <bapstroman@gmail.com>
2019-04-03 08:49:46 +02:00
Matthias Grob
aa36fa2dfd replace camel case by snake case.
Co-Authored-By: EliaTarasov <elias.tarasov@gmail.com>
2019-03-21 10:07:12 +01: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
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