Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Odometry transform lookup fails in AMCL node


I'm new to working with tf so any input would be really appreciated.. I'm broadcasting an odom->base_link transform at 10 Hz. When I run my amcl node, I get the following warning:

[ WARN] [1354118581.042450543]: Failed to compute odom pose, skipping scan (Unable to lookup transform, cache is empty, when looking up transform from frame [/base_link] to frame [/odom])

I'm working with a slightly modified AMCL node, but it is based on the navigation stack's AMCL, and the transform listener/ odometry lookup works exactly the same.

Some debugging...

If I explicitly wait for the transform to arrive in the amcl getOdomPose function (shown below), the base_link->odom transform lookup works:

this->tf_->waitForTransform(odom_frame_id_, f, t, ros::Duration(0.1));
this->tf_->transformPose(odom_frame_id_, ident, odom_pose);

Or if I future-date the transform before broadcasting in the odometry node (shown below), the base_link->odom transform lookup also works:

  tf::StampedTransform(tf::Transform(tf::createQuaternionFromYaw(tht_), tf::Vector3(x_, y_, 0.0)),
  ros::Time::now()+ros::Duration(0.1), "odom", "base_link"));

I am not particularly happy with either of these fixes. Waiting for the transform causes the running time of the AMCL to take a huge hit. And I'm nervous about future dating the odometry because the position would be wrong if tf performs interpolation. I could increase the publishing rate of odometry from 10Hz to 20-30 Hz or so, but that doesnt seem to be a catch-all solution to me.

What is the accepted way to make sure amcl received the base_link->odom transform correctly?