0
$\begingroup$

Rosanswers logo

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?


Originally posted by ipa-hsd on ROS Answers with karma: 150 on 2020-02-13

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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/pull/207


Originally posted by lgeorge with karma: 123 on 2020-05-19

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

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