Rosanswers logo

hi! I have tried to run the turtlebot2 q learning example from OpenAI and until now I managed to run the launchfile where gazebo starts:

roslaunch gym_construct main.launch

After typing:

roslaunch turtle2_openai_ros_example start_training.launch

the launchfile starts but then it shows the following error:

henry@henry:~/catkin_ws$ roslaunch turtle2_openai_ros_example start_training.launch 
... logging to /home/henry/.ros/log/504dc8b6-e53e-11ea-b60d-b8763ff5fae7/roslaunch-henry-10939.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://henry:39203/


 * /rosdistro: melodic
 * /rosversion: 1.14.7
 * /turtlebot2/alpha: 0.1
 * /turtlebot2/angular_speed: 0.3
 * /turtlebot2/desired_pose/x: 5.0
 * /turtlebot2/desired_pose/y: 0.0
 * /turtlebot2/desired_pose/z: 0.0
 * /turtlebot2/end_episode_points: 200
 * /turtlebot2/epsilon: 0.9
 * /turtlebot2/epsilon_discount: 0.999
 * /turtlebot2/forwards_reward: 5
 * /turtlebot2/gamma: 0.7
 * /turtlebot2/init_linear_forward_speed: 0.0
 * /turtlebot2/init_linear_turn_speed: 0.0
 * /turtlebot2/linear_forward_speed: 0.5
 * /turtlebot2/linear_turn_speed: 0.05
 * /turtlebot2/max_laser_value: 6
 * /turtlebot2/min_laser_value: 0
 * /turtlebot2/min_range: 0.5
 * /turtlebot2/n_actions: 4
 * /turtlebot2/n_observations: 6
 * /turtlebot2/nepisodes: 500
 * /turtlebot2/new_ranges: 5
 * /turtlebot2/nsteps: 10000
 * /turtlebot2/number_splits: 10
 * /turtlebot2/pos_step: 0.016
 * /turtlebot2/running_step: 0.06
 * /turtlebot2/speed_step: 1.0
 * /turtlebot2/turn_reward: 1
 * /turtlebot2/wait_time: 0.1

    turtlebot2_maze (turtle2_openai_ros_example/start_qlearning.py)


process[turtlebot2_maze-1]: started with pid [10959]
[ERROR] [1598186669.537051, 27.380000]: NOT Initialising Simulation Physics Parameters
[WARN] [1598186669.544562, 27.387000]: Start Init ControllersConnection
[WARN] [1598186669.546238, 27.387000]: END Init ControllersConnection
/home/henry/.local/lib/python2.7/site-packages/gym/logger.py:30: UserWarning: WARN: Box bound precision lowered by casting to float32
  warnings.warn(colorize('%s: %s'%('WARN', msg % args), 'yellow'))
Traceback (most recent call last):
  File "/home/henry/catkin_ws/src/openai_examples_projects/turtle2_openai_ros_example/scripts/start_qlearning.py", line 25, in <module>
    pkg_path = rospack.get_path('my_turtlebot2_maze')
  File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 207, in get_path
    raise ResourceNotFound(name, ros_paths=self._ros_paths)
rospkg.common.ResourceNotFound: my_turtlebot2_maze
ROS path [0]=/opt/ros/melodic/share/ros
ROS path [1]=/home/henry/catkin_ws/src
ROS path [2]=/opt/ros/melodic/share
[turtlebot2_maze-1] process has died [pid 10959, exit code 1, cmd /home/henry/catkin_ws/src/openai_examples_projects/turtle2_openai_ros_example/scripts/start_qlearning.py __name:=turtlebot2_maze __log:=/home/henry/.ros/log/504dc8b6-e53e-11ea-b60d-b8763ff5fae7/turtlebot2_maze-1.log].
log file: /home/henry/.ros/log/504dc8b6-e53e-11ea-b60d-b8763ff5fae7/turtlebot2_maze-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete

I did not change anything in the start_qlearning.py file but it seems that it wants my_turtlebot2_maze as a package but there is only a my_turtblebot2_maze.py file. Can somebody help me please Thank you

Originally posted by autonomousfan on ROS Answers with karma: 11 on 2020-08-23

Post score: 0

Original comments

Comment by prav2909 on 2020-11-28:
Hi, did you solve this? I am having the same problem. Any help would be appreciated. Thanks. [Update: Fixed it, see the answer by me]


1 Answer 1


Rosanswers logo

Hi, I fixed it and got it running, you need to change line 30: "​pkg_path = rospack.get_path('turtle2_openai_ros_example')" of start_training.py to "pkg_path = rospack.get_path('my_turtlebot2_training')". Revert if this doesn't work.

Originally posted by prav2909 with karma: 26 on 2020-11-29

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by wirobot on 2022-04-24:
Hi there, I'm having the same issue but don't know which file you are exactly referring to. Do you mean start_qlearning.py? And if so:

Do you mean line 25 of start_qlearning.py? Line 30 is blank. If you do mean liine 25 which is:

" pkg_path = rospack.get_path('my_turtlebot2_maze') " What did you change it to?


Comment by wirobot on 2022-04-24:
For anyone else running into this issue, I fixed it by changing line 25 of start_qlearning.py to:

pkg_path = rospack.get_path('turtle2_openai_ros_example')

That is just the name of the "ros package" in openai_examples_projects.

I also had to copy the files from openai_ros robot_envs and task_envs to the scripts folder of turtle2_openai_ros_example.

I did that so that start_qlearning had the right files within the same folder to import from.

I also changed the import statement in start_qlearning.py to:

    from turtlebot2 import turtlebot2_maze

And I changed the import statement in my_turtlebot2_maze.py to

    import turtlebot2_env

You may need to change this to fit your own file structure.

Finally, make sure to change timestep_limit in the register function at the beginning of my_turtlebot2_maze.py to:


This is basically a change of params in gym that was made that they haven't updated in the

Comment by wirobot on 2022-04-24:
I will start a new thread to address this new error I'm running into at action 3 of running start_training.launch: UnboundLocalError: local variable 'linear_speed' referenced before assignment


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.