Development v0.1.0

pywayne-ahrs-tools

AHRS quaternion decomposition and roll/pitch compensation utilities. Use when working with pywayne.ahrs.tools module for...

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

技能说明

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.

使用场景

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

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

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

技能文件内容

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

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