Gazebo plugin with custom ROS message

asked 2017-03-17 12:30:00 -0500

skm gravatar image

updated 2017-03-17 17:11:03 -0500


I've a Gazebo plugin and a ROS package. The Gazebo plugin is able to subscribe to a ROS topic and receive ROS messages. The message is of type std_msgs::Float32 just for testing. My ROS package uses also a custom ROS message (called "Cables.msg"), that works just fine inside it.

But now I also want my Gazebo plugin to connect to a ROS topic that uses that custom ROS message. So I need to integrate the custom ROS message into my Gazebo plugin somehow. I don't really know how to do that.

I have a Cmake file that builds my custom ROS message with catkin (the built message "Cables.h" is then in the corresponding devel folder as expected). But the Gazebo plugin is not built using catkin, so I don't know how to connect my Gazebo plugin to the custom ROS message.

Thank you very much, skm

P.S: I was not sure if I should ask my question here or on the "Gazebo Answers" page. But I think here are more people who know how to work with custom ROS messages, so I asked my question here.

Edit: I found a solution (sort of): The custom ROS messages were already build in the ROS package. So I just copied the generated header files (e.g. "Cables.h") to my Gazebo plugin project and included the generated headers in my code. Works fine to receive custom ROS messages with the Gazebo plugin. But of course copying the compiled headers from another project is not an ideal solution.

edit retag flag offensive close merge delete