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

Problems with time using rosbag api

asked 2013-10-03 00:37:55 -0600

apalomer gravatar image

updated 2013-10-03 00:38:26 -0600

Hi all!!

I have some problems using the rosbag api. Here I present some of my code:

rosbag::Bag bagR("bag.bag",rosbag::bagmode::Read);
rosbag::View view;
nav_msgs::Odometry msg;
BOOST_FOREACH(rosbag::MessageInstance const m, view){
  ROS_INFO("T: %i.%i",m.getTime().sec,m.getTime().nsec);
  msg = *m.instantiate<nav_msgs::Odometry>();
  ROS_INFO("T: %i.%i",msg.header.stamp.sec,msg.header.stamp.nsec);

beeing _topics a vector of strings containg all the topics I need.

The problem is that the time from m.getTime() and the time from msg.header.stamp are different and I do not understand why that happends. Can somebody give me a hint on that?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-10-06 21:39:08 -0600

tfoote gravatar image

The time of the message in the rosbag is the message receipt time not the timestamp of the payload(It may be purposefully in the past or future, or delayed by network lag.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-10-03 00:37:55 -0600

Seen: 227 times

Last updated: Oct 06 '13