Pours the contents of the interaction object into the specified landmark. Args: landmark_name (InteractionObject): Landmark to pour contents into. Note: Assumes object is picked up, filled with liquid. Returns: bool: True if action successf
(self, landmark_name)
| 439 | return success |
| 440 | |
| 441 | def pour(self, landmark_name) -> None: |
| 442 | """ |
| 443 | Pours the contents of the interaction object into the specified landmark. |
| 444 | |
| 445 | Args: |
| 446 | landmark_name (InteractionObject): Landmark to pour contents into. |
| 447 | |
| 448 | Note: |
| 449 | Assumes object is picked up, filled with liquid. |
| 450 | |
| 451 | Returns: |
| 452 | bool: True if action successful, otherwise False. |
| 453 | """ |
| 454 | if self.object_id is None: |
| 455 | self.agent.step_success = False |
| 456 | return False |
| 457 | if self.object_class not in self.agent.FILLABLE_CLASSES: |
| 458 | self.agent.step_success = False |
| 459 | return False |
| 460 | if landmark_name.object_class not in (self.agent.FILLABLE_CLASSES + ["SinkBasin", "BathtubBasin"]): |
| 461 | self.agent.step_success = False |
| 462 | return False |
| 463 | if self.check_attribute("filled", False): |
| 464 | # pre-condition check: object must be filled to pour |
| 465 | # return True |
| 466 | if args.online_skill_learning and args.error_on_action_fail: |
| 467 | self.agent.err_message = f"Object must be filled with liquid in order to pour it. Depending on the task, the object should either be checked for if it is filled before trying to pour it or the object should be filled up with a liquid before attempting to pour it." |
| 468 | self.agent.help_message = 'None' |
| 469 | print(self.agent.err_message) |
| 470 | raise CustomError(self.agent.err_message) |
| 471 | if self.check_attribute("holding", False): |
| 472 | # pre-condition: make sure object is in hand |
| 473 | self.go_to() |
| 474 | self.pickup() |
| 475 | if not self.agent.navigate_obj_info["obj_ID"]==landmark_name.object_id: |
| 476 | # pre-condition: make sure looking at landmark object |
| 477 | landmark_name.go_to() |
| 478 | return self.execute_manipulation("Pour", landmark_name) |
| 479 | |
| 480 | def empty(self): |
| 481 | """Empty the object of any other objects on/in it to clear it out. |
nothing calls this directly
no test coverage detected