ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to decode binary data from a rosbag ?

asked 2018-05-15 09:07:26 -0500

aks gravatar image

When i try to echo the topics of a bag file, i get a message : data: !!binary | ChQJpiM5J7b11UESB2dhdGV3YXkYSRI7GAEt0YmNPjUAAAAARQAAAABNAAAAAF0AAAAAqAEAsAEA uAEAygEUCaYjOSe29dVBEgdjaGFzc2lzGAcamgEKGwl+jANaaLcaQRG3Y7kbwu1QQRlNc4QFq/qd vxIkCQAAAAAAAAAAEQAAAAAAAAAAGbZX/zsVBNw/IYPT7lNnxew/GhsJlaAsEDqx0T8R+pqtiJCs kzwZBQSdL5XVZj8iGwmW/f98qKacPxHERbyH1aKhvBlzAOArHy9+vyobCfeLggMmjbI8ER2XZG1t Jzg/GfBTn4g5Yn08IQAAAAAAABxA

This data seems to be binary encoded. The message type of this topic is string. How can i read this data ?

edit retag flag offensive close merge delete

Comments

Can you show us the command you are using to try and echo the topics of a bag file. This doesn't look like anything I've seen from rostopic echo before.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-05-15 13:43:49 -0500 )edit

The command is normal rostopic echo /pnc/carstatus but there seems to be a unicode error. It also says : UnicodeDecodeError: 'ascii' codec cant decode byte 0xe7 in position 1496: ordinal not in range(128).

aks gravatar image aks  ( 2018-05-16 02:37:54 -0500 )edit

This is most likely a std_msgs/String that either:

  • contains multibyte characters
  • is being abused for transmitting non-character data

It would help if you could show the message definition @aakash_sehgal.

gvdhoorn gravatar image gvdhoorn  ( 2018-05-16 02:41:50 -0500 )edit

@gvdhoorn could you kindly guide me how to do that ? I only have the rosbag file.

aks gravatar image aks  ( 2018-05-16 02:49:56 -0500 )edit

ran the python script from the command line : ./ message_definition.py Bagname but it gives the same error : UnicodeDecodeError: 'ascii' codec cant decode byte 0xe7 in position 1496: ordinal not in range(128). Exactly this

aks gravatar image aks  ( 2018-05-16 03:36:51 -0500 )edit
1

Yes, that's a problem. I don't have time to look into this right now, but it's one of the consequences of most some of ROS Python code not being Unicode aware/safe.

What you could do is open the bag file with a text editor (don't save it), then scroll down a bit until you ..

gvdhoorn gravatar image gvdhoorn  ( 2018-05-16 03:39:10 -0500 )edit
1

.. come across message definitions.

If you know a bit of text from the definition that would help, as you can then just search for it.

Then carefully copy-paste the def into a new file and save it as a msg def.

gvdhoorn gravatar image gvdhoorn  ( 2018-05-16 03:39:58 -0500 )edit
1

I seem to remember you got this bag / these bags from a colleague. If that is the case, it would be infinitely easier / more convenient to just get the definitions from him.

gvdhoorn gravatar image gvdhoorn  ( 2018-05-16 03:40:50 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-05-16 03:09:08 -0500

gvdhoorn gravatar image

See #q230120.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-05-15 09:07:26 -0500

Seen: 1,815 times

Last updated: May 15 '18