Office Tools v0.1.0

pywayne-calibration-magnetometer-calibration

Sensor calibration toolkit with magnetometer calibration using close-form method. Use when calibrating IMU sensors...

wangyendt 更新于 2026-02-15 1 浏览
下载 SKILL

技能说明

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.MagnetometerCalibrator provides magnetometer calibration using sensor data (accelerometer, gyroscope, magnetometer).

直接复制以下提示词,发送给你的 AI 助手即可完成安装。

帮我下载并安装这个SKILL:https://skillhub.cstcloud.cn/download/pywayne-calibration-magnetometer-calibration
  1. 点击上方「下载 SKILL」按钮,获取技能压缩包。
  2. 将压缩包解压到你的 Agent 技能目录。
  3. 重启客户端后即可在技能列表中选择该技能。

技能文件内容

4 个文件 · 19 kB
SKILL.md text/markdown
---
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

```python
from pywayne.calibration import MagnetometerCalibrator
import numpy as np

# Sensor data: ts (N,), acc (N,3), gyro (N,3), mag (N,3)
calibrator = MagnetometerCalibrator(method='close_form')
Sm, h = calibrator.process(ts, acc, gyro, mag)

# Sm: Soft-iron matrix (3x3)
# h: Hard-iron offset vector (3,)
```

## Input Data Format

Sensor data must be numpy arrays with matching sample counts:

```python
ts   # (N,)     - Timestamps (seconds)
acc  # (N, 3)   - Accelerometer [ax, ay, az]
gyro # (N, 3)   - Gyroscope [gx, gy, gz]
mag  # (N, 3)   - Magnetometer [mx, my, mz]
```

**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:

```python
# Calibrated reading
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
- **Output**: Prints calibration parameters during processing

文件内容直接读取自技能仓库,仅供安装前审阅;以实际下载的压缩包为准。