Skip to content
Back to skills

Ahrs Tools

ASecurity

AHRS quaternion decomposition and roll/pitch compensation utilities. Use when working with pywayne.ahrs.tools module for quaternion to Euler angle decomposition, or compensating orientation to zero pitch and roll using roll-pitch compensation method.

  • 8 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added February 10, 2026
developmentpython

Works with

  • cli

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add wangyendt/wayne-skills --skill ahrs-tools --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ahrs Tools?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ahrs Tools
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wangyendt-ahrs-tools/badge)](https://www.skillsdirectory.com/skills/wangyendt-ahrs-tools)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: pywayne-ahrs-tools
description: AHRS quaternion decomposition and roll/pitch compensation utilities. Use when working with pywayne.ahrs.tools module for quaternion to Euler angle decomposition, or compensating orientation to zero pitch and roll using roll-pitch compensation method.
---

# Pywayne AHRS Tools

This module provides quaternion-based AHRS (Attitude and Heading Reference System) utilities.

## Quick Start

```python
from pywayne.ahrs.tools import quaternion_decompose, quaternion_roll_pitch_compensate
import numpy as np

# Quaternion decomposition
q = np.array([0.70710678, 0, 0, 0.707962])  # w, x, y, z
angle_all, angle_heading, angle_inclination = quaternion_decompose(q)

# Roll/pitch compensation
q_comp = quaternion_roll_pitch_compensate(q)
```

## Quaternion Decomposition

```python
from pywayne.ahrs.tools import quaternion_decompose
import numpy as np

# Input quaternion (w, x, y, z)
q = np.array([w, x, y, z])

# Decompose into angles
angle_all, angle_heading, angle_inclination = quaternion_decompose(q)

# angle_all: Rotation angles around all axes (vertical + horizontal)
# angle_heading: Angle around vertical axis (inclination)
# angle_inclination: Angle around horizontal axis (bank)
```

## Roll/Pitch Compensation

```python
from pywayne.ahrs.tools import quaternion_roll_pitch_compensate
import numpy as np

# Input quaternion (w, x, y, z)
q = np.array([0.989893, -0.099295, 0.024504, -0.098242])

# Compensate pitch and roll to zero
q_comp = quaternion_roll_pitch_compensate(q)
```

## Requirements

- `numpy` - Array operations
- `qmt` - OpenCV's quaternion module for conversions

## Notes

- Decomposition returns both angles (in radians) and heading/inclination
- `angle_all` is computed using 2*arccos/abs(quaternion_z)
- `angle_heading` uses `arctan2(np.abs(quaternion_xy))`
- `angle_inclination` uses `2*arcsin(np.abs(quaternion_xy))`
- Roll/pitch compensation sets pitch and roll of q_comp to zero by using inverse rotation

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.