fix(flight_mode_manager): zero acceleration seed before takeoff (#28979)

* fix(flight_mode_manager): do not seed takeoff trajectories with the ground acceleration estimate

FlightModeManager calls reActivate() every cycle until the takeoff ramp
starts. Since bfb48ad17e (#27652) activate() falls back to the EKF
acceleration estimate when the previous setpoint has none, so every cycle on
the ground reseeded the manual flight tasks with it. With props spinning
slowly that estimate is vibration noise of several m/s^2, and whatever sample
was current at the start of the ramp became the initial acceleration of the
jerk-limited trajectories. In Position mode with centred sticks this produced
tilt setpoints up to the takeoff tilt limit and sideways velocity setpoints of
several m/s, and a downward seed held the vehicle on the ground despite full
climb stick. A vehicle tipped over on takeoff and was terminated by the
attitude failure detector.

Seed zero acceleration on the ground, as before #27652 and as
FlightTaskAuto::reActivate() already does. Mode switches in the air keep
using the estimate.

Signed-off-by: Isak Åslund <isak.aslund@airolit.com>

* refactor(FlightTask): use shorter matrix library form to zero out acceleration

---------

Signed-off-by: Isak Åslund <isak.aslund@airolit.com>
Co-authored-by: Matthias Grob <maetugr@gmail.com>
(cherry picked from commit 34526db026)
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
Isak Åslund authored and Ramon Roche committed 2026-10-03 16:47:53 -07:00
1 parent 38e1d0f527
commit 3ff1fc67fd
1 file changed
+2
@@ -22,6 +22,8 @@ void FlightTask::reActivate()
// Preserve vertical velocity while on the ground to allow descending by stick for reliable land detection
trajectory_setpoint_s setpoint_preserve_vertical{empty_trajectory_setpoint};
setpoint_preserve_vertical.velocity[2] = _velocity_setpoint(2);
// Start from zero acceleration to make sure no accelration measurement driven by vibration gets used on the ground
matrix::Vector3f(0.f, 0.f, 0.f).copyTo(setpoint_preserve_vertical.acceleration);
activate(setpoint_preserve_vertical);
}