Why the simulated IMU sensor added to my "iris" drone model DOES NOT publish topic?

As is shown in the code, in the .sdf file of the “iris” drone model, I added the “libgazebo_ros_imu_sensor.so” plugin, and I want it to publish the topic named “/Imu_1” , however it does not publish the topic as expected. Where else do I need to modify? Any .launch file?


image

what topic are you talking about? as a ROS topic? or a Gazebo transport?

Ros topic. Like if I type “rostopic list”, one of them is MAVROS/IMU/data, and I can use it to see the data of the IMU on the drone body, now I want to see the data of the IMU on the payload which is added by me

@lzy-doom Gazebo topics are not supposed to be exposed to ros topics. Mavros talks to PX4 with mavlink and not gazebo. You either need to use gazebo_ros package to subscribe to a gazebo topic, or write a new plugin that publishes imu topics to ROS

Thanks for the information. How may I use gazebo_ros to subscribe to this “libgazebo_ros_imu_sensor”, which command should I type?

@lzy-doom I think there are a lot of tutorials available that you can look up. One example is ros-tutorial-gazebo-simulation/README_full.md at 6bdfa8b4cb16243e092bd7c687e63b44522fa466 · SMARTlab-Purdue/ros-tutorial-gazebo-simulation · GitHub

Thank you so much sir. But by reading the tutorial I am still not clear. Since I have installed ROS, Gazebo, Mavros and PX4 firmware, what else should I install? Gazebo_ros package? And then what should I do? Is the format of the code calling the libgazebo_ros_imu_sensor plugin correct? I imitated the original code format in the iris model that calls the "libgazebo_imu_plugin"as the drone body’s IMU, which is already functional in publishing IMU data, and I could not find elsewhere any files helping this body’s IMU to take effect.

This is what is written in the tutorial. You can also have a look at the official tutorial page: Gazebo : Tutorial : ROS overview

1 Like