Skip to content

Commit

Permalink
MC position controller: Stop holding position once ground contact is …
Browse files Browse the repository at this point in the history
…established.

This ensures the system does not tip over on landings. Tested in SITL with a GPS drift model.
  • Loading branch information
LorenzMeier committed Jan 15, 2017
1 parent d30346b commit 49a2ca4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/modules/mc_pos_control/mc_pos_control_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1823,16 +1823,25 @@ MulticopterPositionControl::control_position(float dt)
/* descend stabilized, we're landing */
if (!_in_landing && !_lnd_reached_ground
&& (float)fabsf(_acc_z_lp) < 0.1f
&& _vel_z_lp > 0.5f * _params.land_speed) {
&& _vel_z_lp > 0.6f * _params.land_speed) {
_in_landing = true;
}

float land_z_threshold = 0.1f;


/* assume ground, cut thrust */
if (_in_landing
&& _vel_z_lp < 0.1f) {
&& _vel_z_lp < land_z_threshold) {
thr_max = 0.0f;
_in_landing = false;
_lnd_reached_ground = true;

} else if (_in_landing
&& _vel_z_lp < math::min(0.3f * _params.land_speed, 2.5f * land_z_threshold)) {
/* not on ground but with ground contact, stop position and velocity control */
thrust_sp(0) = 0.0f;
thrust_sp(1) = 0.0f;
}

/* once we assumed to have reached the ground always cut the thrust.
Expand Down

0 comments on commit 49a2ca4

Please sign in to comment.