Skip to main content

AHRS


This example demonstrates the work of Mahony AHRS with the data from an onboard MPU9250 or LSM9DS1 sensor. We have also made a simple but cool visualizer that you can run on your PC or Mac. Below are the instructions how to run AHRS and visualizer.

Prepare your Mac

Install pip and use it to get required packages:

sudo pip install PyOpenGL PyOpenGL_accelerate
sudo pip install pyserial

You might be asked to install command line developer tools along the way.

Prepare your PC

  1. Install Python.
  2. Install OpenGL.
  3. Install Pyserial.
  4. Download Freeglut binaries and place 32-bit and 64-bit DLLs to Windows 32-bit (C:\Windows\SysWOW64) and 64-bit (C:\Windows\System32) folders.

On Mac

Download the archive with Navio2 utilities. Extract the archive, enter the directory with 3DIMU utility and run it:

cd Navio2/Utilities/3DIMU
python 3Dimu.py

On PC

Download the archive with Navio2 utilities. Extract the archive, enter the directory with 3DIMU utility, open .py file with Python. Make sure Windows Firewall is off.

On Raspberry Pi

  1. Clone Navio2 repository using the following instructions.
  2. Build the examples performing the following commands:
cd C++
make
  1. Check the AHRS example running this command:
cd Build
./AHRS -i [sensor name] X.X.X.X 7000

Where X.X.X.X is an IP address of your PC. 7000 is the port number used in 3DIMU. Argument [sensor name] allows you to choose inertial measurement unit: mpu is MPU9250, lsm is LSM9DS1.

Now try to move your Navio2 and check how the “brick” on the screen moves along with it.