Installing Razor IMU ROS library

In order to install the Razor IMU library for ROS, we have to install visual python with the following command:

    $ sudo apt-get install python-visual
  

Then, we have to go to our workspace /src folder and clone from GitHub the razor_imu_9dof repository from Kristof Robot and compile it:

    $ cd ~/dev/catkin_ws/src
    $ git clone https://github.com/KristofRobot/razor_imu_9dof.git
    $ cd ..
    $ catkin_make
  

You need to have Arduino IDE installed; this is explained previously in the Arduino section of this chapter. Open your Arduino IDE-/dev/catkin_ws/src/Razor_AHRS/Razor_AHRS.ino. Now, you have to select your hardware options. Search in the code this section and uncomment the right line for you:

/*****************************************************************/ 
/*********** USER SETUP AREA! Set your options here! *************/ 
/*****************************************************************/ 
 
// 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 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)

In my case, I'm using 9DoF Razor IMU version SEN-10736. Now, you can save and upload the code. Take care to choose the right processor in the Arduino IDE. For my razor IMU, an Arduino Pro or Pro Mini has to be chosen and an ATMega 3.3V 8 MHz must be selected as processor.

In the razor_imu package, you have to prepare a config file named my_razor.yaml. You can copy the default to my_razor.yaml configuration doing:

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

You can open the file and check whether the configuration matches with yours. Now the most important thing is setting up your port correctly; check it whether you are using the sensor stick and your Arduino. In my case, it is by default:

port: /dev/ttyUSB0 

Note that if you calibrate your IMU, you can include all the calibration parameter in this file to have a correct orientation measurement.

You can use now your razor_imu or stick with the following launch command:

    $ roslaunch razor_imu_9dof razor-pub-and-display.launch
  

Two windows must appear, one with a 3D figure that represents the pose of the IMU and a 2D figure with the Roll, Pitch, and Yaw.

Razor IMU display

After some seconds, sensor msgs::IMU start to be transmitted and you will see how the parameters will change if you move your sensor.

Razor IMU with different orientation
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.242.141