Skip to main content

Attitude and Heading Reference Systems.

Project description

AHRS: Attitude and Heading Reference Systems

AHRS is a zoo of functions and objects written in Python helping you to estimate the orientation and position of robotic systems.

Orginally, an AHRS is defined as a set of orthogonal sensors providing attitude information about an aircraft. This field is now expanding to smaller devices, like wearables, automated transportation and all kinds of robots in motion.

The module AHRS is developed with a focus on fast prototyping and easy modularity.

AHRS is compatible with Python 3.6 and above.

Installation

AHRS may be installed using pip:

pip install ahrs

Or using the latest version from the repository:

git clone https://github.com/Mayitzin/ahrs.git
cd ahrs
python setup.py install

AHRS depends on the most distributed packages of Python. If you don't have them, they will be automatically downloaded and installed.

Using AHRS

To play with orientations, for example, we can use the orientation module.

>>> import ahrs
>>> # Rotation matrix of 30.0 degrees around X-axis
... ahrs.common.orientation.rotation('x', 30.0)
array([[ 1.       ,  0.       ,  0.       ],
       [ 0.       ,  0.8660254, -0.5      ],
       [ 0.       ,  0.5      ,  0.8660254]])
>>> # Rotation sequence of the form: R_y(10.0)@R_x(20.0)@R_z(30.0)
... ahrs.common.orientation.rot_seq('yXy', [10.0, 20.0, 30.0])
array([[ 0.77128058,  0.05939117,  0.63371836],
       [ 0.17101007,  0.93969262, -0.29619813],
       [-0.61309202,  0.33682409,  0.71461018]])

It also works nicely with Quaternions.

>>> import numpy as np
>>> q = np.random.random(4)
>>> # It automatically normalizes any given vector
... ahrs.common.orientation.q2R(q)
array([[ 0.76811067,  0.3546719 ,  0.53311709],
       [ 0.55044928,  0.05960693, -0.83273802],
       [-0.32712625,  0.93308888, -0.14944417]])

ahrs also includes a module that simplifies data loading and visualizing

>>> data = ahrs.utils.io.load("ExampleData.mat")
>>> ahrs.utils.plot_sensors(data.gyr, data.acc, data.mag)

Sensor Plotting

If you want to use the sensor data to estimate the attitude, use the filters module that includes various (more coming) algorithms for it.

>>> madgwick = ahrs.filters.Madgwick()
>>> Q = np.tile([1., 0., 0., 0.], (data.num_samples, 1)) # Allocate an array for all quaternions
>>> d2g = ahrs.common.DEG2RAD   # Constant to convert degrees to radians
>>> for t in range(1, data.num_samples):
...     Q[t] = madgwick.updateMARG(d2g*data.gyr[t], data.acc[t], data.mag[t], Q[t-1])
...
>>> ahrs.utils.plot_quaternions(Q)

Quaternion Plotting

Documentation

A comprehensive documentation, with examples, will soon come to Read the Docs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

AHRS-0.1.2.post3.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

AHRS-0.1.2.post3-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file AHRS-0.1.2.post3.tar.gz.

File metadata

  • Download URL: AHRS-0.1.2.post3.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

File hashes

Hashes for AHRS-0.1.2.post3.tar.gz
Algorithm Hash digest
SHA256 8d7fe2f796474a431da865c49de0520ed6c961421be1bb84b73d46097d05bf45
MD5 69c81a9fe42ca835d47150340207bb7c
BLAKE2b-256 37fd41a29f8f491b0b87634a874715f56f6bdaa49202e1701e1c588bbf6129dd

See more details on using hashes here.

File details

Details for the file AHRS-0.1.2.post3-py3-none-any.whl.

File metadata

  • Download URL: AHRS-0.1.2.post3-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

File hashes

Hashes for AHRS-0.1.2.post3-py3-none-any.whl
Algorithm Hash digest
SHA256 71ea83dafdceb72f6affe897e5e9a04d16c94a1106e16cb15365f8ba40f00afb
MD5 08e4e80ccef2bf196fefb914b945a405
BLAKE2b-256 fe006f1e6d5a54a73def322a3c5996e12869b4aa9948c788482a68ec7c18a67e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page