March 2018
Intermediate to advanced
1396 pages
42h 14m
English
Now that we have our low-cost IMU working in ROS, we are going to create a new node that subscribes to the imu/data topics from the Razor IMU. For example, we can see in our robot model the pitch, roll, and heading depending on the IMU data. So, let's create a new node based on our c8_odom.cpp. We will name this file c8_odom_with_imu.cpp.
Now, we are going to make some modifications. First, we will include sensor_msgs/Imu to be able to subscribe to IMU topics:
#include <sensor_msgs/Imu.h>
Also, we need a global variable to store IMU data:
sensor_msgs::Imu imu;
Then, we are going to create a callback function to obtain IMU data:
void imuCallback(const sensor_msgs::Imu ...