Similar to GPS, we can start the IMU simulation using the following command:
$ roslaunch sensor_sim_gazebo imu.launch
You will get orientation values, linear acceleration, and angular velocity from this plugin. After launching this file, you can list out the topics published by the imu plugin. Here is the list of topics published by this plugin:
We can check out the /imu topic by echoing the topic. You can find orientation, linear acceleration, and angular velocity data from this topic. The values are shown here:
If you look at the IMU plugin definition code from sensor_sim_gazebo/urdf/imu.xacro, you can find the name of the plugin and its parameters.
The name of the plugin is mentioned in the following code snippet:
<gazebo> <plugin name="imu_plugin" filename="libgazebo_ros_imu.so"> <alwaysOn>true</alwaysOn> <bodyName>sensor</bodyName> <topicName>imu</topicName> <serviceName>imu_service</serviceName> <gaussianNoise>0.0</gaussianNoise> <updateRate>20.0</updateRate> </plugin> </gazebo>
The plugin's name is libgazebo_ros_imu.so, and it is installed along with a standard ROS installation.
You can also visualize IMU data in RViz. Choose the imu display type to view it. The IMU is visualized as a box itself, so if you move the box in Gazebo, you can see an arrow moving in the direction of movement. The Gazebo and RViz visualizations are shown here:
Now, let's see how to interface real hardware with ROS.