Ask Your Question

transform pose in tf2

asked 2020-02-13 09:20:08 -0600

ipa-hsd gravatar image

updated 2020-02-13 09:22:50 -0600

Ubuntu 18.04
ROS2 Eloquent (installed by binaries)

I am trying to transform a PoseStamped in the target frame in python.

Below would how my code look like:

import tf2_geometry_msgs
from geometry_msgs.msg import PoseStamped
target_pose_s = self.tf_buffer.transform(self.pose_s, target_frame)

In this case, I get module not found error:

ModuleNotFoundError: No module named 'tf2_geometry_msgs'

I think it is looking for the file, which is not installed for ROS2 on my system. But I can see this for melodic.


(it exists in the eloquent branch though)

In this issue, which was addressed in this PR the was said to be "unused". Also here is marked that Python support doesn't exist yet, though catkin_python_setup() shouldn't be needed for ROS2 anymore?

If I comment out tf2_geometry_msgs, I get the error

tf2_ros.buffer_interface.TypeException: Type <class 'geometry_msgs.msg._pose_stamped.PoseStamped'> if not loaded or supported

What am I missing here? Or is it that transform(PoseStamped, "target_frame") function not supported yet in Python?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-05-19 05:07:40 -0600

lgeorge gravatar image

updated 2020-05-19 05:08:02 -0600

In my understanding the tf2_geometry_msgs are not build for python (the binding) in ros eloquent, you need this pullrequest, and thus move to a more recent ros2 version (i.e master for now):

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-02-13 09:20:08 -0600

Seen: 990 times

Last updated: May 19 '20