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

transform pose in tf2

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

ipa-hsd gravatar image

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

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 tf2_geometry_msgs.py file, which is not installed for ROS2 on my system. But I can see this for melodic.

/opt/ros/melodic/lib/python2.7/dist-packages/tf2_geometry_msgs/tf2_geometry_msgs.py

(it exists in the eloquent branch though)

In this issue, which was addressed in this PR the setup.py 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
0

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

lgeorge gravatar image

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

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): https://github.com/ros2/geometry2/pul...

edit flag offensive delete link more

Question Tools

3 followers

Stats

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

Seen: 2,380 times

Last updated: May 19 '20