OpenAI with Turtlebot2 Simulation does not run

Hello,

i tried to follow your youtube video

[ROS Projects] - Use OpenAI_ROS with Turtlebot2 Step by Step - Part 1

and rebuild it myself.

i did it step by step using ROSDS.
when i tried to start the simulation with:

roslaunch gym_construct main.launch

the first error was something like: cannot find “turtlebot_gazebo”.
So i cloned this git in my simulation_ws :
https://bitbucket.org/theconstructcore/turtlebot/src/kinetic/

catkin_make was succesfull.
now the next error appears:

[rospack] Error: package ‘hokuyo’ not found
[librospack]: error while executing command
[FATAL] [1638792621.151736225, 0.575000000]: Package[hokuyo] does not have a path

i am not sure how to solve this problem.

Here is the link to my ROSject:

Thanks for the help.

Hello @hmlk ,

You need this package also: Bitbucket

Thanks for the helpful answer!

But now i get the next problem.
The sensor package works. But now my the gazebo window keeps black background.

i try “roslaunch gym_construct main.launch” and one error pops up, but i think its not the problem.

user:~$ roslaunch gym_construct main.launch
... logging to /home/user/.ros/log/add7b1e6-a503-11ec-87dd-0242ac150007/roslaunch-3_xterm-1950.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

xacro: Traditional processing is deprecated. Switch to --inorder processing!
To check for compatibility of your document, use option --check-order.
For more infos, see http://wiki.ros.org/xacro#Processing_Order
deprecated: xacro tags should be prepended with 'xacro' xml namespace.
Use the following script to fix incorrect usage:
        find . -iname "*.xacro" | xargs sed -i 's#<\([/]\?\)\(if\|unless\|include\|arg\|property\|macro\|insert_block\)#<\1xacro:\2#g'
when processing file: /home/user/simulation_ws/src/turtlebot/turtlebot_description/robots/kobuki_hexagons_asus_xtion_pro.urdf.xacro

xacro.py is deprecated; please use xacro instead
started roslaunch server http://3_xterm:42403/

SUMMARY
========

PARAMETERS
 * /cmd_vel_mux/yaml_cfg_file: /home/user/simula...
 * /robot_description: <?xml version="1....
 * /robot_state_publisher/publish_frequency: 30.0
 * /rosdistro: kinetic
 * /rosversion: 1.12.14
 * /use_sim_time: True

NODES
  /
    cmd_vel_mux (nodelet/nodelet)
    gazebo (gazebo_ros/gzserver)
    mobile_base_nodelet_manager (nodelet/nodelet)
    robot_state_publisher (robot_state_publisher/robot_state_publisher)
    spawn_turtlebot_model (gazebo_ros/spawn_model)

auto-starting new master
process[master]: started with pid [1986]
ROS_MASTER_URI=http://3_xterm:11311

setting /run_id to add7b1e6-a503-11ec-87dd-0242ac150007
process[rosout-1]: started with pid [1999]
started core service [/rosout]
process[gazebo-2]: started with pid [2002]
process[spawn_turtlebot_model-3]: started with pid [2024]
process[mobile_base_nodelet_manager-4]: started with pid [2031]
process[cmd_vel_mux-5]: started with pid [2069]
Gazebo multi-robot simulator, version 7.16.1
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

