Ask Your Question
0

Using python modules from ROS2 packages

asked 2020-04-29 03:09:51 -0600

svintissen gravatar image

updated 2020-04-29 04:12:31 -0600

Hi, I am using ROS2 dashing and I want to work with the geometry2/tf2_ros package which is available at https://index.ros.org/p/tf2_ros/#dashing.

I am sure this is a very basic question, but I am having a hard time finding documentation on how to do stuff in ROS2.

  • How do I install the package so I can import the modules to my python scripts?

Thanks!

EDIT:

I think I have to rephrase the question. I allready have the tf2 package installed and I can run the static_transform_publisher from terminal, but I am having trouble importing the tf2_ros module to python when I am writing my own nodes - keep getting "no module named tf2_ros".

So what I am asking is how do I make the package available so that I can import the python modules when writing my own python nodes?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-04-29 03:58:11 -0600

gvdhoorn gravatar image

updated 2020-04-29 05:02:03 -0600

I guess you're having a hard time finding documentation about this as installing a package hasn't changed between ROS 1 and ROS 2. If a package is released, and you're using ROS on any supported Debian or Ubuntu flavour, installing it would be a matter of:

sudo apt install ros-$ROS_DISTRO-package-name

so in this case:

sudo apt install ros-dashing-tf2-ros

Note that this is how you would install any Debian/Ubuntu package, not just released ROS packages. Which is probably another reason why it's not overly documented.

I'm not saying it's a stupid or unnecessary question btw, just proferring possible rationales for why you cannot find any documentation about this subject.


Edit:

I am having trouble importing the tf2_ros module to python when I am writing my own nodes - keep getting "no module named tf2_ros". [..] So what I am asking is how do I make the package available so that I can import the python modules when writing my own python nodes?

If that is your actual question then it appears it's actually a duplicate of #q309889.

Summary: the Python side to tf2_ros was only released into Eloquent, not Dashing.


Edit 2: it seems you asked a similar question in #q350839. @tfoote remarks there the package tf2_ros was released into all ROS 2 versions, which is technically correct. I do believe that the Python side of tf2_ros was only included in the Eloquent version though (because of this comment by Chris):

This was merged into master, and will be part of the Eloquent release: https://index.ros.org//doc/ros2/Relea...

The changes were too invasive to backport into Dashing.

edit flag offensive delete link more

Comments

Thanks, I think I have to rephrase the question. I allready have the tf2 package installed and I can run the static_transform_publisher from terminal, but I am having trouble importing the tf2_ros module to python when I am writing my own nodes - keep getting "no module named tf2_ros".

So what I am asking is how do I make the package available so that I can import the python modules when writing my own python nodes?

svintissen gravatar image svintissen  ( 2020-04-29 04:09:24 -0600 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-04-29 03:09:51 -0600

Seen: 149 times

Last updated: Apr 29 '20