Robotics StackExchange | Archived questions

Question regarding tf2 static_transform_publisher

Under ROS Hydro, I'm attempting to publish static transforms using the tf2ros statictransform_publisher using the following in may .launch files:

<node name="tag00001_publisher" pkg="tf2_ros" type="static_transform_publisher" args="1.00 1.00 0.35 0.00 0.00 0.7071 0.7071 /map /tag00001" />

In my C++ code I want to use these transform. To do so making a call using the canTransform() method on the tf2_ros::Buffer object to make sure the transform can occur before getting the transform with the lookupTransform() method.

if (tf_buffer_.canTransform(map_frame_, tag_frame_, ros::Time::now(), ros::Duration(0.1), &tf_err) {
  ...
}

This method call will succeed the first time, but subsequent calls will fail. However, if I use tf to publish the static transform as shown below, the code above will always succeed.

<node name="tag00001_publisher" pkg="tf" type="static_transform_publisher" args="1.00 1.00 0.35 0.00 0.00 1.57 /map /tag00001 100" />

Is this an issue with the tf2_ros::Buffer.canTransform() not yet properly working with latched transform publishers?

What's puzzling to me is why the call to the canTransform() method will succeed once, but not on subsequent calls unless I'm using the tf version of the statictransformpublisher.

I have a feeling there is something missing in my understanding of tf2 and how the tf2_ros::Buffer class. Unfortunately, the tf2 tutorials are woefully outdated and not very helpful in this regards.

Asked by mpthompson on 2014-07-18 15:36:10 UTC

Comments

Hi,

did you solve the problem? I'm having the same issue.

Asked by Hernan on 2015-08-11 08:31:50 UTC

Answers