Robotics StackExchange | Archived questions

Openai_ros openai_examples_projects q-learning example issue

Hello,

On a fresh install, I followed this question and performed the following with an extra step:

download turtlebot2maze pkgs

cd ~/catkin_ws/src
git clone https://bitbucket.org/theconstructcore/turtlebot.git
cd ~/catkin_ws/src/turtle
git fetch && git checkout kinetic
cd ~/catkin_ws
catkin_make
source devel/setup.bash

download openai_ros pkgs

cd ~/catkin_ws/src
git clone https://bitbucket.org/theconstructcore/openai_ros.git
cd ~/catkin_ws/src/openai_ros
git fetch && git checkout kinetic-devel
cd ~/catkin_ws
catkin_make
source devel/setup.bash

download openaiexamplesprojects pkgs

cd ~/catkin_ws/src
git clone https://bitbucket.org/theconstructcore/openai_examples_projects.git
cd ~/catkin_ws/src/openai_examples_projects
git fetch && git checkout tutorials
cd ~/catkin_ws
catkin_make
source devel/setup.bash

download openaigym_construct pkgs

cd ~/catkin_ws/src
git clone https://bitbucket.org/theconstructcore/open_ai_gym_construct.git
cd ~/catkin_ws/src/open_ai_gym_construct
git fetch && git checkout master
cd ~/catkin_ws
catkin_make
source devel/setup.bash

downloaded turtlebot_create pkgs

cd ~/catkin_ws/src
git clone https://github.com/turtlebot/turtlebot_create/tree/master
cd ~/catkin_ws/src/turtlebot_create
git fetch && git checkout master
cd ~/catkin_ws
catkin_make
source devel/setup.bash

After this, I was able to use the following command to launch gazebo with turtlebot and maze

roslaunch gym_construct main.launch

However, when I launch the following to start the training process

roslaunch turtle2_openai_ros_example start_training.launch 

I recevie the following error msg:

Traceback (most recent call last):
  File "/home/usar/test_ws/src/openai_examples_projects/turtle2_openai_ros_example/scripts/start_qlearning.py", line 12, in <module>
    from openai_ros.task_envs.turtlebot2 import turtlebot2_maze
  File "/home/usar/test_ws/src/openai_ros/openai_ros/src/openai_ros/task_envs/turtlebot2/turtlebot2_maze.py", line 17, in <module>
    timestep_limit=timestep_limit_per_episode,
  File "/home/usar/.local/lib/python2.7/site-packages/gym/envs/registration.py", line 153, in register
    return registry.register(id, **kwargs)
  File "/home/usar/.local/lib/python2.7/site-packages/gym/envs/registration.py", line 147, in register
    self.env_specs[id] = EnvSpec(id, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'timestep_limit'
[turtlebot2_maze-1] process has died [pid 11583, exit code 1, cmd /home/usar/test_ws/src/openai_examples_projects/turtle2_openai_ros_example/scripts/start_qlearning.py __name:=turtlebot2_maze __log:=/home/usar/.ros/log/c0dd1748-8d43-11e9-9dfb-64006a86be79/turtlebot2_maze-1.log].
log file: /home/usar/.ros/log/c0dd1748-8d43-11e9-9dfb-64006a86be79/turtlebot2_maze-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done

Please help?

Asked by aarontan on 2019-06-12 14:09:25 UTC

Comments

I believe this error is due to the fact that in the latest gym the timestep_limit parameter has been renamed to max_episode_steps.

I think you will have to rename the the 'timestep_limit' to 'max_episode_steps' in your start_qlearning.py file.

Asked by fizzy_m on 2019-06-14 18:34:21 UTC

Answers

rename the "timestep_limit' in catkin_ws/src/openai_ros/openai_ros/src/openai_ros/task_envs/turtlebot2/turtlebot2_maze.py to 'max_episode_steps'

Asked by Hunterx on 2019-12-31 06:05:38 UTC

Comments

That works for me!

Asked by fandrade on 2022-07-12 10:33:00 UTC