Turtlebot2 Environment

Turtlebot2 is a classic in ROS robot platforms. In this case, you will find various simulations with it inside. In ROSDS the default launch one is with an empty worlds and a wall. But you have also available a world with a maze inside.

Real RosBot from Husarion

Robot Environment

openai_ros.robot_envs.turtlebot2_env module

class openai_ros.robot_envs.turtlebot2_env.TurtleBot2Env[source]

Bases: openai_ros.robot_gazebo_env.RobotGazeboEnv

Superclass for all CubeSingleDisk environments.


Initializes a new TurtleBot2Env environment. Turtlebot2 doesnt use controller_manager, therefore we wont reset the controllers in the standard fashion. For the moment we wont reset them.

To check any topic we need to have the simulations running, we need to do two things: 1) Unpause the simulation: without that th stream of data doesnt flow. This is for simulations that are pause for whatever the reason 2) If the simulation was running already for some reason, we need to reset the controlers. This has to do with the fact that some plugins with tf, dont understand the reset of the simulation and need to be reseted to work properly.

The Sensors: The sensors accesible are the ones considered usefull for AI learning.

Sensor Topic List: * /odom : Odometry readings of the Base of the Robot * /camera/depth/image_raw: 2d Depth image of the depth sensor. * /camera/depth/points: Pointcloud sensor readings * /camera/rgb/image_raw: RGB camera * /kobuki/laser/scan: Laser Readings

Actuators Topic List: /cmd_vel,


__module__ = 'openai_ros.robot_envs.turtlebot2_env'

Checks that all the sensors, publishers and other simulation systems are operational.


Checks that all the publishers are working :return:

_compute_reward(observations, done)[source]

Calculates the reward to give based on the observations given.


Inits variables needed to be initialised each time we reset at the start of an episode.


Checks if episode done based on observations given.


Applies the given action to the simulation.


Sets the Robot in its init pose

move_base(linear_speed, angular_speed, epsilon=0.05, update_rate=10)[source]

It will move the base based on the linear and angular speeds given. It will wait untill those twists are achived reading from the odometry topic. :param linear_speed: Speed in the X axis of the robot base frame :param angular_speed: Speed of the angular turning of the robot base frame :param epsilon: Acceptable difference between the speed asked and the odometry readings :param update_rate: Rate at which we check the odometry. :return:

wait_until_twist_achieved(cmd_vel_value, epsilon, update_rate)[source]

We wait for the cmd_vel twist given to be reached by the robot reading from the odometry. :param cmd_vel_value: Twist we want to wait to reach. :param epsilon: Error acceptable in odometry readings. :param update_rate: Rate at which we check the odometry. :return: