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

"rosbag record" vs "rosbag::Bag"

asked 2012-05-24 04:21:41 -0500

Seigo gravatar image

updated 2012-05-25 08:58:09 -0500

Kevin gravatar image

Hi,

When I usually log kinect and other large data, I use "rosbag::Bag" insted of "rosbag record" command. Because a bag made by "rosbag record" has some timestamp delay and gap. On the other hand, a bag made by "rosbag::Bag" is well-timestamped (even where it log kinect data).

rosbag::Bag bag;
string filename = ros::package::getPath("xxx_bags");
filename.append("/bag/kinect.bag");
bag.open(filename, rosbag::bagmode::Write);
 :
bag.write("/topic",stamp,msg);
 :

However, it's a little pain to write all nodes. Does someone have any other good tips?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2012-05-24 04:29:33 -0500

AHornung gravatar image

rosbag record immediately records the data just as it comes off the network, including the time delay which may have happened. Thus it is the most efficient way to immediately record the data.

To synchronize the bag file later on with the time stamps stored in the messages, you can just post-process it with sync_bagfile.py in the fr_tools package. This makes the tf display from a bagfile in RViz also a bit less jerky.

edit flag offensive delete link more

Comments

Thanks! That's what I am looking for.

Seigo gravatar image Seigo  ( 2012-05-24 05:47:24 -0500 )edit

Question Tools

Stats

Asked: 2012-05-24 04:21:41 -0500

Seen: 860 times

Last updated: May 24 '12