0
$\begingroup$

Rosanswers logo

It used to be that, with tf, we would use a TransformListener and its transformDATA() methods, e.g.

import tf
listener = tf.TransformListener()
...
ptNew = listener.transformPoint('frameNew', ptOld)

but now with tf2 (i.e. tf2_ros), there doesn't seem to be a transformPoint(). The only place I can find something close is in tf2_geometry_msgs.do_transform_point(), which requires PyKDL (not installed by default with ROS). I can't find any docs on the api for the do_transform_DATA(), however, and I see that the code is called "geometry_experimental" on github. Am I just trying to use this before it's ready for prime time, or is there something I'm missing as far as docs and using the tf2 listener?

Edit: Bump. I'm also facing this problem.


Originally posted by ssafarik on ROS Answers with karma: 306 on 2013-10-29

Post score: 10


Original comments

Comment by BennyRe on 2015-06-19:
Is there an update on this? Transforming points from one coordinate system to the other is, for me, the essential use-case of tf2. But it seems that this is supported only poorly and documented even more poorly.

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

You can use the transform or transform_full methods from the BufferInterface on any datatype which implements do_transform

tf2 is now recommended. It is still in the geometry_experimental repository but only for legacy reasons.


Originally posted by tfoote with karma: 58457 on 2015-06-19

This answer was ACCEPTED on the original site

Post score: 5


Original comments

Comment by Procópio on 2016-12-14:
hey @tfoote, I tried using the transform method to transform a stamped pose, and got this error: File "/opt/ros/indigo/lib/python2.7/dist-packages/tf2_ros/buffer_interface.py", line 43, in transform do_transform = self.registration.get(type(object_stamped))

Comment by Procópio on 2016-12-14:
File "/opt/ros/indigo/lib/python2.7/dist-packages/tf2_ros/buffer_interface.py", line 105, in get raise TypeException('Type %s if not loaded or supported'% str(key)) TypeException

Comment by dhood on 2017-03-07:
For anyone that comes across this, to transform PoseStamped messages you can try installing ros-kinetic-tf2-geometry-msgs and then importing tf2_geometry_msgs

Comment by Alkrick on 2021-03-08:
Is there an update on this? I am following this tutorial and can't figure out the tf2 equivalent of the listener.transformPoint() part, I tried including buffer_interface.h but the methods mentioned above were still not available

$\endgroup$
0
$\begingroup$

Rosanswers logo

This is very tricky. I had to do

 import tf2_geometry_msgs.tf2_geometry_msgs

in order for the do_transform interfaces for PoseStamped and other geometry_msgs messages to be registered. The registration is done while importing as shown in the source code for tf2_geometry_msgs.py.

The comments by @Procópio and @Alkrick can be resolved by this.

This does not appear (from an end-user's perspective) to be relevant for the transform function. Either documentation should say this or the way to use tf2_ros should be improved (why not import the above automatically when doing import tf2_ros?)


Originally posted by zkytony with karma: 178 on 2022-01-21

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

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