# Pywayne Calibration Magnetometer Calibration

> 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.

- **Type:** Skill
- **Install:** `agentstack add skill-wangyendt-wayne-skills-magnetometer-calibration`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [wangyendt](https://agentstack.voostack.com/s/wangyendt)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [wangyendt](https://github.com/wangyendt)
- **Source:** https://github.com/wangyendt/wayne-skills/tree/main/pywayne/calibration/magnetometer-calibration

## Install

```sh
agentstack add skill-wangyendt-wayne-skills-magnetometer-calibration
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [wangyendt](https://github.com/wangyendt)
- **Source:** [wangyendt/wayne-skills](https://github.com/wangyendt/wayne-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-wangyendt-wayne-skills-magnetometer-calibration
- Seller: https://agentstack.voostack.com/s/wangyendt
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
