FlightTask - Move checkSetpoints function in each FlightTask to be tailored to the specific needs and avoid checking all the setpoints

This commit is contained in:
bresch
2019-07-16 13:09:09 +02:00
committed by Mathieu Bresciani
parent 24811cf550
commit 37a9b90945
10 changed files with 75 additions and 44 deletions
@@ -66,6 +66,18 @@ void FlightTaskManualAltitudeSmoothVel::reActivate()
_resetPositionLock();
}
void FlightTaskManualAltitudeSmoothVel::checkSetpoints(vehicle_local_position_setpoint_s &setpoints)
{
// If the position setpoint is unknown, set to the current postion
if (!PX4_ISFINITE(setpoints.z)) { setpoints.z = _position(2); }
// If the velocity setpoint is unknown, set to the current velocity
if (!PX4_ISFINITE(setpoints.vz)) { setpoints.vz = _velocity(2); }
// No acceleration estimate available, set to zero if the setpoint is NAN
if (!PX4_ISFINITE(setpoints.acc_z)) { setpoints.acc_z = 0.f; }
}
void FlightTaskManualAltitudeSmoothVel::_resetPositionLock()
{
// Always start unlocked