mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-08 02:57:16 +08:00
limit_accel_xy() splits the acceleration command into along-track and cross-track components using the normalised velocity, and prioritises the cross-track component when the command saturates the maximum lean angle. As the velocity vector rotates through zero (e.g. a hard stick reversal in Loiter, where forward speed passes through zero before reversing) the unit velocity spins rapidly. With any small residual lateral velocity (wind crab, residual velocity from prior manoeuvring) this re-projects the saturated longitudinal braking command onto a rapidly rotating axis and emits a large lateral acceleration spike, seen as a roll wobble at the moment of the stop and as a PSCE.TAE spike at each PSCN.VN zero crossing. Fade the cross-track prioritisation out to a direction-preserving magnitude limit below LIMIT_ACCEL_XY_MIN_SPEED_MS (1 m/s). Above that speed behaviour is unchanged, so path/corner tracking is unaffected. The limiter only acts when the command saturates the lean-angle limit, and stationary hold already used the isotropic branch, so precision position hold is unaffected. Adds a regression test sweeping velocity through zero and asserting no lateral acceleration is injected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>