Skip to content

ROS node for communicating with several models of commercially available IMUs over I2C in linux.

License

Notifications You must be signed in to change notification settings

JeremieBourque1/i2c_imu

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

i2c_imu

ROS driver for several 9-DOF IMUs. This node is a ROS interface for RTIMULib2 by richards-tech, a C++ library of drivers & filters of operating I2C IMUs in linux. I take no credit for RTIMULib (the hard part), I simply created a ROS interface to it (the easy part).

The list of IMUs supported by RTIMULib is as follows:

i2c_imu_node

Published topics

  • data (sensor_msgs/Imu): Data from the IMU.
  • mag (sensor_msgs/MagneticField): Data from the magnetometer, only published if the publish_magnetometer parameter is set to true.
  • euler (geometry_msgs/Vector3): Orientation as euler angles, only published if the publish_euler parameter is set to true.

Parameters

  • ~frame_id (string, default: "imu_link"): Name of the IMU's frame.
  • ~publish_magnetometer (bool, default: false): Flag to publish the magnetometer data as a sensor_msgs/MagneticField message.
  • ~publish_euler (bool, default: false): Flag to publish the orientation data as euler angles in a geometry_msgs/Vector3 message.
  • ~orientation_covariance (double[9], default: [0] * 9): Orientation covariance matrix.
  • ~angular_velocity_covariance (double[9], default: [0] * 9): Angular velocity covariance matrix.
  • ~linear_acceleration_covariance (double[9], default: [0] * 9): Linear acceleration covariance matrix.
  • ~magnetic_declination (double, default: 0): Magnetic declaration. You can find it using a magnetic declination estimator.

IMU specific parameters are not listed here

Installation

  1. Install RTIMULib2 dependencies. Qt4 is necessary to build the GUI apps included in the library and Octave is used for ellipsoid calibration of the magnetometer.

    sudo apt update
    sudo apt install qt4-default liboctave-dev
  2. Build and install RTIMULib2 from source

    mkdir ~/software && cd ~/software
    git clone https://github.com/RTIMULib/RTIMULib2.git
    cd RTIMULib2/Linux
    mkdir build && cd build
    cmake ..
    make -j4
    sudo make install
  3. Build the package

    cd ~/catkin_ws
    catkin_make

Usage

The simplest way to use this package is with

roslaunch i2c_imu i2c_imu_auto.launch

This will automatically detect the IMU and use the default parameters.

If you want to use custom parameters, such as calibration data, you can specify them directly in the launch file or in a yaml file. Look at mpu_9150_param.launch or mpu_9150.launch for an example.

How to calibrate

Calibration can be done using the tools from RTIMULib2. Instructions on how to do so can be found in this guide.

Important: to avoid an error while doing ellipsoid calibration, you'll want to run RTIMULibCal from the RTEllipsoidFit folder located where you cloned the RTIMULib2 repo. For example:

cd ~/dev/RTIMULib2/RTEllipsoidFit/
RTIMULibCal

By default, the calibration data will be written to a file named RTIMULib.ini located in the directory where you ran the calibration tool. In order for the i2c_imu_node to use this data, it needs to be converted into a yaml file. A script has been made to automatically do the conversion. It can be found in the scripts folder.

Note: right now, it will only convert the data for the mpu9250 imu.

Usage

cd scripts
./convert_params path/to/RTIMULib.ini path/to/params.yaml

About

ROS node for communicating with several models of commercially available IMUs over I2C in linux.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 42.1%
  • Python 39.4%
  • CMake 18.5%