ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to visualize/read string messages from Rosbag

asked 2018-03-29 07:03:54 -0500

aks gravatar image

updated 2022-06-12 19:45:20 -0500

lucasw gravatar image

I have received a bag file from a colleague and i need to analyze it. The file looks like this. image description

How can i visualize this in rviz ? What type shoul i select here instead of point cloud ? image description

edit retag flag offensive close merge delete



Note: please review the support guidelines. Posting screenshots of textual content is strongly discouraged.

gvdhoorn gravatar image gvdhoorn  ( 2018-03-29 07:27:36 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2018-03-29 07:26:26 -0500

gvdhoorn gravatar image

How can i visualize this in rviz ?

std_msgs/String does not have a display type in RViz at the moment. It would also seem to be difficult, as plain strings do not carry any intrinsic semantic meaning (ie: automated interpretation is rather difficult).

More specifically, RViz renders messages in a 3D context, so it requires spatial information (initially) to be able to do that. It uses the frame_id field (ie: TF) in incoming messages for that.

std_msgs/String does not have that, so it cannot be visualised like this.

edit flag offensive delete link more


Note also that what you're running into is a result of the (mis)use of messages and the reason that using semantically meaningful and appropriate messages is always strongly encouraged.

gvdhoorn gravatar image gvdhoorn  ( 2018-03-29 07:28:24 -0500 )edit

Thanks for the explanation. I thought the same as well.

Then how can i atleast read this data ? one way is definitely to convert it into a csv file. I tried the following :rostopic echo -b file.bag -p /topic > data.txt but it gives a UnicodeDecodeError. Any idea ?

aks gravatar image aks  ( 2018-03-29 07:30:27 -0500 )edit

I'm not sure how well supported unicode/utf-8 is right now. If you have used characters from extended character sets this might cause problems.

It shouldn't though, so if you can create an MWE, you should report it.

gvdhoorn gravatar image gvdhoorn  ( 2018-03-29 08:31:58 -0500 )edit

Yes, i guess there are some chinese characters in it but i am not sure.

  • How can i check the contents of this bag file ?
  • If you look at the image above, the bagfile has a topic called /perception/kouliang and the message type is sim_l3_msg/kouliang. I do not actually know what is it ?
aks gravatar image aks  ( 2018-03-29 08:51:20 -0500 )edit

re: get at the contents of the bag: if you play the bag, can you rostopic echo .. the topics in question?

re: msg type: you would have to ask your colleague. That is a custom message, so he should know.

gvdhoorn gravatar image gvdhoorn  ( 2018-03-29 08:52:59 -0500 )edit

answered 2018-03-29 10:54:28 -0500

Dirk Thomas gravatar image

You could use the rqt plugin "Topic Monitor" to subscribe to any message and show the content of the fields. It is basically the graphical equivalent of the already mentioned command line tool ros topic echo.

edit flag offensive delete link more


This is a good suggestion, but technically not an answer ;) The OP specifically asked how to visualise std_msgs/String in RViz.

gvdhoorn gravatar image gvdhoorn  ( 2018-03-29 11:11:04 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2018-03-29 07:03:54 -0500

Seen: 941 times

Last updated: Mar 29 '18