Skip to content

A ROS driver and firmware to connect to Razor IMU 9DOF (Degree of Freedom) board. This board consists of 3 sensors: magnetic, gyro and acceleration sensor.

License

Notifications You must be signed in to change notification settings

AhmedBaza1/ros2_razor_imu

 
 

Repository files navigation

Official ROS Documentation

Converted to ROS2 from the package razor_imu_9dof.

A much more extensive and standard ROS-style version of this documentation can be found on the ROS wiki at:

http://wiki.ros.org/razor_imu_9dof

Install and Configure ROS Package

  1. Download code and install:

    $ git clone https://github.com/klintan/ros2_razor_imu.git
    $ cd ..
    $ colcon build --symlink-install
    

Install Arduino firmware

  1. For SEN-14001 (9DoF Razor IMU M0), you will need to follow the same instructions as for the default firmware on https://learn.sparkfun.com/tutorials/9dof-razor-imu-m0-hookup-guide and use an updated version of SparkFun_MPU-9250-DMP_Arduino_Library from https://github.com/lebarsfa/SparkFun_MPU-9250-DMP_Arduino_Library (an updated version of the default firmware is also available on https://github.com/lebarsfa/9DOF_Razor_IMU).

  2. Open src/Razor_AHRS/Razor_AHRS.ino in Arduino IDE. Note: this is a modified version of Peter Bartz' original Arduino code (see https://github.com/ptrbrtz/razor-9dof-ahrs). Use this version - it emits linear acceleration and angular velocity data required by the ROS Imu message

  3. Select your hardware here by uncommenting the right line in src/Razor_AHRS/Razor_AHRS.ino, e.g.

// HARDWARE OPTIONS
/*****************************************************************/
// Select your hardware here by uncommenting one line!
//#define HW__VERSION_CODE 10125 // SparkFun "9DOF Razor IMU" version "SEN-10125" (HMC5843 magnetometer)
//#define HW__VERSION_CODE 10736 // SparkFun "9DOF Razor IMU" version "SEN-10736" (HMC5883L magnetometer)
#define HW__VERSION_CODE 14001 // SparkFun "9DoF Razor IMU M0" version "SEN-14001"
//#define HW__VERSION_CODE 10183 // SparkFun "9DOF Sensor Stick" version "SEN-10183" (HMC5843 magnetometer)
//#define HW__VERSION_CODE 10321 // SparkFun "9DOF Sensor Stick" version "SEN-10321" (HMC5843 magnetometer)
//#define HW__VERSION_CODE 10724 // SparkFun "9DOF Sensor Stick" version "SEN-10724" (HMC5883L magnetometer)
  1. Upload Arduino sketch to the Sparkfun 9DOF Razor IMU board

Configure

In its default configuration, razor_imu_9dof expects a yaml config file my_razor.yaml with:

  • USB port to use
  • Calibration parameters

An examplerazor.yaml file is provided. Copy that file to my_razor.yaml as follows:

$ roscd razor_imu_9dof/config
$ cp razor.yaml my_razor.yaml

Then, edit my_razor.yaml as needed

Launch

Publisher and 3D visualization:

$ ros2 launch razor_imu_9dof razor-pub-and-display.launch.py

Publisher only:

$ ros2 launch razor_imu_9dof razor-pub.launch.py

Publisher only with diagnostics:

$ ros2 launch razor_imu_9dof razor-pub-diags.launch.py

3D visualization only:

$ ros2 launch razor_imu_9dof razor-display.launch.py

Calibrate

For best accuracy, follow the tutorial to calibrate the sensors:

http://wiki.ros.org/razor_imu_9dof

An updated version of Peter Bartz's magnetometer calibration scripts from https://github.com/ptrbrtz/razor-9dof-ahrs is provided in the magnetometer_calibration directory.

Update my_razor.yaml with the new calibration parameters.

Dynamic Reconfigure

Not yet supported in the ROS2 version

After having launched the publisher with one of the launch commands listed above, it is possible to dynamically reconfigure the yaw calibration.

  1. Run:

    $ rosrun rqt_reconfigure rqt_reconfigure

  2. Select imu_node.

  3. Change the slider to move the calibration +/- 10 degrees. If you are running the 3D visualization you'll see the display jump when the new calibration takes effect.

The intent of this feature is to let you tune the alignment of the AHRS to the direction of the robot driving direction, so that if you can determine that, for example, the AHRS reads 30 degrees when the robot is actually going at 35 degrees as shown by e.g. GPS, you can tune the calibration to make it read 35. It's the compass-equivalent of bore-sighting a camera.

About

A ROS driver and firmware to connect to Razor IMU 9DOF (Degree of Freedom) board. This board consists of 3 sensors: magnetic, gyro and acceleration sensor.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 55.9%
  • Python 27.2%
  • Processing 10.7%
  • MATLAB 6.2%