# Sawyer Environment¶

Sawyer is the new robot from Rethink Robotics. Its a simplified version of the Baxter Robot. Here is the official page for more details: SawyerPage

This simulation uses all the SDK systems that the real robot does , so anything you develop for the simulation should work seamlessly with the real robot.

## Robot Environment¶

### openai_ros.robot_envs.sawyer_env module¶

class openai_ros.robot_envs.sawyer_env.SawyerEnv[source]

Superclass for all SawyerEnv environments.

__init__()[source]

Initializes a new SawyerEnv environment.

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: * /robot/joint_limits: Odometry of the Base of Wamv

Actuators Topic List: * As actuator we will use a class to interface with the movements through commands.

Args:

__module__ = 'openai_ros.robot_envs.sawyer_env'
_check_all_sensors_ready()[source]
_check_all_systems_ready()[source]

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

_check_head_camera_image_raw_ready()[source]
_check_right_hand_camera_image_raw_ready()[source]
_compute_reward(observations, done)[source]

Calculates the reward to give based on the observations given.

_get_obs()[source]
_head_camera_image_raw_callback(data)[source]
_init_env_variables()[source]

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

_is_done(observations)[source]

Checks if episode done based on observations given.

_map_actions_to_movement(side='right', joint_delta=0.1)[source]
_right_hand_camera_image_raw_callback(data)[source]
_set_action(action)[source]

Applies the given action to the simulation.

_set_init_pose()[source]

Sets the Robot in its init pose

_setup_movement_system()[source]

Setup of the movement system. :return:

_setup_tf_listener()[source]

Set ups the TF listener for getting the transforms you ask for.

check_joint_limits_ready()[source]
execute_movement(action_id)[source]

It executed the command given through an id. This will move any joint of Sawyer, including the gripper if it has it. :param: action_id: These are the possible action_id values and the action asociated.

self.joints[0]+”_increase”, self.joints[0]+_decrease, self.joints[1]+”_increase”, self.joints[1]+”_decrease”, self.joints[2]+”_increase”, self.joints[2]+”_decrease”, self.joints[3]+”_increase”, self.joints[3]+”_decrease”, self.joints[4]+”_increase”, self.joints[4]+”_decrease”, self.joints[5]+”_increase”, self.joints[5]+”_decrease”, self.joints[6]+”_increase”, self.joints[6]+”_decrease”, gripper_close, gripper_open, gripper_calibrate

get_all_limb_joint_angles()[source]

Return dictionary dict({str:float}) with all the joints angles

get_all_limb_joint_efforts()[source]

Returns a dictionary dict({str:float}) with all the joints efforts

get_head_camera_image_raw()[source]
get_joint_limits()[source]
get_limb_joint_names_array()[source]

Returns the Joint Names array of the Limb.

get_right_hand_camera_image_raw()[source]
get_tf_start_to_end_frames(start_frame_name, end_frame_name)[source]

Given two frames, it returns the transform from the start_frame_name to the end_frame_name. It will only return something different to None if the TFs of the Two frames are in TF topic published and are connected through the TF tree. :param: start_frame_name: Start Frame of the TF transform

end_frame_name: End Frame of the TF transform
Returns: trans,rot of the transform between the start and end frames.
init_joint_limits()[source]

Get the Joint Limits, in the init fase where we need to unpause the simulation to get them :return: joint_limits: The Joint Limits Dictionary, with names, angles, vel and effort limits.

move_joints_to_angle_blocking(joint_positions_dict, timeout=15.0, threshold=0.008726646)[source]

It moves all the joints to the given position and doesnt exit until it reaches that position

set_g(action)[source]
set_j(joint_name, delta)[source]