Attach camera sensor to UserCamera and publish as ROS topic (Gazebo 2.2)

asked 2017-04-04 21:47:18 -0500

techknowfile gravatar image

I'm new to Gazebo, and I'm trying to publish what my UserCamera sees as RGB data to a ROS topic. I'm able to setup a new camera object in an SDF with the camera sensor plugin, but I need the UserCamera so that I can make use of its GetVisual function.

I noticed that the newer gazebo versions publish the /user_camera/joypose data, so I thought I'd look at the source for that, but for some reason all of the code for publishing/subscribing there is in, which I can't access.

So far I've basically only gotten simple UserCamera functions to work by making a System plugin.

Definitely trying to climb a steep learning curve here, so any help is greatly appreciated!

edit retag flag offensive close merge delete


you could write a plugin that sets the pose of a camera sensor model to the pose of the UserCamera? not sure if that'll address your needs

iche033 gravatar imageiche033 ( 2017-04-06 12:21:00 -0500 )edit

I had a similar initial thought (set UserCamera to the position of the streaming camera), but was hoping for a more long-term, less hacky solution. I noticed that the Scene object can also select a visual at a given coordinate from a given camera, but unfortunately the Scene doesn't have access to cameras/sensors loaded in the .world file.

techknowfile gravatar imagetechknowfile ( 2017-04-09 17:53:43 -0500 )edit

The other option is to create a sytem plugin like you mentioned but you'll have to write code yourself to pack the image msg and publish to ROS topics because you probably won't be able to use gazebo_ros_pkgs's GazeboRosCamera plugin in this case.

iche033 gravatar imageiche033 ( 2017-04-10 12:04:52 -0500 )edit