AcutronicRobotics / gym-gazebo2

gym-gazebo2 is a toolkit for developing and comparing reinforcement learning algorithms using ROS 2 and Gazebo
https://acutronicrobotics.com
Apache License 2.0
424 stars 106 forks source link

Error - gym_gazebo2 Usage #26

Closed camontblanc closed 5 years ago

camontblanc commented 5 years ago

Environment/Algorithm I was trying the "python3 gg_random.py -g" example. Actually, whenever I try to build any MARA environment I keep having the same error.

Describe the bug ModuleNotFoundError: No module named 'rclpy._rclpy'.

Screenshots Error

Additional context I installed ROS2 Crystal and I have tried almost everything: uninstalling ROS2 and installing it again, same for gym_gazebo2.

rkojcev commented 5 years ago

Hi @camontblanc You need to source the environments, please use the following script to do that.

camontblanc commented 5 years ago

Hi @rkojcev ! First, thank you for your answer! Do I have to do that even though I am not using any of the MARA examples? Basically, what I am doing is running python in the shell, I import gym and gym_gazebo2 (clearly, I have already sourced ROS2 Crystal) but when I do: gym.make('MARA-v0') I have the error I told you before.

Thank you for your time!

rkojcev commented 5 years ago

@camontblanc

calling gym.make('MARA-v0') will want to call the MARA robot and all necessary packages that come with this repo

All the necessary steps are explained in the install from this repo.

camontblanc commented 5 years ago

@rkojcev

Hi! I followed (again) the step in this repo but I keep having the same error.

I also included in the ~/.bashrc file this script but it doesn't work.

YueErro commented 5 years ago

Hi @camontblanc,

Hi! I followed (again) the step in this repo but I keep having the same error.

Make sure you use crystal release in both repos (gym-gazebo2 and MARA), master branch is dashing. I just noticed wget are wrong in crystal branch, i would try with this ones instead:

wget https://raw.githubusercontent.com/AcutronicRobotics/MARA/crystal/mara-ros2.repos
wget https://raw.githubusercontent.com/AcutronicRobotics/gym-gazebo2/crystal/provision/additional-repos.repos
camontblanc commented 5 years ago

Hi @YueErro ,

I tried these wget:

wget https://raw.githubusercontent.com/AcutronicRobotics/MARA/crystal/mara-ros2.repos wget https://raw.githubusercontent.com/AcutronicRobotics/gym-gazebo2/crystal/provision/additional-repos.repos

but when compiling the workspace I get the following: Error

when it is supposed to be: 35 packages finished [12min 26s] 4 packages had stderr output: cv_bridge orocos_kdl python_orocos_kdl robotiq_gripper_gazebo_plugins

Eventually, when I run an example: ExampleError

camontblanc commented 5 years ago

@rkojcev @YueErro I managed to fix the above error. However I did notice these things:

  1. I echoed the PYTHONPATH and this is what I got: /home/carlos/ros2_mara_ws/install/lib/python3.6/site-packages:/home/carlos/ros2_mara_ws/install/lib/python3.7/site-packages:/opt/ros/crystal/lib/python3.6/site-packages:/home/carlos/ros2_mara_ws/install/lib/python3/dist-packages.
  2. However, I'm noticing that in ~/gym-gazebo2/provision/mara_setup.sh they are doing this: export PYTHONPATH=$PYTHONPATH:~/ros2_mara_ws/install/lib/python3/dist-packages
  3. I looked into the folder ~ /ros2_mara_ws/install/lib/, but there is no /python3/dist-packages.

Might this be something?

nzlz commented 5 years ago

Hi @camontblanc ,

When you execute wget https://raw.githubusercontent.com/AcutronicRobotics/MARA/crystal/mara-ros2.repos you are getting MARA's master branch, not crystal (check the content of the file). For now, go to _ros2_maraws/src/MARA and checkout to crystal release (its not a branch, yet). Then, recompile.

We will fix and test this today and let you know when the update is completed.

rkojcev commented 5 years ago

@camontblanc we are doing major refurbish and upgrade to all of our public repos these days in order to comply with different ros2 releases. Once we are done we will let you know and hopefully we will resolve all these inconsistencies trough out our repos.

nzlz commented 5 years ago

Created crystal branches for every gym-gazebo2 related repository. Go to the crystal branch of ros2learn or gym-gazebo2, depending what you want to install, and follow the distribution specific instructions available in the README.

rkojcev commented 5 years ago

@camontblanc can you try now and see if everything is ok with the crystal branch of the repositories?

camontblanc commented 5 years ago

@nzlz @rkojcev First of all, thank you very much for your help. Right now, I'm following these instructions: crystal branch. I'll let you know as soon as I'm finished.

camontblanc commented 5 years ago

@rkojcev @nzlz This is what I get.

  1. After compiling the ~/ros2_mara_ws workspace and doing the provisioning step, when I run the /.bashrc file: not found: "/home/carlos/ros2_mara_ws/install/share/orocos_kdl/local_setup.sh" not found: "/home/carlos/ros2_mara_ws/install/share/orocos_kdl/local_setup.bash"

  2. I tried to make gym.make('MARA-v0') but I still get the error ModuleNotFoundError: No module named 'rclpy._rclpy'.

nzlz commented 5 years ago

Regarding n1, you probably forgot to execute the line after the workspace is compiled, double check instructions please. That will get remove these informative errors.

Regarding n2, can you reinstall ros-crystal-desktop? That will give you ros-crystal-rclpy, which you will be able to use when sourcing /opt/ros/crystal/setup.bash via provisioning script.

(sorry for the lack the format, talking from the phone)

camontblanc commented 5 years ago

@nzlz

  1. You're right, I forgot touch ~/ros2_mara_ws/install/share/orocos_kdl/local_setup.sh ~/ros2_mara_ws/install/share/orocos_kdl/local_setup.bash.
  2. I reinstalled ros-crystal-desktop but it still doesn't work. I'm trying to run: cd ~/gym-gazebo2/examples/MARA -> python3 gg_random.py -g but I get Error
camontblanc commented 5 years ago

@nzlz @rkojcev

Hi! I deleted the ~/ros2_mara_ws and ~/gym_gazebo2 folders from my computer did everything all over again. The workspace compiled successfully and I did the provisioning step. However, the same error still appears (ModuleNotFoundError: No module named 'rclpy._rclpy'). As suggested by @nzlz, I reinstalled ros-crystal-desktop via Debian Packages. I really don't know what else to do given that I've repeated the steps in the INSTALL.md in Crystal Branch many times.

Thanks.

nzlz commented 5 years ago

This is a strange issue we have never seen before and not gym-gazebo2 related, so we cannot help much. You could:

  1. Open a issue in ROS Answers.
  2. Install crystal from sources and try it that way. Take this into account.
  3. Remove anaconda, could be causing a mess with Python.
camontblanc commented 5 years ago

@nzlz You were absolutely right! The problem was with anaconda. I removed it and installed everything all over again and it worked neatly.

Thank you everyone for your kind help!