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

Revision history [back]

click to hide/show revision 1
initial version

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

  • https://answers.ros.org/question/220538/robot_localization-time-issues/
  • https://github.com/cra-ros-pkg/robot_localization/issues/336

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.