Rosanswers logo

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.


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;
        catch(tf::TransformException &ex){
            ROS_ERROR("%s", ex.what());
        tf::Transform transform;

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


1 Answer 1


Rosanswers logo

Hi There, You don't need to broadcast this transform at all. In-fact doing do will confuse the TF system. If your system is already broadcasting the two TF's map -> odom_combined and odom_combined -> base_link then the job is done. The TF system can work out any transforms from map to base_link automatically.

To view this in Rviz you will need to make sure that the fixed frame is set to map. This is an option in the top left of the UI.

Hope this helps.

Originally posted by PeteBlackerThe3rd with karma: 9529 on 2016-03-27

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.