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

rosbag API C++: Message Header Stamp sec and nsec are always zero?

asked 2014-01-27 15:07:23 -0500

gershon gravatar image

updated 2014-01-28 17:19:10 -0500

ngrennan gravatar image

The "sec" and "nsec" values in the message header are always zero when recording using "rosbag::write". I provide a valid Time for the second parameter, but that only seems to affect the message body timestamp and playback timing, but not the header. Is that expected?

I am converting some odometry and depth image information that was collected in Windows to a rosbag containing tf, depth_image, and camera_info messages (using rosbag API in C++)for consumption by the slam_gmapping node.

The rosbag I create looks correct and it plays back OK (correct timing) but the map is not generated. I looked at the code, and the slam_gmapping node is using a tf::MessageFilter. When I turn on DEBUG messages, I see messages like this "MessageFilter [target=/odom]: Added message in frame camera_depth_frame at time 0.000". The message queue fills up with messages with time 0.0000. When I inspect my bag with rqt_bag the header.sec and header.nsec are always zero, so I thought maybe that is the issue.

I have called "rosparam set use_sim_time true", but that does not help. Why is the header stamp always zero, and is that what is causing the tf::MessageFilter to never synch?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-01-27 15:31:26 -0500

gershon gravatar image

I figured out how to set the header.
It is the geometry_msgs::TransformStamped that has a .header and .stamp... not the tf::tfMessage (which is a list of geometry_msgs)


edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-01-27 15:07:23 -0500

Seen: 2,443 times

Last updated: Jan 27 '14