Ask Your Question

rostopic echo: see only "parts" of a message

asked 2021-08-17 22:10:19 -0500

Kansai gravatar image

updated 2021-09-09 01:37:28 -0500

gvdhoorn gravatar image

I have recorded a rosbag with a single topic (which is a ros image topic) Unfortunately although rqt_bag can republish the messages, I cannot visualize the images (rqt_bag crashes) because of the particular format of the images (8UC4)

I can use rviz to see the images being published, so I know they are ok to an extent.

However I would like to see the timestamps of the headers of those images.

If I republish the messages of the rosbag and in another terminal I do rostopic echo the_topic I think I will get a lot of info about the image, so I don't think I will be able to see the timestamps

  • Is there a way to see only some parts of the topics being published? (like only the headers?)
  • What are other ways to inspect a rosbag (other than just writing a script myself to inspect it)
edit retag flag offensive close merge delete


for the first question rostopic echo the_topic/header will do

Kansai gravatar image Kansai  ( 2021-09-08 21:06:31 -0500 )edit

I've updated the title of your question as it seems after your edit that's the actual question you're asking.

gvdhoorn gravatar image gvdhoorn  ( 2021-09-09 01:37:54 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2021-09-09 01:38:11 -0500

gvdhoorn gravatar image

updated 2021-09-09 01:40:42 -0500

The rostopic --help output may offer some guidance here:

  --nostr               exclude string fields
  --noarr               exclude arrays

if you add --noarr to your rostopic echo command, you'll be able to see the header and other non-array fields.

Alternatively: rostopic echo can "subscribe" to individual fields.

I put "subscribe" in quotes as in reality, it will still subscribe to the topic (so not to a field), but it will only print the value of the field, instead of the entire message.

This is mentioned on wiki/rostopic - echo:

echo <topic-name/field>

Display specific fields in a message.

$ rostopic echo /my_topic/field_name
edit flag offensive delete link more

answered 2021-09-08 21:36:00 -0500

Jaron gravatar image

Timestamp and other, detailed information can be obtained by interacting with the rosbag api. Here's an example on how to interact with it.

For ROS 1, the ways to interact with the file are through the command line or the apis.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-08-17 22:10:19 -0500

Seen: 683 times

Last updated: Sep 09 '21