Initializes a new `Lift` task. Args: arena: `composer.Entity` instance. arm: `robot_base.RobotArm` instance. hand: `robot_base.RobotHand` instance. prop: `composer.Entity` instance. obs_settings: `observations.ObservationSettings` instance. workspace: `_LiftW
(
self, arena, arm, hand, prop, obs_settings, workspace, control_timestep)
| 102 | """A task where the goal is to elevate a prop.""" |
| 103 | |
| 104 | def __init__( |
| 105 | self, arena, arm, hand, prop, obs_settings, workspace, control_timestep): |
| 106 | """Initializes a new `Lift` task. |
| 107 | |
| 108 | Args: |
| 109 | arena: `composer.Entity` instance. |
| 110 | arm: `robot_base.RobotArm` instance. |
| 111 | hand: `robot_base.RobotHand` instance. |
| 112 | prop: `composer.Entity` instance. |
| 113 | obs_settings: `observations.ObservationSettings` instance. |
| 114 | workspace: `_LiftWorkspace` specifying the placement of the prop and TCP. |
| 115 | control_timestep: Float specifying the control timestep in seconds. |
| 116 | """ |
| 117 | self._arena = arena |
| 118 | self._arm = arm |
| 119 | self._hand = hand |
| 120 | self._arm.attach(self._hand) |
| 121 | self._arena.attach_offset(self._arm, offset=workspace.arm_offset) |
| 122 | self.control_timestep = control_timestep |
| 123 | |
| 124 | # Add custom camera observable. |
| 125 | self._task_observables = cameras.add_camera_observables( |
| 126 | arena, obs_settings, cameras.FRONT_CLOSE) |
| 127 | |
| 128 | self._tcp_initializer = initializers.ToolCenterPointInitializer( |
| 129 | self._hand, self._arm, |
| 130 | position=distributions.Uniform(*workspace.tcp_bbox), |
| 131 | quaternion=workspaces.DOWN_QUATERNION) |
| 132 | |
| 133 | self._prop = prop |
| 134 | self._arena.add_free_entity(prop) |
| 135 | self._prop_placer = initializers.PropPlacer( |
| 136 | props=[prop], |
| 137 | position=distributions.Uniform(*workspace.prop_bbox), |
| 138 | quaternion=workspaces.uniform_z_rotation, |
| 139 | ignore_collisions=True, |
| 140 | settle_physics=True) |
| 141 | |
| 142 | # Add sites for visualizing bounding boxes and target height. |
| 143 | self._target_height_site = workspaces.add_bbox_site( |
| 144 | body=self.root_entity.mjcf_model.worldbody, |
| 145 | lower=(-1, -1, 0), upper=(1, 1, 0), |
| 146 | rgba=constants.RED, name='target_height') |
| 147 | workspaces.add_bbox_site( |
| 148 | body=self.root_entity.mjcf_model.worldbody, |
| 149 | lower=workspace.tcp_bbox.lower, upper=workspace.tcp_bbox.upper, |
| 150 | rgba=constants.GREEN, name='tcp_spawn_area') |
| 151 | workspaces.add_bbox_site( |
| 152 | body=self.root_entity.mjcf_model.worldbody, |
| 153 | lower=workspace.prop_bbox.lower, upper=workspace.prop_bbox.upper, |
| 154 | rgba=constants.BLUE, name='prop_spawn_area') |
| 155 | |
| 156 | @property |
| 157 | def root_entity(self): |
nothing calls this directly
no test coverage detected