0
$\begingroup$

Rosanswers logo

I am replaying a bag file containing point clouds, and right now can only work on that bag file.

Now rosbag play publishes the data with the original time stamps, which makes sense.

However this makes working with tf somewhat difficult, since a tfBuffer.lookupTransform at ros::Time::now() with any reasonable duration obviously gets me an empty buffer and any ros::TimerEvent last_real also returns the Unix Epoch, which does not directly translate to the timestamps from the bag data.

What is the proper way to handle Timestamping differences like this? How can I efficiently work on the data, just like it is from a real-world, live robot?


Originally posted by ignazwrobel on ROS Answers with karma: 3 on 2019-12-18

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

What is the proper way to handle Timestamping differences like this? How can I efficiently work on the data, just like it is from a real-world, live robot?

I would say configuring rosbag to publish the clock (ie: adding --clock to your rosbag play command line), and set use_sim_time to true before starting your nodes.

If you then only make use of ros::Time, things should "just work".


Originally posted by gvdhoorn with karma: 86574 on 2019-12-18

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by ignazwrobel on 2019-12-18:
Thank you very much, adding <param name="/use_sim_time" value="true"/> to the launch file and changing all ros::Time::now() to ros::Time() did the trick.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.