ReadonlyfieldMean field magnitude (raw units) for optional uT scaling; 0 if unknown.
ReadonlyheadingAbsolute heading zero correction, degrees.
Readonlymatrix3x3 mag->accel alignment rotation (row-major). Identity = hard-iron only.
ReadonlyoffsetPer-axis hard-iron offset, added to the raw magnetometer (host frame).
Static ReadonlyhaloDefault Halo mag->accel alignment, used when no per-unit matrix is supplied. The QMC6308 (mag) and BMA580 (accel) dies are mounted at a fixed nominal orientation offset (~90deg about Z plus a small tilt) that is consistent across units, so a fresh calibration ships with it and tilt compensation works before any per-unit calibration; identity leaves a residual tilt error. A per-unit tumble or a loaded calibration JSON overrides it. Keep in sync with Python HALO_DEFAULT_ALIGNMENT / Dart haloDefaultAlignment.
Static ReadonlyidentityWhether an alignment matrix (beyond identity) is present.
m_corrected = matrix @ (m_raw + offset), in the host frame.
Copy with the given fields replaced (used by tumble / set-North / edits).
Tilt-compensated magnetic heading (deg, 0-360) from a raw host-frame
magnetometer + accelerometer sample. Applies hard-iron, alignment and the
heading offset; pass declination to also get a true heading.
Serialise to the Python tool's JSON shape (offset/matrix/heading_offset_deg/field_uT).
StaticfromParse from the Python tool's JSON shape; tolerates missing heading/field.
Staticfrom
Magnetometer calibration for tilt-compensated heading -- the TypeScript mirror of
brilliant_msg/calibration.py's runtimeMagCalibrationand the Flutter example'smag_calibration.dart.Three independent corrections make a worn/tilted compass usable:
examples/imu_calibrate.py) and loaded here as JSON.Inputs/outputs use the host frame produced by RxIMU (+X right, +Y forward, +Z up), so this composes with the shipped imu.lua remap. The JSON keys match the Python tool exactly, so a
mag_calibration.jsonloads directly.