smooth takeoff - Support smooth takeoff triggered by jerk setpoint

This commit is contained in:
bresch
2019-02-14 12:24:35 +01:00
committed by Beat Küng
parent 0d170a0eaf
commit 8f584a1496
3 changed files with 20 additions and 7 deletions
@@ -49,10 +49,12 @@ bool FlightTaskManualPositionSmoothVel::activate()
void FlightTaskManualPositionSmoothVel::reActivate()
{
reset(Axes::XY);
// The task is reacivated while the vehicle is on the ground. To detect takeoff in mc_pos_control_main properly
// using the generated jerk, reset the z derivatives to zero
reset(Axes::XYZ, true);
}
void FlightTaskManualPositionSmoothVel::reset(Axes axes)
void FlightTaskManualPositionSmoothVel::reset(Axes axes, bool force_z_zero)
{
int count;
@@ -75,6 +77,11 @@ void FlightTaskManualPositionSmoothVel::reset(Axes axes)
_smoothing[i].reset(0.f, _velocity(i), _position(i));
}
// Set the z derivatives to zero
if (force_z_zero) {
_smoothing[2].reset(0.f, 0.f, _position(2));
}
_position_lock_xy_active = false;
_position_lock_z_active = false;
_position_setpoint_xy_locked(0) = NAN;