Places the interaction object on the given landmark. Args: landmark_name (InteractionObject): Landmark to place the object on. Note: Assumes robot has an object and the landmark is in view. Returns: bool: True if action successful, otherwis
(self, landmark_name)
| 206 | return self.execute_manipulation("Pickup") |
| 207 | |
| 208 | def place(self, landmark_name) -> None: |
| 209 | """ |
| 210 | Places the interaction object on the given landmark. |
| 211 | |
| 212 | Args: |
| 213 | landmark_name (InteractionObject): Landmark to place the object on. |
| 214 | |
| 215 | Note: |
| 216 | Assumes robot has an object and the landmark is in view. |
| 217 | |
| 218 | Returns: |
| 219 | bool: True if action successful, otherwise False. |
| 220 | """ |
| 221 | if self.object_id is None or landmark_name.object_id is None: |
| 222 | self.agent.step_success = False |
| 223 | return False |
| 224 | if self.object_class not in self.agent.PICKUPABLE_OBJECTS: |
| 225 | self.agent.step_success = False |
| 226 | return False |
| 227 | if landmark_name.object_class not in self.agent.RECEPTACLE_OBJECTS: |
| 228 | self.agent.step_success = False |
| 229 | return False |
| 230 | if self.agent.object_tracker.get_ID_of_holding() is None or self.agent.object_tracker.get_ID_of_holding()!=self.object_id: |
| 231 | # pre-condition check: pick up before placing |
| 232 | # if args.online_skill_learning and args.error_on_action_fail: |
| 233 | # self.agent.err_message = f"The agent tried to place the {self.object_class} on {landmark_name} without picking up the {self.object_class} first. The code should be altered to pick up the {self.object_class} first before trying to place it." |
| 234 | # self.agent.help_message = '' |
| 235 | # print(self.agent.err_message) |
| 236 | # raise CustomError(self.agent.err_message) |
| 237 | self.pickup() |
| 238 | if landmark_name.check_attribute("emptied", False) and landmark_name.object_class in self.agent.EMPTYABLE and landmark_name.object_id is not None: |
| 239 | landmark_name.empty() |
| 240 | landmark_name.change_state("emptied", True) |
| 241 | if not self.agent.navigate_obj_info["obj_ID"]==landmark_name.object_id: |
| 242 | # pre-condition: make sure looking at object |
| 243 | landmark_name.go_to() |
| 244 | if landmark_name.object_class in self.agent.OPENABLE_OBJECTS: |
| 245 | if landmark_name.check_attribute("open", False): |
| 246 | landmark_name.open() |
| 247 | |
| 248 | success_place = self.execute_manipulation("Place", landmark_name) |
| 249 | if success_place: |
| 250 | # if |
| 251 | # obj_metas = {} |
| 252 | # for obj in self.agenwt.controller.last_event.metadata['objects']: |
| 253 | # if obj[''] |
| 254 | # obj_metas[obj['objectId']] = |
| 255 | # if |
| 256 | self.change_state("supported_by", [landmark_name.object_instance]) |
| 257 | # self.change_state("supported_by", [landmark_name.object_class]) |
| 258 | |
| 259 | return success_place |
| 260 | |
| 261 | def slice(self) -> None: |
| 262 | """ |
no test coverage detected