mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-06 19:00:27 +08:00
_init_gyro() zeroed _board_orientation for the duration of the calibration so the gyro samples came out in board frame, but that also stripped the rotation from the accel. The last accel published in that window stays in _accel[0], and AP_AHRS_DCM::reset() reads it a few lines later during init_ardupilot(), gating only on the vector magnitude - so a board-frame 9.81 passes and DCM aligns to it. On a board mounted inverted that is 180 degrees out, and drift correction then takes minutes to walk it back, failing the DCM attitude pre-arm throughout. Skip the rotation in the gyro backend while _calibrating_gyro is set, alongside the offset subtraction it already gates, and leave _board_orientation alone. The accel is then never published in board frame and DCM aligns level regardless of whether the value it reads is stale.