robotics//sensor//IMU//AHRS

An AHRS, attitude and heading reference system, is an IMU with an estimator attached that fuses its gyroscopes, accelerometers and usually a magnetometer into a continuous estimate of orientation (roll, pitch and heading), and it is what gives a drone, a small aircraft, a boat's autopilot or a camera gimbal its sense of which way is up and which way is north. It is sold as one module, or it is the attitude part of an autopilot's filter; either way it takes raw rates and accelerations in and returns an attitude, often as a quaternion.


An AHRS, attitude and heading reference system, is an IMU with an estimator attached that fuses its gyroscopes, accelerometers and usually a magnetometer into a continuous estimate of orientation (roll, pitch and heading), and it is what gives a drone, a small aircraft, a boat's autopilot or a camera gimbal its sense of which way is up and which way is north. It is sold as one module, or it is the attitude part of an autopilot's filter; either way it takes raw rates and accelerations in and returns an attitude, often as a quaternion.

Each sensor covers what the others lack. The gyroscope, integrated, follows fast rotations smoothly and drifts; the accelerometer sees gravity, which fixes roll and pitch over the long run but says nothing about heading; the magnetometer sees north, which fixes heading and is fooled by motors, steel and power cables. The estimator (a complementary filter on cheap hardware, an extended Kalman filter on better) uses the gyroscope for the fast part and lets gravity and north pull the slow part back, estimating the gyroscope's bias as it goes.

An AHRS knows how it is oriented, an INS also knows where it is.

An inertial navigation system goes further: it rotates the accelerations into the Earth frame, removes gravity and integrates twice for velocity and position. That double integration is merciless (a 1° attitude error leaks 0.17 m/s20.17\ \text{m/s}^20.17 m/s2 of gravity into the horizontal), so an INS needs much better sensors or a GNSS receiver correcting it continuously, while an AHRS gets by with a few-euro MEMS chip.

Its accelerometer reference is only valid when the vehicle is not accelerating. In a sustained turn, a car braking or a drone pushing forward, the accelerometer measures gravity plus the manoeuvre, and a naive AHRS tilts its horizon toward the false vertical; good ones lower the accelerometer's weight when its magnitude departs from 1 g, or use the GPS velocity to subtract the manoeuvre.

Heading is its weak axis. Indoors, near motors or in a steel ship, the magnetometer misleads, and the heading drifts with the gyroscope's bias; dual GNSS antennas or a camera give heading where the magnetic field cannot be trusted (dead reckoning shows how fast an uncorrected angle wanders).

Its quality is read from the IMU's grade and from the filter: a hobby flight controller's AHRS holds roll and pitch within a degree or two, an industrial module within a few tenths, and both are only as good as the sensor calibration and the mounting behind them.