OpenAI ROS Core¶
This is the heart of OpenAI ROS. Here you can finc the classes that tie ROS, Gazebo and OpenAi together.
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.
-
_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:
-
_update_episode
()[source]¶ Publishes the cumulated reward of the episode and increases the episode number by one. :return:
-
openai_ros.gazebo_connection module¶
-
class
openai_ros.gazebo_connection.
GazeboConnection
(start_init_physics_parameters, reset_world_or_sim)[source]¶ -
-
__module__
= 'openai_ros.gazebo_connection'¶
-
init_physics_parameters
()[source]¶ We initialise the physics parameters of the simulation, like gravity, friction coeficients and so on.
-
openai_ros.controllers_connection module¶
-
class
openai_ros.controllers_connection.
ControllersConnection
(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:
-