I am using gmapping and robot_pose_ekf. gmapping provides tf from map to odom_combined, and robot_pose_ekf provides odom_combined to base_link. I want to see in rviz the location of the robot which is map to base_link. I therefore wrote a tf publisher to broadcast this transform.
#include #include #include int main(int argc, char** argv){ ros::init(argc, argv, "tf_linker"); ros::NodeHandle node; tf::TransformListener listener; static tf::TransformBroadcaster br; ros::Rate rate(20.0); while (node.ok()){ tf::StampedTransform t_bo; tf::StampedTransform t_om; try{ listener.lookupTransform("base_link","odom_combined",ros::Time(0),t_bo); listener.lookupTransform("odom_combined","map",ros::Time::Time(0),t_om); } catch(tf::TransformException &ex){ ROS_ERROR("%s", ex.what()); ros::Duration(1.0).sleep(); continue; } tf::Transform transform; transform.setOrigin(t_bo.getOrigin()+t_om.getOrigin()); transform.setRotation(t_om.getRotation()+t_bo.getRotation()); br.sendTransform(tf::StampedTransform(transform,ros::Time::now(),"map","base_link")); } }
The problem is that the tf times seems to not be synced by fraction of a second.
Here is the error message:
[ERROR] [1458961860.893869464]: Lookup would require extrapolation into the future. Requested time 1458961860.893782533 but the latest data is at time 1458961860.893781547, when looking up transform from frame [map] to frame [odom_combined] Warning: TF_OLD_DATA ignoring data from the past for frame base_link at time 1.45896e+09 according to authority unknown_publisher
Does tf require exactly the same time? That seems very unreasonable. How do I fix it? thanks
Originally posted by meeple on ROS Answers with karma: 1 on 2016-03-25
Post score: 0