The timestamp on the message is earlier than all the data in the transform cache

asked 2022-03-11 15:38:36 -0500

RobVoi gravatar image

updated 2022-03-12 02:12:07 -0500

Running Nav2 I get errors I don't see a reason for to appear.

Even though the map builds and localization works, I get many errors in the console. (1 to 2 per second) Does someone have an idea on a possible cause? All nodes run on the same machine for now.

ros2 launch nav2_bringup navigation_launch.py

[controller_server-1] [INFO] [1646771670.720067917] [local_costmap.local_costmap_rclcpp_node]: Message Filter dropping message: frame 'laser' at time 1646771670.173 for reason 'the timestamp on the message is earlier than all the data in the transform cache'
edit retag flag offensive close merge delete

Comments

Are you by chance using Hokuyo lidar, on a real robot ? If yes I get similar issue. Digging in he code of the Hokuyo ROS drivers, it appears that it timestamps the messages directly with the system time and not with the ROS time source, and so the timestamps of the laserscan are in the future w.r.t to ROS time on my system... looks related, still investigating.

PatoInso gravatar image PatoInso  ( 2022-03-16 09:09:27 -0500 )edit

I am using an rplidar. But I’ll look at the time source in the driver. Same with the rf2o laser odometry driver. Maybe the issue is similar.

Thanks for the hint.

RobVoi gravatar image RobVoi  ( 2022-03-16 14:38:31 -0500 )edit

Interesting you use RF2O, so do I. This seems similar to this question: https://answers.ros.org/question/3935... I still got the issue you mention, but I did a correction in my RF2O node to reduce the rate of this error (not fully solved as my answer suggested but it helped...) I wonder if it could be an issue of computation time in RF2O that delays too much the publication of the odom message (takes ~4ms with O3 optimization vs ~70ms)...

PatoInso gravatar image PatoInso  ( 2022-03-17 03:53:18 -0500 )edit

I‘ll give your correction a try. Is the correct change a rclcpp::spin_some() in front of the process line? (fairly new to ros, only wrote one microros node so far, so I need to ask 🙈)

RobVoi gravatar image RobVoi  ( 2022-03-17 04:23:25 -0500 )edit

For my case, yes: spin_some() to get data; then process(); then spin_some() again to publish odom. But I still sometimes have the message you mention

PatoInso gravatar image PatoInso  ( 2022-03-17 04:27:27 -0500 )edit

For me it didn't change anything. (maybe a little, but could be my imagination). Or I did something wrong. You meant a change from

  myLaserOdomNode->process();
  rclcpp::spin_some(myLaserOdomNode);

to

  rclcpp::spin_some(myLaserOdomNode);
  myLaserOdomNode->process();
  rclcpp::spin_some(myLaserOdomNode);

right?

RobVoi gravatar image RobVoi  ( 2022-03-18 02:25:56 -0500 )edit

Another cheat which mostly solves the problem is changing void CLaserOdometry2DNode::publish()

odom.header.stamp = get_clock()->now(); //rf2o_ref.last_odom_time;

and

odom_trans.header.stamp = get_clock()->now(); //rf2o_ref.last_odom_time;

With this the node always publishes with the current time. Not correct, but for a slow robot it might be ok?

RobVoi gravatar image RobVoi  ( 2022-03-18 02:43:34 -0500 )edit