Waiting for transform map -> base_footprint: Lookup would require extrapolation into the past. Requested time 0.200000 but the earliest data is at time 166.333000, when looking up transform from frame [base_footprint] to frame [map]

asked 2022-05-16 02:12:19 -0500

zhangys gravatar image

updated 2022-05-16 20:03:37 -0500

ubuntu:20.04

ros: foxy

error code:

 [INFO] [1652683218.003811295] [tf2_echo]: Waiting for transform map ->  base_footprint: Lookup would require extrapolation into the past.  Requested time 0.200000 but the earliest data is at time 166.333000, when looking up transform from frame [base_footprint] to frame [map]

my tf tree looks looks complete:

image description

This issue resulted in the following error:

[rviz2-6] [INFO] [1652684161.403593755] [rviz2]: Message Filter dropping message: frame 'laser' at time 4.761 for reason 'Unknown'
[octomap_server_node-1] [INFO] [1652684178.619022477] [octomap_server]: Message Filter dropping message: frame 'laser' at time 7.607 for reason 'Unknown'

notes:

  1. I use the slam_toolbox to publish map to odom .

  2. I had used joint_state_publisher and robot_state_publisher in gazebo simulate.

  3. I had used the use_sim_time param of true.

The literal version of the tf tree is as follows:

[INFO] [1652684241.019594565] [view_frames]: Result:tf2_msgs.srv.FrameGraph_Response(frame_yaml="base_footprint: \n  parent: 'odom'\n  broadcaster: 'default_authority'\n  rate: 30.588\n  most_recent_transform: 18.302000\n  oldest_transform: 17.452000\n  buffer_length: 0.850\nodom: \n  parent: 'map'\n  broadcaster: 'default_authority'\n  rate: 1800000.000\n  most_recent_transform: 0.200000\n  oldest_transform: 0.200000\n  buffer_length: 0.000\ncamera: \n  parent: 'base_link'\n  broadcaster: 'default_authority'\n  rate: 10000.000\n  most_recent_transform: 0.000000\n  oldest_transform: 0.000000\n  buffer_length: 0.000\nbase_link: \n  parent: 'base_footprint'\n  broadcaster: 'default_authority'\n  rate: 10000.000\n  most_recent_transform: 0.000000\n  oldest_transform: 0.000000\n  buffer_length: 0.000\ndepth_camera_link: \n  parent: 'base_link'\n  broadcaster: 'default_authority'\n  rate: 10000.000\n  most_recent_transform: 0.000000\n  oldest_transform: 0.000000\n  buffer_length: 0.000\nimu_link: \n  parent: 'base_link'\n  broadcaster: 'default_authority'\n  rate: 10000.000\n  most_recent_transform: 0.000000\n  oldest_transform: 0.000000\n  buffer_length: 0.000\nlaser: \n  parent: 'base_link'\n  broadcaster: 'default_authority'\n  rate: 10000.000\n  most_recent_transform: 0.000000\n  oldest_transform: 0.000000\n  buffer_length: 0.000\nsupport: \n  parent: 'base_link'\n  broadcaster: 'default_authority'\n  rate: 10000.000\n  most_recent_transform: 0.000000\n  oldest_transform: 0.000000\n  buffer_length: 0.000\ncamera_depth: \n  parent: 'depth_camera_link'\n  broadcaster: 'default_authority'\n  rate: 10000.000\n  most_recent_transform: 0.000000\n  oldest_transform: 0.000000\n  buffer_length: 0.000\nf_l_wheel: \n  parent: 'base_link'\n  broadcaster: 'default_authority'\n  rate: 12.579\n  most_recent_transform: 18.207000\n  oldest_transform: 17.730000\n  buffer_length: 0.477\nb_l_wheel: \n  parent: 'base_link'\n  broadcaster: 'default_authority'\n  rate: 12.579\n  most_recent_transform: 18.207000\n  oldest_transform: 17.730000\n  buffer_length: 0.477\nf_r_wheel: \n  parent: 'base_link'\n  broadcaster: 'default_authority'\n  rate: 12.579\n  most_recent_transform: 18.207000\n  oldest_transform: 17.730000\n  buffer_length: 0.477\nb_r_wheel: \n  parent: 'base_link'\n  broadcaster: 'default_authority'\n  rate: 12.579\n  most_recent_transform: 18.207000\n  oldest_transform: 17.730000\n  buffer_length: 0.477\n")
edit retag flag offensive close merge delete

Comments

Did you call waitForTransform() before lookupTransform()? EDIT. Sorry, it was for ROS1 and a deprecated tf. In tf2 you should use canTransform()with a timeout http://docs.ros.org/en/latest/api/tf2... and https://docs.ros.org/en/foxy/Tutorial...

ljaniec gravatar image ljaniec  ( 2022-05-16 02:48:56 -0500 )edit

sorry ,I am using the slam_toolbox package and the octomap_server package directly. In gazebo, the official plugin is used directly. Did not write the tf publishing program myself. Can you tell me what to do in this situation? thank you very much

zhangys gravatar image zhangys  ( 2022-05-16 03:19:10 -0500 )edit

Maybe it is a similar problem like in this issue? https://github.com/cartographer-proje... You didn't add your tf tree to check, I upvoted your question - you can add it now I think

ljaniec gravatar image ljaniec  ( 2022-05-16 08:05:13 -0500 )edit

yes,they are similar。So how should I go about adding a tf tree check? By the way,If I now manually issue the command of ros2 run tf2_ros static_transform_publisher 0 0 0 0 0 0 laser map for the static coordinate transformation, then the map is detected

zhangys gravatar image zhangys  ( 2022-05-16 20:57:36 -0500 )edit

Can you add the params files you used? Maybe there is something to fix (especially the local_costmap global frame param or others connected with tf2 transformations). You can see there is a lag on your tree too, between map (oldest transform: 0.2), odom (oldest transform: 17.452) and base_footprint(oldest transform 0.0). It's a racing condition. This looks as though some of your nodes are using gazebo sim time while some other are using machine time given the difference between them is so large. Even with use_sim_time set to True you should have this code like here after your node handler

// this wait is needed to ensure this ros node has gotten // simulation published /clock message, containing
// simulation time. ros::Time last_ros_time_; bool wait = true;
while (wait) { last_ros_time_ = ros::Time::now(); if (last_ros_time_.toSec() > 0) wait = false; }
ljaniec gravatar image ljaniec  ( 2022-05-17 03:44:24 -0500 )edit

ok.all files are here.link text and I had used the use_sim_time param.

zhangys gravatar image zhangys  ( 2022-05-17 04:41:12 -0500 )edit

It sounds like a use_sim_time issue. Is robot_state_publisher using sim time?

Joe28965 gravatar image Joe28965  ( 2022-05-17 04:51:23 -0500 )edit

yes,robot_state_publisher is using sim_time.

zhangys gravatar image zhangys  ( 2022-05-17 05:02:38 -0500 )edit