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

Header stamp: When is/should this be from?

asked 2019-11-22 05:36:09 -0500

Many messages in ROS include the header, which includes the timestamp.

What is best/expected practice for this? Should the stamp be the time at which the message is sent or the time of the event it is describing.

In particular most nav_msgs and sensor_msgs have headers. It would be my assumption that nav_msgs/odom would be stamped with the instant at which data were taken from the wheel encoders. Likewise, sensor_msgs/LaserScan would be stamped with some time consistently offset with the start of the rev of the scanner. This would then allow odometry and sensor data to be accurately fused.

Is this the case?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-11-22 06:32:48 -0500

gvdhoorn gravatar image

Should the stamp be the time at which the message is sent

No, typically not.

("typically, as in some cases you actually do want to know when something was published, such as when you're writing a benchmark of the ROS middleware (essentially doing stamp(received)-stamp(sent)).

or the time of the event it is describing.

That would make the most sense when dealing with sensor data, yes.

I would make it slightly more generic: you'd set the field to the time at which something was generated or captured (not all publications have sensors as there sources).

And in case of algorithms that process sensor data, it's typically the case you'd copy the stamp field of the incoming message to the outgoing one, as that would allow you to correlate processed (or derived) data to other messages that were published at the time of the original data (example: correlating processed laser scans to odometry data).

edit flag offensive delete link more

Comments

@gvdhoorn

Hi, thank you for the explanation. I have a clarification;

Node 1: I have a camera which captures images and send it to ROS queue.

Node 2: Subscribes to the topic and gets the images. I have also added a code called timer = data.header.stamp to extract the timestamp associated with the image.

My understanding is, the timer variable above corresponds to the timestamp at which image was captured by the camera (Node 1) Or does it indicate the timestamp at which image was subscribed from ROS queue using Node 2?

It would be helpful to know if this is correct.

Thanks

NiranjanRavi gravatar image NiranjanRavi  ( 2021-09-02 13:53:30 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-11-22 05:36:09 -0500

Seen: 2,373 times

Last updated: Nov 22 '19