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

Confused about python versions

asked 2020-11-25 19:53:59 -0500

pitosalas gravatar image

updated 2020-11-25 20:49:08 -0500

I am incorporating a package (py_trees for behavior trees) in my ROS program. Unfortunately, py_trees does not support python2. I am using ROS melodic on Ubuntu 18.04 from what I can tell, ROS python source file often require python2.

My question is: How do I set ROS up to allow me to call a Pythion 3 only package?

Thanks!

edit retag flag offensive close merge delete

Comments

This doesn't seem to be a "ROS" question as much as a python2 and python3 compatibility question. You might find better resources under that premise.

stevemacenski gravatar image stevemacenski  ( 2020-11-25 20:32:28 -0500 )edit

@stevemacenski - I didn't explain it well the first time; can you take a look again?

pitosalas gravatar image pitosalas  ( 2020-11-25 22:33:46 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-11-26 03:11:54 -0500

gvdhoorn gravatar image

Officially, Melodic does not support Python 3. So the official answer would be: you can't.

There are ways to build just enough of Melodic with Python 3 to do this though, and an alternative could be using something like catkin_virtualenv, which does support Python 3.

However, I'm confused: py_trees_ros supports ROS Melodic (it has even been released there). Could you not use that?

edit flag offensive delete link more

Comments

I built my code outside of ROS with py_trees. Never looked closely at py_trees_ros but it looks like its a slightly different API. Anyway your answer is what I requirer - melodic doesn't support py3 directly. I will look at py_trees_ros, and I assume that will solve my problem. If you promote your comment to an answer I will check it off.

pitosalas gravatar image pitosalas  ( 2020-11-26 07:51:41 -0500 )edit

What about this: https://medium.com/@beta_b0t/how-to-s... instructions for writing nodes in py3 on melodic?

pitosalas gravatar image pitosalas  ( 2020-11-26 08:24:02 -0500 )edit

As I wrote, it's all possible. Just depends on how complicated you want to make things for yourself.

gvdhoorn gravatar image gvdhoorn  ( 2020-11-26 11:21:21 -0500 )edit

If you absolutely don't want to use py_trees_ros I would actually recommend to look a catkin_virtualenv instead of building Melodic with Python 3. catkin_virtualenv supports Python 3 "natively".

gvdhoorn gravatar image gvdhoorn  ( 2020-11-27 02:53:08 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-11-25 19:53:59 -0500

Seen: 75 times

Last updated: Nov 25 '20