Robotics StackExchange | Archived questions

How to Save sensor_msgs/Image

I've got Gazebo 2.2.3 and ROS Indigo set up, and I have a plugin that allows a stereo camera to publish images from Gazebo to ROS. The issue now is that I need to somehow either save the images or have access to the pointers for the camera images. Is there a Gazebo plugin that does that?

Asked by K. Zeng on 2014-10-02 12:00:39 UTC

Comments

Answers

I recently had a similar question, the answer to which might help you as well:

By adding

<save enabled="true">
    <path>/tmp</
</save>

to your camera model you can save the images in a directory of your choosing.

Asked by NickDP on 2014-10-02 15:32:37 UTC

Comments

Thanks, I'll give it a try. I just need a C++ source code now.

Asked by K. Zeng on 2014-10-02 17:25:03 UTC

Code for what? The images are stored at /tmp as .jpeg files.

Asked by NickDP on 2014-10-02 18:29:16 UTC

My original plan was to write a C++ program that takes the sensor_msgs/Image topics published by Gazebo and save them when the user inputs a command. If save is not enabled in the camera, are there still pointers for the camera images that would allow me to access those images?

Asked by K. Zeng on 2014-10-02 21:42:45 UTC

Ok, I gave it a try, and the method you suggested works. Thank you. To further clarify the code issue, I would like to write a program that saves the most recent frame captured by the camera (not all the frames continuously captured) when the user enters a certain command.

Asked by K. Zeng on 2014-10-03 09:43:32 UTC

I'm using python and have a gazebo multirobot simulation running. But I want to obtain overview pictures of the swarm system. Do y'all have any suggestions?

Asked by aj.villa on 2017-01-19 11:37:58 UTC