How do you know the rate a rosbag has been recorded?
I have a rosbag that contains some (already processed)compressed images among other published topics.
I also have the original video that got converted into processed image (not in the rosbag)
If I want to publish anything (for example an image) you initiate a node, create a publisher and then use
rate = rospy.Rate(1)
where you put the rate.
I am going to play the rosbag while executing this program and I want the topics to be synchronized.
How can I know the rate which the rosbag had been recorded?
or in more general terms, how can I play the rosbag, run the script where I receive the rosbag topics while reading the bag?
Just a comment:
this is a bit of an odd thing to ask in an event based system such as a ROS application.
The pattern you describe (using a
Rate
) is not as universal as you make it out to be.It's perfectly possible to nodes to not implement a periodic loop, but instead implementing reactive behaviour only via callbacks on subscriptions, service calls and action goals.
If you think about it: what would "rate" mean in those cases?
yes, I would implement a callback if I am receiving a topic (which eventually I will be since the rosbag is played) but at the same time I will also read a video and publish its images , so how can I synchronize both?