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

How to modify the bag file?

asked 2011-12-19 03:19:10 -0500

eddyxd gravatar image

I planned to test the result of kinect signal after some information in points cloud is corrupt to simulate the bit error after wireless transmission.

So I firstly save these points could data by rosbag, and I can replay it to rviz project.

However, I then want to change certain bits in the bag file to see what happens when some points data is wrong, and I faced two questions :

  1. bag file formate is different from what rosbag-format wiki told? I try to make a simple test at first : write the publisher always publish Hellow World xxx as the beginner tutorial did, and bag this topic.

    My result bag file looked like this : E^@^@^@^P^@^@^@chunk_count=^A^@^@^@^O^@^@^@conn_count=^A^@^@^@^R^@^@^@index_pos=^A&^@^@^@^@^@^@^D^@^@^@op=^C»^O^@^@^R^@^@^@^N^@^@^@Hello World592&^@^@^@ ^@^@^@conn=^@^@^@^@^D^@^@^@op=^B^M^@^@^@time=ahïNlN<9a>1^R^@^@^@^N^@^@^@Hello World593&^@^@^@ ^@^@^@conn=^@^@^@^@^D^@^@^@op=^B^M^@^@^@time=ahïN^Fß<91>7^R^@^@^@^N^@^@^@Hello World594&^

So, I think it should be a plaintext(readable) like something "<header><content><xxxx>..etc", but it is not QQ. How can I ask decrypt it to a readable plaintext?

  1. After I change the the "Hellow" in the bag file to "ILoveYou", and replay it : My subscriber still get the Hello World ........not the ILoveYou World????

This is my first time to use ROS, I have read all overview and done all tutorial in the wiki... Could anyone give me some suggestion????

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2011-12-19 03:49:42 -0500

DimitriProsser gravatar image

Your best bet is to use the rosbag API to try to solve your problem. It gives you access to the bag data so that you can modify it.

edit flag offensive delete link more


Thanks!! I think it is what I am looking for!
eddyxd gravatar image eddyxd  ( 2011-12-19 04:06:40 -0500 )edit
By the way....I follow the c++ tutorial but get a build msg told me : sniffer.cpp:2:24: error: rosbag/bag.h: No such file or directory, I have set the right path because I can include "ros/ros.h"..@@ could you give me some suggestion?
eddyxd gravatar image eddyxd  ( 2011-12-19 04:08:27 -0500 )edit
Did you add <depend package="rosbag" /> to your manifest.txt?
DimitriProsser gravatar image DimitriProsser  ( 2011-12-19 04:20:44 -0500 )edit
I has added it but there is a typo, It works now!!! thanks!!
eddyxd gravatar image eddyxd  ( 2011-12-19 05:16:42 -0500 )edit

answered 2011-12-19 03:35:57 -0500

eddyxd gravatar image

Hi, all. I am sorry that I post this thread before I searching this forum....

There is a post teaching a way to convert bag to readable data formate by : rostopic echo -b file.bag -p /topic

So, my question now is : How can I convert this readable format back to bag file formate?? (Because I need to changed some bits in it and replay it)

Is it possible?

edit flag offensive delete link more

Question Tools


Asked: 2011-12-19 03:19:10 -0500

Seen: 3,554 times

Last updated: Dec 19 '11