Initializes a new `Place` 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: A `_Pl
(self, arena, arm, hand, prop, obs_settings, workspace,
control_timestep, cradle)
| 117 | """Place the prop on top of another fixed prop held up by a pedestal.""" |
| 118 | |
| 119 | def __init__(self, arena, arm, hand, prop, obs_settings, workspace, |
| 120 | control_timestep, cradle): |
| 121 | """Initializes a new `Place` task. |
| 122 | |
| 123 | Args: |
| 124 | arena: `composer.Entity` instance. |
| 125 | arm: `robot_base.RobotArm` instance. |
| 126 | hand: `robot_base.RobotHand` instance. |
| 127 | prop: `composer.Entity` instance. |
| 128 | obs_settings: `observations.ObservationSettings` instance. |
| 129 | workspace: A `_PlaceWorkspace` instance. |
| 130 | control_timestep: Float specifying the control timestep in seconds. |
| 131 | cradle: `composer.Entity` onto which the `prop` must be placed. |
| 132 | """ |
| 133 | self._arena = arena |
| 134 | self._arm = arm |
| 135 | self._hand = hand |
| 136 | self._arm.attach(self._hand) |
| 137 | self._arena.attach_offset(self._arm, offset=workspace.arm_offset) |
| 138 | self.control_timestep = control_timestep |
| 139 | |
| 140 | # Add custom camera observable. |
| 141 | self._task_observables = cameras.add_camera_observables( |
| 142 | arena, obs_settings, cameras.FRONT_CLOSE) |
| 143 | |
| 144 | self._tcp_initializer = initializers.ToolCenterPointInitializer( |
| 145 | self._hand, self._arm, |
| 146 | position=distributions.Uniform(*workspace.tcp_bbox), |
| 147 | quaternion=workspaces.DOWN_QUATERNION) |
| 148 | |
| 149 | self._prop = prop |
| 150 | self._prop_frame = self._arena.add_free_entity(prop) |
| 151 | self._pedestal = Pedestal(cradle=cradle, target_radius=_TARGET_RADIUS) |
| 152 | self._arena.attach(self._pedestal) |
| 153 | |
| 154 | for obs in self._pedestal.observables.as_dict().values(): |
| 155 | obs.configure(**obs_settings.prop_pose._asdict()) |
| 156 | |
| 157 | self._prop_placer = initializers.PropPlacer( |
| 158 | props=[prop], |
| 159 | position=distributions.Uniform(*workspace.prop_bbox), |
| 160 | quaternion=workspaces.uniform_z_rotation, |
| 161 | settle_physics=True, |
| 162 | max_attempts_per_prop=50) |
| 163 | |
| 164 | self._pedestal_placer = initializers.PropPlacer( |
| 165 | props=[self._pedestal], |
| 166 | position=distributions.Uniform(*workspace.target_bbox), |
| 167 | settle_physics=False) |
| 168 | |
| 169 | # Add sites for visual debugging. |
| 170 | workspaces.add_bbox_site( |
| 171 | body=self.root_entity.mjcf_model.worldbody, |
| 172 | lower=workspace.tcp_bbox.lower, |
| 173 | upper=workspace.tcp_bbox.upper, |
| 174 | rgba=constants.GREEN, name='tcp_spawn_area') |
| 175 | workspaces.add_bbox_site( |
| 176 | body=self.root_entity.mjcf_model.worldbody, |
nothing calls this directly
no test coverage detected