mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 13:13:33 +08:00
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:
committed by
Mathieu Bresciani
parent
24811cf550
commit
37a9b90945
+12
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user