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

Problems with time using rosbag api

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

apalomer gravatar image

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

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;
view.addQuery(bagR,rosbag::TopicQuery(_topics));
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?

Cheers

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

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

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

Stats

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

Seen: 239 times

Last updated: Oct 06 '13