def __init__(self, env, action_repeat=1, gripper=False): """ Initializes the inverse kinematics wrapper. This wrapper allows for controlling the robot through end effector movements instead of joint velocities. Args: env (MujocoEnv instance): The environment to wrap. action_repeat (int): Determines the number of times low-level joint control actions will be commanded per high-level end effector action. Higher values will allow for more precise control of the end effector to the commanded targets. """ super().__init__(env) self.action_spec = env.action_spec if self.env.mujoco_robot.name == "sawyer": self.controller = SawyerIKController( bullet_data_path=os.path.join(robosuite.models.assets_root, "bullet_data"), robot_jpos_getter=self._robot_jpos_getter, ) else: raise Exception("Only Sawyer robot environments supported for IK " "control currently.") self.action_repeat = action_repeat self.gripper = gripper
def __init__(self, env): """ Initializes the inverse kinematics wrapper. This wrapper allows for controlling the robot through end effector movements instead of joint velocities. Args: env (MujocoEnv instance): The environment to wrap. """ super().__init__(env) if self.env.mujoco_robot.name == "sawyer": from robosuite.controllers import SawyerIKController self.controller = SawyerIKController( bullet_data_path=os.path.join(robosuite.models.assets_root, "bullet_data"), robot_jpos_getter=self._robot_jpos_getter, ) elif self.env.mujoco_robot.name == "baxter": from robosuite.controllers import BaxterIKController self.controller = BaxterIKController( bullet_data_path=os.path.join(robosuite.models.assets_root, "bullet_data"), robot_jpos_getter=self._robot_jpos_getter, ) else: raise Exception( "Only Sawyer and Baxter robot environments are supported for IK " "control currently.")
def __init__(self, env): self.env = env.wrapped_env.env self.controller = SawyerIKController( bullet_data_path=os.path.join(robosuite.models.assets_root, "bullet_data"), robot_jpos_getter=self._robot_jpos_getter, )
def __init__(self, jpos, quat): self.jpos = jpos self.quat = quat self.controller = SawyerIKController( bullet_data_path=os.path.join(robosuite.models.assets_root, "bullet_data"), robot_jpos_getter=self._robot_jpos_getter, )
def __init__( self, gripper_type="TwoFingerGripper", lower_goal_range=[-0.1, -0.1, -0.1], upper_goal_range=[0.1, 0.1, 0.2], seed=False, random_arm_init=None, # please pass in [low, high] table_full_size=(0.8, 0.8, 0.6), table_friction=(1., 5e-3, 1e-4), use_camera_obs=False, use_object_obs=True, reward_shaping=True, placement_initializer=None, gripper_visualization=False, use_indicator_object=False, has_renderer=False, has_offscreen_renderer=True, render_collision_mesh=False, render_visual_mesh=True, control_freq=10, horizon=1000, ignore_done=False, camera_name="frontview", camera_height=256, camera_width=256, camera_depth=False, ): """ Args: prim_axis (str): which axis is being explored gripper_type (str): type of gripper, used to instantiate gripper models from gripper factory. table_full_size (3-tuple): x, y, and z dimensions of the table. table_friction (3-tuple): the three mujoco friction parameters for the table. use_camera_obs (bool): if True, every observation includes a rendered image. use_object_obs (bool): if True, include object (cube) information in the observation. reward_shaping (bool): if True, use dense rewards. placement_initializer (ObjectPositionSampler instance): if provided, will be used to place objects on every reset, else a UniformRandomSampler is used by default. gripper_visualization (bool): True if using gripper visualization. Useful for teleoperation. use_indicator_object (bool): if True, sets up an indicator object that is useful for debugging. has_renderer (bool): If true, render the simulation state in a viewer instead of headless mode. has_offscreen_renderer (bool): True if using off-screen rendering. render_collision_mesh (bool): True if rendering collision meshes in camera. False otherwise. render_visual_mesh (bool): True if rendering visual meshes in camera. False otherwise. control_freq (float): how many control signals to receive in every second. This sets the amount of simulation time that passes between every action input. horizon (int): Every episode lasts for exactly @horizon timesteps. ignore_done (bool): True if never terminating the environment (ignore @horizon). camera_name (str): name of camera to be rendered. Must be set if @use_camera_obs is True. camera_height (int): height of camera frame. camera_width (int): width of camera frame. camera_depth (bool): True if rendering RGB-D, and RGB otherwise. """ self.upper_goal_range = upper_goal_range self.lower_goal_range = lower_goal_range self.random_arm_init = random_arm_init self.seed = seed self.distance_threshold = 0.015 # settings for table top self.table_full_size = table_full_size self.table_friction = table_friction # whether to use ground-truth object states self.use_object_obs = use_object_obs # reward configuration self.reward_shaping = reward_shaping # object placement initializer self.placement_initializer = placement_initializer # order: di["eef_pos"] di["gripper_qpos"] di["gripper_to_marker"] self.goal # dim: 3, 2, 3, 3 # low = -np.ones(11) * np.inf # high = np.ones(11) * np.inf # self.observation_space = spaces.Box(low=low, high=high) self.controller = SawyerIKController( bullet_data_path=os.path.join(robosuite.models.assets_root, "bullet_data"), robot_jpos_getter=self._robot_jpos_getter, ) super().__init__( gripper_type=gripper_type, gripper_visualization=gripper_visualization, use_indicator_object=use_indicator_object, has_renderer=has_renderer, has_offscreen_renderer=has_offscreen_renderer, render_collision_mesh=render_collision_mesh, render_visual_mesh=render_visual_mesh, control_freq=control_freq, horizon=horizon, ignore_done=ignore_done, use_camera_obs=use_camera_obs, camera_name=camera_name, camera_height=camera_height, camera_width=camera_width, camera_depth=camera_depth, )