Openai_ros package parrot drone simulation error

Hi guys, I’m trying to follow the an example of openai_ros to play around Q learning on a Gazebo simulated parrot drone. However, I cannot initiate my robot. I have succesfully downloaded and built openai_ros and openai_example_projects in my ROS workspace. I’m using Ubuntu 20.04.4 + ROS-noetic + Gazebo-11.10.2

I run the next command:

roslaunch my_parrotdrone_openai_example start_training_v2.launch

Gazebo is executed and the robot spawns in the map but I get the following error and the qlearning process dies.

[WARN] [1658217941.125143]: Env: ParrotDroneGoto-v0 will be imported
    /home/openai/.local/lib/python3.8/site-packages/gym/envs/registration.py:396: UserWarning: WARN: The `registry.all` method is deprecated. Please use `registry.values` instead.
      logger.warn(
    [WARN] [1658217941.192974]: Register of Task Env went OK, lets make the env...ParrotDroneGoto-v0
    [WARN] [1658217941.207869]: path_launch_file_name==/home/openai/simulation_ws/src/parrot_ardrone/drone_construct/launch/start_world.launch
    [WARN] [1658217941.208346]: Launching command=source /home/openai/simulation_ws/devel/setup.bash;roslaunch  drone_construct start_world.launch
    /bin/sh: 1: source: not found
    /usr/lib/python3/dist-packages/apport/report.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
      import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat
    Traceback (most recent call last):

I tried the same example and code using the Theconstructsim online simulator and the simulations works fine so I dont know if the problem might be the openai_ros package installation or some file that have to be changed in order to work.

Hi @josuL11, welcome to the community!

I assume that the compilation works, so what I can tell you might be happening is missing packages. It looks like there are more than one launch file inside of the main one ( /home/openai/simulation_ws/devel/setup.bash;roslaunch drone_construct start_world.launch), and one of them is trying to launch which is giving problems. Make sure you have everything for strart_training_v2.launch in the correct location

Thank you @roalgoal :slight_smile:
I was missing the common_msgs package. After installing it, I still got this error:

process[parrotdrone_goto_qlearn-2]: started with pid [18411]
[WARN] [1658310211.219937]: Env: ParrotDroneGoto-v0 will be imported
/home/openai/.local/lib/python3.8/site-packages/gym/envs/registration.py:396: UserWarning: WARN: The `registry.all` method is deprecated. Please use `registry.values` instead.
  logger.warn(
[WARN] [1658310211.260510]: Register of Task Env went OK, lets make the env...ParrotDroneGoto-v0
[WARN] [1658310211.275458]: path_launch_file_name==/home/openai/simulation_ws/src/parrot_ardrone/drone_construct/launch/start_world.launch
[WARN] [1658310211.276025]: Launching command=source /home/openai/simulation_ws/devel/setup.bash;roslaunch  drone_construct start_world.launch
/bin/sh: 1: source: not found
/usr/lib/python3/dist-packages/apport/report.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat
Traceback (most recent call last):
  File "/home/openai/catkin_ws/src/openai_examples_projects/my_parrotdrone_openai_example/scripts/start_qlearning_v2.py", line 23, in <module>
    env = StartOpenAI_ROS_Environment(
  File "/home/openai/catkin_ws/src/openai_ros/openai_ros/src/openai_ros/openai_ros_common.py", line 31, in StartOpenAI_ROS_Environment
    env = gym.make(task_and_robot_environment_name)
  File "/home/openai/.local/lib/python3.8/site-packages/gym/envs/registration.py", line 592, in make
    env = env_creator(**_kwargs)
  File "/home/openai/catkin_ws/src/openai_ros/openai_ros/src/openai_ros/task_envs/parrotdrone/parrotdrone_goto.py", line 105, in __init__
    self.observation_space = spaces.Box(low, high)
  File "/home/openai/.local/lib/python3.8/site-packages/gym/spaces/box.py", line 95, in __init__
    self.bounded_above = np.inf > _high
TypeError: '>' not supported between instances of 'float' and 'numpy.ndarray'
... logging to /home/openai/.ros/log/69bab592-0810-11ed-a693-876fc5030097/roslaunch-gici-TEKNOPRO-18436.log

The process dies after loading gazebo:

[ INFO] [1658310211.921334337]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1658310211.921991159]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 158.227.160.158
[ INFO] [1658310211.970919279]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1658310211.971468021]: waitForService: Service [/gazebo_gui/set_physics_properties] has not been advertised, waiting...
[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 158.227.160.158
[Wrn] [ModelDatabase.cc:340] Getting models from[http://models.gazebosim.org/]. This may take a few seconds.
[parrotdrone_goto_qlearn-2] process has died [pid 18411, exit code 1, cmd /home/openai/catkin_ws/src/openai_examples_projects/my_parrotdrone_openai_example/scripts/start_qlearning_v2.py __name:=parrotdrone_goto_qlearn __log:=/home/openai/.ros/log/69bab592-0810-11ed-a693-876fc5030097/parrotdrone_goto_qlearn-2.log].
log file: /home/openai/.ros/log/69bab592-0810-11ed-a693-876fc5030097/parrotdrone_goto_qlearn-2*.log

Check that command that gets executed. You must have that path correctly, is the computer’s username openai?

Hello,
I discovered that the problem was the gym version, my Rosject used another version so I executed the next comand:

$python 
>>> import gym
>>> print(gym.__version__) #This returned the gym version I was using
>>> 0.24.1

The rosject was using the 0.15.3 version and I was using the 0.24 in my pc so I changed it:
pip install gym==0.15.3 # I installed the version that I needed

Thank you for your help : D

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.