Robotics StackExchange | Archived questions

Is there a way to record a single message?

I know that if I have a node that publishes messages (in particular Image messages) I can record these messages with rosbag record into a rosbag.

My question is, if I have a single ros message (in my case an Image) can I somehow record this single message? (in a file perhaps?)

Asked by Kansai on 2021-07-28 10:32:29 UTC

Comments

Answers

Hello Kansai,

I know that if I have a node that publishes messages (in particular Image messages) I can record these messages with rosbag record into a rosbag.

Yes, you can record the image message through ros bag file. You can do so by the following the command. Even the message is single I think it can record it.

rosbag record -o subset <Topic-Name-Image>

And if you want to record multiple topic then you can

rosbag record -o subset

The -O argument tells rosbag record to log to a file named subset.bag.

Play back recording with:

rosbag play <bagfile-name>

You can check your recording in Rviz just by subscribing to your recording node.

For exporting single image here is a good document http://wiki.ros.org/rosbag/Tutorials/Exporting%20image%20and%20video%20data

Asked by Ranjit Kathiriya on 2021-07-28 10:46:08 UTC

Comments

That was an interesting tutorial. I didn't know that existed and I actually programmed the extraction of images from bags myself. Thanks

Asked by Kansai on 2021-07-29 05:31:58 UTC

The command rosbag record -h will output a description of the optional arguments. Take a look at the one called --limit.

Asked by Mike Scheutzow on 2021-07-28 15:12:53 UTC

Comments