git clone https://github.com/RPi-Distro/RTIMULib
cd RTIMULib/Linux/python
sudo python3 setup.py install
cd ../RTIMULibCal/
make
sudo make install
First run RTIMULibCal
to create the RTIMULib.ini
file.
- Edit
RTIMULib.ini
. - Find each variable in
RTIMULib.ini
and set it to the values below.
IMUType=7
BusIsI2C=true
I2CBus=2
I2CSlaveAddress=104
- Run
RTIMULibCal
inside theRTIMULib/Linux/RTIMULibCal
- Follow calibration instructions. (I had good results after using only
m - calibrate magnetometer with min/max
)- After you finish the calibration,
RTIMULibCal
writes the calibration values to theRTIMULib.ini
file.
- After you finish the calibration,
mkdir compass_example
cd compass_example
- Copy
RTIMULib.ini
fromRTIMULib/Linux/RTIMULibCal/
to thecompass_example
folder.
wget https://gist.githubusercontent.com/ansarid/23ab5561d7287cec4e5aacd7c72db1f1/raw/4ad2881648d09bb5f3fef774c486ff9615f9cb4c/compass_ex.py
compass_example
├ RTIMULib.ini
└ compass_ex.py
python3 compass_ex.py