mc_pos_control: set thrust to zero if in idle

This commit is contained in:
Dennis Mannhart
2018-02-09 18:59:19 +01:00
committed by Lorenz Meier
parent 1fb8eaf6c6
commit 75fb1b28b9
2 changed files with 13 additions and 2 deletions
@@ -79,6 +79,16 @@ void PositionControl::updateState(const vehicle_local_position_s &state, const V
_vel_dot = vel_dot;
}
void PositionControl::setIdle()
{
_pos_sp = _pos;
_vel_sp.zero();
_acc_sp.zero();
_thr_sp.zero();
_yaw_sp = _yaw_sp_int = _yaw;
_yawspeed_sp = 0.0f;
}
void PositionControl::updateSetpoint(const vehicle_local_position_setpoint_s &setpoint)
{
_pos_sp = Vector3f(&setpoint.x);
@@ -96,6 +106,9 @@ void PositionControl::updateSetpoint(const vehicle_local_position_setpoint_s &se
if (PX4_ISFINITE(setpoint.thrust[0]) && PX4_ISFINITE(setpoint.thrust[1]) && PX4_ISFINITE(setpoint.thrust[2])) {
_skipController = true;
_pos_sp.zero();
_vel_sp.zero();
_acc_sp.zero();
}
}