Robotics StackExchange | Archived questions

Grab Image from Gazebo with C++

I'm trying to write a C++ program that will allow me to capture a single frame from a camera in Gazebo. The Gazebo camera itself is working because I can see a live feed with the Topic Visualizer. I already got the publishing part working. Is there a ROS or Gazebo equivalent for the following 2 lines that will allow my C++ node to "latch onto" Gazebo and subscribe to the image data?

playerccamerasubscribe(camera1, PLAYEROPENMODE); *realFrame = cvQueryFrame( capture );

Asked by K. Zeng on 2014-10-05 19:44:11 UTC

Comments

Not sure about camera subscribe function, but I use a backslash to escape underscores. Or sometimes I enclose it in back ticks a_b

Asked by scpeters on 2014-10-07 00:20:27 UTC

Answers

If you have a plugin, then you can do something similar to the example CameraPlugin.

If you have a stand-alone application, then you can subscribe the the camera's image topic, and receive images in the subscription callback. Here is an example stand-alone listener.

Asked by nkoenig on 2014-10-07 17:52:41 UTC

Comments