ROS 2 Jazzy driver for the Bosch BNO055 9-axis absolute orientation IMU over I2C.
- Publishes
sensor_msgs/Imuon theimu/datatopic (includes fused quaternion orientation) - Publishes
sensor_msgs/MagneticFieldon theimu/magtopic - Publishes
sensor_msgs/Temperatureon theimu/temptopic - Fake mode — generates random 9-axis IMU data without physical hardware
- Built-in sensor fusion: absolute orientation as quaternion (NDOF mode)
- Configurable operation mode: NDOF, IMU, Compass, M4G
- Calibration status readable from the BNO055
There is an existing ROS2 BNO055 driver (flynneva/bno055). This package takes a different approach:
| Feature | flynneva/bno055 | This package |
|---|---|---|
| fake_mode | Not supported | Supported (default true) |
| Calibrate / Reset services | Read-only (returns current offsets) | Auto-calibrate (2 s sampling) + reset |
| Runtime parameter change | Not supported | publish_rate changeable via ros2 param set |
| ROS2 Jazzy | Not explicitly tested | Tested on Jazzy |
| I2C library | smbus |
smbus2 |
| UART support | Yes | No (I2C only) |
| Axis remapping | Yes (P0–P7) | No |
| Topics | 6 (imu, imu_raw, mag, grav, temp, calib_status) | 3 (imu/data, imu/mag, imu/temp) |
| colcon test | No launch tests | Full launch tests (28 tests, 0 failures) |
Choose this package if you need fake_mode for CI/testing, simple calibration services, or a lightweight Jazzy-tested driver. Choose flynneva/bno055 if you need UART support or axis remapping.
- ROS 2 Jazzy
- Python 3
smbus2(only required whenfake_modeisfalse)
pip3 install smbus2cd ~/ros2_ws
colcon build --packages-select bno055_imu
source install/setup.bashros2 launch bno055_imu bno055_launch.pyros2 run bno055_imu bno055_node.py --ros-args -p fake_mode:=trueros2 run bno055_imu bno055_node.py --ros-args -p fake_mode:=falseros2 launch bno055_imu bno055_launch.py params_file:=/path/to/your_params.yamlros2 topic echo /imu/data
ros2 topic echo /imu/mag
ros2 topic echo /imu/temp| Parameter | Type | Default | Description |
|---|---|---|---|
fake_mode |
bool | true |
true: generate random data, false: read from real I2C device |
i2c_bus |
int | 1 |
I2C bus number (/dev/i2c-N) |
device_address |
int | 0x28 |
BNO055 I2C address (0x28 or 0x29) |
publish_rate |
double | 100.0 |
Publishing rate in Hz |
frame_id |
string | imu_link |
TF frame ID in message headers |
operation_mode |
string | ndof |
Fusion mode: ndof, imu, compass, m4g |
orientation_covariance |
double | 0.01 |
Diagonal orientation covariance (rad²) |
angular_velocity_covariance |
double | 0.02 |
Diagonal angular velocity covariance (rad²/s²) |
linear_acceleration_covariance |
double | 0.04 |
Diagonal acceleration covariance (m²/s⁴) |
magnetic_field_covariance |
double | 0.0 |
Diagonal magnetic field covariance (T²), 0 = unknown |
| Mode | Sensors Used | Description |
|---|---|---|
ndof |
Accel + Gyro + Mag | 9-axis absolute orientation (default) |
imu |
Accel + Gyro | 6-axis relative orientation (no magnetometer) |
compass |
Accel + Mag | Heading only |
m4g |
Accel + Mag | Rotation from magnetometer, tilt from accelerometer |
bno055_imu/
├── CMakeLists.txt
├── package.xml
├── config/
│ └── bno055_params.yaml
├── launch/
│ └── bno055_launch.py
├── bno055_imu/
│ ├── __init__.py
│ └── bno055_driver.py
├── nodes/
│ └── bno055_node.py
└── test/
└── test_bno055_node.py
Tested on Ubuntu 24.04 (WSL2) with fake_mode: true.
$ colcon test --packages-select bno055_imu
$ colcon test-result --verbose
Summary: 28 tests, 0 errors, 0 failures, 0 skipped
| Test Category | Test | Result |
|---|---|---|
| Topics | imu/data publishes sensor_msgs/Imu |
PASS |
| Topics | imu/mag publishes sensor_msgs/MagneticField |
PASS |
| Topics | imu/temp publishes sensor_msgs/Temperature |
PASS |
| Topics | frame_id == "imu_link" |
PASS |
| Topics | Temperature in range 10-40 °C | PASS |
| Services | imu/calibrate returns success=True |
PASS |
| Services | imu/reset returns success=True |
PASS |
| Parameters | publish_rate runtime change to 20.0 Hz |
PASS |
| Shutdown | Clean exit (code 0, -2, or -15) | PASS |
| Linting | pep257, flake8, copyright, xmllint | PASS |
This project is licensed under the MIT License. See LICENSE for details.