MulticopterPositionControl: fix amending existing idle setpoint from before takeoff

once the rampup starts. The rampup requires a valid vertical velocity setpoint.
The corner case is:
- We are before takeoff and amending the setpoint to be 0,0,100 acceleration
in order to idle
- The rampup starts BUT the setpoint is not yet overwritten by the trajectory
setpoint topic
- The idle setpoint gets amended to not contain a feed-forward vertical
acceleration because the rampup is velocity based
- The result is a brief invalid 0,0,NAN acceleration setpoint
- That invalid setpoint gets overridden by a failsafe that holds zero velocity
- Zero velocity leads to applying ~hover thrust briefly
This commit is contained in:
Matthias Grob
2022-11-09 10:54:21 +01:00
parent 84d1435880
commit a38bdcfc9d
@@ -480,7 +480,7 @@ void MulticopterPositionControl::Run()
} }
// make sure takeoff ramp is not amended by acceleration feed-forward // make sure takeoff ramp is not amended by acceleration feed-forward
if (_takeoff.getTakeoffState() == TakeoffState::rampup) { if (_takeoff.getTakeoffState() == TakeoffState::rampup && PX4_ISFINITE(_setpoint.velocity[2])) {
_setpoint.acceleration[2] = NAN; _setpoint.acceleration[2] = NAN;
} }