A ROS2 Compatible node that interfaces with the BNO085 IMU sensor via python. The node publishes the linear acceleration (gravity compensated) and angular velocity on /imu/data.
Build with colcon build
in root of repository.
Source ./install/setup.sh
.
Run with ros2 run bno085 bno085_publisher
.
TODO: Added Requirements.txt
The node communicates with the BNO08x via i2c on the Raspberry Pi and Python. The required software/libraries to run this code:
The Raspberry Pi hardware I2C implementation doesn't handle clock stretching due to a bug. This is a problem when using the BNO085 (and it's cousins it appears, the BNO55 and BNO080) because it causes the crashes when the sensor is communicating with the Pi's programs.
There are 2 recommended options across the internet:
- Slow the I2C Clock
- This didn't work well for me, as continues to crashed the script, or if too low wouldn't even detect the sensor.
- Also follow the suggestion in this hookup guide and setting the Clock faster @400KHz made it worst and crashed more quickly
- Configure and Use software I2C instead which supports clock stretching at the cost of a slight increase in CPU usage.
- Using this guide in addition to the previous link, I update the code the use the software I2C interface with
SDA
onGPIO23
, andSCL
onGPIO24
and giving the bus id3
- Using this guide in addition to the previous link, I update the code the use the software I2C interface with
As an extra: config.txt
on ubuntu on the Pi is located in /boot/firmware/config.txt
instead of /boot/config.txt
- Platform: Raspberry Pi 4
- OS: Ubuntu 22.04.2 LTS
- ROS: ROS2 Humble
- Python: 3.10.6