sync ros bag timestamps with ros system
Currently I am publishing frames from a ROS bag file, using recorded timestamps. When I try a publish a pointcloud using from a current node. Frames do not exist to publish the topic, this is because the frames are being broadcast from a bagfile and hence have old time stamps.
One solution was the re-write the timestamps in the bag files and then play them. However by the time you parse and re-write the bag files and play them the time stamps will be too old again.
I am wondering if there was a way to force the ROS system time to equal the earliest time in the bagfile, once the bag file play command is given?
My current idea, to publish a time stamp message from the ROS bag file. Then all nodes will subscribe to this, therefore when something is published from my nodes, it can refer to the bagfile time stamp. This method would fall apart when you are rely on third party nodes to publish certain things eg pcd2pointcloud node.
Another method, would be to figure out the offset in time between the current time and the bagfile time, therefore you could publish a pointcloud to the correct time. This method would mean you cannot play the bagfile at half speed.