A Python library for attitude estimation using inertial measurement units (IMUs)
Project description
AttiPy
AttiPy is a lightweight Python package for representing and estimating the attitude (orientation) of a moving body using IMU measurements, with optional external aiding. It provides a practical Attitude and Heading Reference System (AHRS) implementation based on a multiplicative extended Kalman filter (MEKF), as well as a clean abstraction for attitude representation with clearly defined reference frames and rotation conventions.
How to install
pip install attipy
Quick start
Convert to/from a variaty of attitude representations using the Attitude class:
import attipy as ap
import numpy as np
# Quaternion to Euler angles
q = [1.0, 0.0, 0.0, 0.0]
euler = ap.Attitude.from_quaternion(q).as_euler()
# Euler angles to quaternion
euler = [np.pi/8, np.pi/4, np.pi/2]
q = ap.Attitude.from_euler(euler).as_quaternion()
# Quaternion to rotation matrix
q = [1.0, 0.0, 0.0, 0.0]
R = ap.Attitude.from_quaternion(q).as_matrix()
# Rotation matrix to Euler angles
R = np.eye(3)
euler = ap.Attitude.from_quaternion(q).as_matrix()
# etc.
Estimate attitude from IMU measurements (accelerometer and gyroscope) using the AHRS class:
import attipy as ap
import numpy as np
fs = 10.0 # sampling rate in Hz
ahrs = ap.AHRS(fs)
euler = []
for f_i, w_i in zip(acc, gyro):
ahrs.update(f_i, w_i)
euler.append(ahrs.attitude.as_euler())
euler = np.asarray(euler)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file attipy-0.0.5.tar.gz.
File metadata
- Download URL: attipy-0.0.5.tar.gz
- Upload date:
- Size: 5.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c70efae70250c7ef7c06e4d381b9abebb7575dc0cf41e6495b05e94b467913e5
|
|
| MD5 |
a7ce090e466dbac59c68f9f971605c86
|
|
| BLAKE2b-256 |
5c2adf9fcb093e13a34c18f0b1924d46847202b08cf13dc83ee8fc2212d60ca2
|
File details
Details for the file attipy-0.0.5-py3-none-any.whl.
File metadata
- Download URL: attipy-0.0.5-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e976c7fd4909cfbdf7188d737d45f17cea85e597ea59f6ded39c86739e4f60de
|
|
| MD5 |
a84419e9293cbf24ef23f78831fd93a7
|
|
| BLAKE2b-256 |
29cee1930020091c20edba348340fc551997b4bd92b0d73cd8dc5badecf73bca
|