How To Use The SIC_MPU9250 IMU With ROS2

THE SIC_MPU9250 IMU ROS2 PACKAGE SETUP

Some quick notes before running the sic_mpu9250_ros package:

  • Firstly, ensure you have calibrated and set its Madgwick filter gain and computed its orientation, rate, and acceleration variances. If not, follow the instructions here [link to the post]
  • Also, before you start, it is worth knowing that its ROS2 package is currently implemented in ROS2 humble with the Ubuntu 22.04 LTS OS (It has not been tested in Windows). You can use it with a PC, Raspberry Pi 4, or any microcomputer running Ubuntu 22.04 LTS OS with ROS2 humble. You can also use docker.
  • You should also have some experience with ROS2 as a beginner or intermediate user.
    (e.g. Instal ros-humble, setting up ros workspace, building packages with colcon, rosdep, ros topics, rviz, ros transforms, e.t.c)

With the above in mind, follow the instructions from its Github repo (i.e. sic_mpu9250_ros package)  to get it up and running.

QUICK NOTE ON THE SIC_MPU9250_ROS PACKAGE

The sic_mpu9250_ros package provides two ways of launching it. The first is the [test_sic_mpu9250.launch.py] and the other is the [start_sic_mpu9250.launch.py].

The [test_sic_mpu9250.launch.py] is for performing quick tests to visualize the IMU orientation reading in RVIZ to see if the sic_mpu9250 is working well. The imu frame data transfrom is published over the map frame.

run rviz in a different terminal and run the command below in another terminal

ros2 launch sic_mpu9250_ros test_sic_mpu9250.launch.py

The [start_sic_mpu9250.launch.py] is used if you want to use it in a robot project. To use it in an actual robotic project like where you have created the robot’s URDF file, you’ll have an IMU link in the URDF file. The name of the IMU link must be the same as that of the frame_id property in the [sic_mpu9250_start_params.yaml] file. 

Start (launch or run) your robot package and then launch the [start_sic_mpu9250.launch.py] with the following command

ros2 launch sic_mpu9250_ros start_sic_mpu9250.launch.py

The IMU data will now be published on the IMU link of your robot.

Finally, feel free to edit the package file to your taste.