| name | pywayne-calibration-magnetometer-calibration |
| description | Sensor calibration toolkit with magnetometer calibration using close-form method. Use when calibrating IMU sensors (accelerometer, gyroscope, magnetometer) to compute soft-iron matrix and hard-iron offset for magnetometer correction. Requires sensor fusion with VQF for orientation estimation. |
Pywayne Calibration
pywayne.calibration.MagnetometerCalibrator provides magnetometer calibration using sensor data (accelerometer, gyroscope, magnetometer).
Quick Start
from pywayne.calibration import MagnetometerCalibrator
import numpy as np
calibrator = MagnetometerCalibrator(method='close_form')
Sm, h = calibrator.process(ts, acc, gyro, mag)
Input Data Format
Sensor data must be numpy arrays with matching sample counts:
ts
acc
gyro
mag
Data requirements:
- Sensor data should cover various orientations for effective calibration
- Minimum data points required (exact number depends on calibration stability)
- Arrays must be C-contiguous (auto-converted internally)
Calibration Parameters
process() returns:
| Parameter | Shape | Description |
|---|
Sm | (3, 3) | Soft-iron matrix |
h | (3,) | Hard-iron offset vector |
Usage in Application
Apply calibration to raw magnetometer readings:
m_calibrated = Sm @ (m_raw - h)
Temporal Calibration
Temporal calibration module exists but is reserved for future expansion. Currently no functionality is implemented.
Important Notes
- Dependencies: Requires
vqf (VQF quaternion filter) and qmt (quaternion math) modules
- Method: Currently only supports
close_form method
- Orientation: Uses VQF for sensor fusion and orientation estimation during calibration
- Performance:
process() uses VQF/qmt batch operations and solves the final accumulated calibration matrix once
- Output: Prints calibration parameters during processing