process[robot_state_publisher-6]: started with pid [2100]
[ INFO] [1647419582.910007966]: Finished loading Gazebo ROS API Plugin.
[Msg] Waiting for master.
[ INFO] [1647419582.913831570]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 172.21.0.7
[ INFO] [1647419583.903972283, 0.027000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1647419584.977235699, 0.055000000]: Camera Plugin: Using the 'robotNamespace' param: '/'
[ INFO] [1647419584.986419718, 0.055000000]: Camera Plugin (ns = /)  <tf_prefix_>, set to ""
[Wrn] [msgs.cc:1808] Conversion of sensor type[depth] not suppported.
[Wrn] [msgs.cc:1808] Conversion of sensor type[imu] not suppported.
[Wrn] [msgs.cc:1808] Conversion of sensor type[gpu_ray] not suppported.
[ INFO] [1647419585.167033072, 0.055000000]: Physics dynamic reconfigure ready.
[ INFO] [1647419585.182777255, 0.055000000]: Laser Plugin: Using the 'robotNamespace' param: '/'
[ INFO] [1647419585.182895790, 0.055000000]: Starting GazeboRosLaser Plugin (ns = /)
[ INFO] [1647419585.187487042, 0.055000000]: GPU Laser Plugin (ns = /) <tf_prefix_>, set to ""
[ INFO] [1647419585.191515607, 0.055000000]: LoadThread function completed
[ INFO] [1647419585.224911624, 0.055000000]: Starting plugin DiffDrive(ns = //)
[ WARN] [1647419585.225247285, 0.055000000]: DiffDrive(ns = //): missing <rosDebugLevel> default is na
[ INFO] [1647419585.227284038, 0.055000000]: DiffDrive(ns = //): <tf_prefix> =
[ WARN] [1647419585.227414446, 0.055000000]: DiffDrive(ns = //): missing <publishWheelTF> default is false
[ WARN] [1647419585.227446805, 0.055000000]: DiffDrive(ns = //): missing <publishOdomTF> default is true
[ WARN] [1647419585.227499832, 0.055000000]: DiffDrive(ns = //): missing <legacyMode> default is true
[ERROR] [1647419585.227545363, 0.055000000]: GazeboRosDiffDrive Plugin missing <legacyMode>, defaults to true
This setting assumes you have a old package, where the right and left wheel are changed to fix a former code issue
To get rid of this error just set <legacyMode> to false if you just created a new package.
To fix an old package you have to exchange left wheel by the right wheel.
If you do not want to fix this issue in an old package or your z axis points down instead of the ROS standard defined in REP 103
just set <legacyMode> to true.

[ WARN] [1647419585.227646107, 0.055000000]: DiffDrive(ns = //): missing <wheelAcceleration> default is 0
[ WARN] [1647419585.227706666, 0.055000000]: DiffDrive(ns = //): missing <wheelTorque> default is 5
[ WARN] [1647419585.227968420, 0.055000000]: DiffDrive(ns = //): missing <odometrySource> default is 1
[ WARN] [1647419585.228821248, 0.055000000]: GazeboRosDiffDrive Plugin (ns = ) missing <publishTf>, defaults to 1
[ INFO] [1647419585.244480230, 0.055000000]: DiffDrive(ns = //): Advertise joint_states
[ INFO] [1647419585.250378440, 0.055000000]: DiffDrive(ns = //): Try to subscribe to cmd_vel
[ INFO] [1647419585.313009056, 0.055000000]: DiffDrive(ns = //): Subscribe to cmd_vel
[ INFO] [1647419585.326597087, 0.055000000]: DiffDrive(ns = //): Advertise odom on odom
[spawn_turtlebot_model-3] process has finished cleanly
log file: /home/user/.ros/log/add7b1e6-a503-11ec-87dd-0242ac150007/spawn_turtlebot_model-3*.log
[Wrn] [msgs.cc:1808] Conversion of sensor type[depth] not suppported.
[Wrn] [msgs.cc:1808] Conversion of sensor type[imu] not suppported.
[Wrn] [msgs.cc:1808] Conversion of sensor type[gpu_ray] not suppported.
[Wrn] [Publisher.cc:141] Queue limit reached for topic /gazebo/default/pose/local/info, deleting message. This warning is printed only once

i can run the code for the RF Learing (“roslaunch turtle2_openai_ros_example start_training_maze.launch”) and i get no error messages.

The algorithm is working and is changing states, witch means i get different observations. So something is working but i still get a black gazebo screen.

Any ideas, how i can fixt that?

Hello @hmlk ,

Can you share a link to your rosject and the command to reproduce this error?

I started from scratch. The error is gone, the result (black gazebo screen) is the same.

the command i use is:
“roslaunch gym_construct main.launch”

if i start a new empty word (“roslaunch gazeo_ros empty_world.lauch”) in addition, everything works like intended. I get an error that an instance of gazebo is allready running, but i works.
So i guess something with the launch file is not working for me…

Hello @hmlk ,

Your problem with the black screen is that gzclient (what allows you to visualize the simulation) is not being started. You can fix this in your main.launch file. In line 6, you need to change the gui argument value to true:

<arg name="gui" default="true"/>

This argument tells whether to launch gzclient (true) or not (false).