ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The code that registers transforms is in tf2_geometry_msgs. The following code will allow you to call the BufferInterface.transform function.

import tf2_ros
from tf2_geometry_msgs import PointStamped
from geometry_msgs.msg import Point

...

# Let src_pt be the point you want to transform.
tf_buf = tf2_ros.Buffer()
tf_listener = tf2_ros.TransformListener(tf_buf)
target_pt = tf_buf.transform(src_pt, "target_frame")

Note that you should not include a leading slash in the name of the target frame.