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

How to use Openai with ROS (Python3)

asked 2020-07-09 14:46:31 -0600

Martina Ruocco gravatar image

Hi guys, I really hope someone will answer because I pretty stuck. I've been following the Construct tutorial on how to use ROS with Python3 but I still have trouble launching the training.

I am working on my machine (ROS kinetic + Ubuntu 16.04) and so far I have 3 workspaces: catkin_ws, python3_ws and simulation_ws.

All the workspaces have been compiled with:

catkin_make -DPYTHON_EXECUTABLE:FILEPATH=/home/user/catkin_ws/py3/bin/python

This is the structure (I put only their src/ folders):

/home/p16325mr/catkin_ws/src/ <-- here's the stuff that import the algorythms

  • ├── my_sawyer_openai_example
  • ├── openai_ros
  • └── spawn_robot_tools

/home/p16325mr/python3_ws/src <-- here's the stuff written in python3

  • ├── geometry
  • ├── geometry2
  • └── stable-baselines

/home/p16325mr/simulation_ws/src

  • ├── intera_common
  • ├── intera_sdk
  • ├── sawyer_robot
  • └── sawyer_simulator

I launch the simulation in one terminal (which works) and the training in the other terminal (after activating py3venv) The training (roslaunch my_sawyer_openai_example train_a2c.launch) raises error:

Traceback (most recent call last): File "/opt/ros/kinetic/lib/gazebo_ros/spawn_model", line 32, in <module> import tf.transformations as tft [...]
ImportError: dynamic module does not define init function (init_tf2)

It's obviously related to the python3 virtual environment... Is there a workaround for the problem?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-07-10 05:14:41 -0600

MaxM gravatar image

You could try to migrate to ROS Noetic, because ROS Noetic targets Python 3. To switch to ROS Noetic, you would first have to upgrade to Ubuntu 20.04. If you switch to ROS Noetic, you can check ROS Wiki for the migration guide to ROS Noetic. The link for that is this: http://wiki.ros.org/noetic/Migration

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-07-09 14:46:31 -0600

Seen: 578 times

Last updated: Jul 10 '20