Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 475

How to extract timestamp from a bag file ?

$
0
0
Hi, I checked on the API c++ but I wasn't able to do what I want. Actually, I would like to write a little program which take an input a bag file and then obtain the the timestamp of each frame as an output. All the timestamp are stored in the /camera_topic. So far what I did is the following: rosbag::Bag bag; bag.open("mybag.bag", rosbag::bagmode::Read); rosbag::View view(bag, rosbag::TopicQuery("/camera_info")); foreach(rosbag::MessageInstance const m, view) { std_msgs::String::ConstPtr s = m.instantiate(); if (s != NULL) ASSERT_EQ(s->data, std::string("foo")); std_msgs::Int32::ConstPtr i = m.instantiate(); if (i != NULL) ASSERT_EQ(i->data, 42); } bag.close(); Is anyone can help me ? Maybe there is another easy way to do that stuff (bash ?) but It would be great using c++. Thank

Viewing all articles
Browse latest Browse all 475

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>