# openai_ros package¶

## openai_ros.controllers_connection module¶

class openai_ros.controllers_connection.ControllersConnection(namespace, controllers_list)[source]
__init__(namespace, controllers_list)[source]
__module__ = 'openai_ros.controllers_connection'
reset_controllers()[source]

We turn on and off the given controllers :param controllers_reset: [“name_controler_1”, “name_controller2”,...,”name_controller_n”] :return:

switch_controllers(controllers_on, controllers_off, strictness=1)[source]

Give the controllers you want to switch on or off. :param controllers_on: [“name_controler_1”, “name_controller2”,...,”name_controller_n”] :param controllers_off: [“name_controler_1”, “name_controller2”,...,”name_controller_n”] :return:

update_controllers_list(new_controllers_list)[source]

## openai_ros.gazebo_connection module¶

class openai_ros.gazebo_connection.GazeboConnection(start_init_physics_parameters, reset_world_or_sim)[source]
__init__(start_init_physics_parameters, reset_world_or_sim)[source]
__module__ = 'openai_ros.gazebo_connection'
change_gravity(x, y, z)[source]
init_physics_parameters()[source]

We initialise the physics parameters of the simulation, like gravity, friction coeficients and so on.

init_values()[source]
pauseSim()[source]
resetSim()[source]

This was implemented because some simulations, when reseted the simulation the systems that work with TF break, and because sometime we wont be able to change them we need to reset world that ONLY resets the object position, not the entire simulation systems.

resetSimulation()[source]
resetWorld()[source]
unpauseSim()[source]
update_gravity_call()[source]

## openai_ros.robot_gazebo_env module¶

class openai_ros.robot_gazebo_env.RobotGazeboEnv(robot_name_space, controllers_list, reset_controls, start_init_physics_parameters=True, reset_world_or_sim='SIMULATION')[source]

Bases: gym.core.Env

__init__(robot_name_space, controllers_list, reset_controls, start_init_physics_parameters=True, reset_world_or_sim='SIMULATION')[source]
__module__ = 'openai_ros.robot_gazebo_env'
_check_all_systems_ready()[source]

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

_compute_reward(observations, done)[source]

Calculates the reward to give based on the observations given.

_env_setup(initial_qpos)[source]

Initial configuration of the environment. Can be used to configure initial state and extract information from the simulation.

_get_obs()[source]

Returns the observation.

_init_env_variables()[source]

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

_is_done(observations)[source]

Indicates whether or not the episode is done ( the robot has fallen for example).

_publish_reward_topic(reward, episode_number=1)[source]

This function publishes the given reward in the reward topic for easy access from ROS infrastructure. :param reward: :param episode_number: :return:

_reset_sim()[source]

Resets a simulation

_set_action(action)[source]

Applies the given action to the simulation.

_set_init_pose()[source]

Sets the Robot in its init pose

_update_episode()[source]

Publishes the cumulated reward of the episode and increases the episode number by one. :return:

close()[source]

Function executed when closing the environment. Use it for closing GUIS and other systems that need closing. :return:

reset()[source]
seed(seed=None)[source]
step(action)[source]

Function executed each time step. Here we get the action execute it in a time step and retrieve the observations generated by that action. :param action: :return: obs, reward, done, info