Ask Your Question

Robot Localization Time stamps

asked 2021-02-23 04:15:28 -0600

xaru8145 gravatar image


I have been trying to understand how robot_localization deals with timestamps but there are still some aspects that I have not been able to quite grasp yet.

I have the global EKF filter from robot_localization currently working at 60Hz and I have the following sensors operating at these frequencies:

  • Wheel odometry: 50Hz
  • GPS odometry: 10Hz
  • Heading: 5Hz
  • IMU: 50Hz

What timestamp has the odometry/filtered output of EKF? The one from the last available measurement? In this case, if your input sensors have lower frequency than than the filter output, it will repeat measurements and timestamps.

The filter predicts and corrects with measurements and then it does a periodic update at the specified frequency (60Hz in my case). So in this case, if the periodic update matches with a prediction step, it will publish the prediction or it will publish the last correction?

Thanks a lot! :)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-02-25 04:46:06 -0600

xaru8145 gravatar image

After doing a lot of research, I think I now understand how it works. I found this links very useful:

Basically, robot_localization uses the time stamps in the headers of its input messages. For every sensor message that we receive, we stick it in a priority queue based on its timestamp (earlier stamps first).

After we've enqueued all messages, we start going through the queue. We predict from the last update time to the measurement's time stamp, then correct. We then pull the next measurement from the queue, predict up to its time stamp, then correct. We repeat this until the queue is empty.

We then do a periodic update with a specified frequency and publish the odometry message. Up to this point, we have 2 options.

  1. Set predict_to_current_time=false. We look for the last measurement time stamp and we publish the state that we corrected with that measurement. We stamp the odom message with the sensor time stamp. This mode can repeat time stamps if the frequency of the input sensors is lower than the filter publishing frequency.
  2. Set predict_to_current_time=true. This causes the filter to always do a prediction from the last measurement time to ros::Time::now() avoiding the repetition of timestamps. NOTE: This mode works under the assumption that all the time stamps that the package receives come from either the same clock, or clocks that have been synchronized.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-02-23 04:15:28 -0600

Seen: 17 times

Last updated: Feb 25