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

Revision history [back]

click to hide/show revision 1
initial version

There's a lot missing from your code (how are you getting messages? is there a subscriber? why do you want a specific timestamp? how are you reading the bag file?) , so the best I can do is a generic answer:

rosbag has a C++ API that can be used to read all of the messages from a bag file, in order. You can use this to get the first (or Nth) message from a bag file, or you can compare the header timestamps if you want a message with a specific timestamp.