MulticopterPositionControl: prevent velocity integrator filling up from stale acceleration setpoints

When position control is disabled, clear the setpoint properly to prevent stale values. This fixes a bug where switching to position mode in the same control loop as a hover thrust estimate update could fill up the velocity integrator.
This commit is contained in:
mahima-yoga
2026-01-07 17:57:09 +01:00
committed by Matthias Grob
parent 0375f1a6f0
commit 7c318a3296
2 changed files with 6 additions and 2 deletions

View File

@@ -408,6 +408,7 @@ void MulticopterPositionControl::Run()
} else if (previous_position_control_enabled && !_vehicle_control_mode.flag_multicopter_position_control_enabled) {
// clear existing setpoint when controller is no longer active
_setpoint = PositionControl::empty_trajectory_setpoint;
_control.setInputSetpoint(_setpoint);
}
}
}