Initialize InteractionObject. Args: agent (class SubGoalController): main agent controller class object_class (str): Category of the interaction object. landmark (str, optional): Landmark object category. object_instance (dict, optional): Specific i
(
self,
agent,
object_class: str, landmark: str = None,
object_instance: str = None,
parent_object: str = None,
grounding_phrase: str = None,
)
| 15 | """ |
| 16 | |
| 17 | def __init__( |
| 18 | self, |
| 19 | agent, |
| 20 | object_class: str, landmark: str = None, |
| 21 | object_instance: str = None, |
| 22 | parent_object: str = None, |
| 23 | grounding_phrase: str = None, |
| 24 | ): |
| 25 | """ |
| 26 | Initialize InteractionObject. |
| 27 | |
| 28 | Args: |
| 29 | |
| 30 | agent (class SubGoalController): main agent controller class |
| 31 | object_class (str): Category of the interaction object. |
| 32 | landmark (str, optional): Landmark object category. |
| 33 | object_instance (dict, optional): Specific instance of the interaction object in the current scene state. |
| 34 | If not provided, the agent will search for the object based on the |
| 35 | provided object_class and landmark inputs. |
| 36 | parent_object (str, optional): Parent object that this object instance originated from. For example, if a tomato is sliced, new TomatoSliced instances are created that originated from the tomato instance. |
| 37 | grounding_phrase (dict, optional): grounding phrase that references the object to help find the object if no object_instance is given. |
| 38 | """ |
| 39 | self.agent = agent |
| 40 | if object_class in self.agent.name_to_mapped_name.keys(): |
| 41 | object_class = self.agent.name_to_mapped_name[object_class] |
| 42 | self.object_class = object_class |
| 43 | self.parent_object = parent_object |
| 44 | self.landmark = landmark |
| 45 | self.object_instance = object_instance |
| 46 | self.check_success_change_state = args.check_success_change_state |
| 47 | # self.emptied = False |
| 48 | # self.attribute_dict = None |
| 49 | if self.object_instance is None: |
| 50 | self.get_object_data(object_class, grounding_phrase, parent_object) |
| 51 | else: |
| 52 | try: |
| 53 | self.object_id = int(object_instance.split('_')[-1]) |
| 54 | object_class_ = object_instance.split('_')[0] |
| 55 | except: |
| 56 | self.object_id = None |
| 57 | object_class_ = None |
| 58 | if (self.object_id not in self.agent.object_tracker.objects_track_dict.keys() |
| 59 | or self.agent.object_tracker.objects_track_dict[self.object_id]["label"]!=object_class_): |
| 60 | self.get_object_data(object_class, grounding_phrase, parent_object) |
| 61 | if self.object_id is not None: |
| 62 | self.object_class = self.agent.object_tracker.objects_track_dict[self.object_id]["label"] |
| 63 | self.object_instance = f'{self.object_class}_{self.object_id}' |
| 64 | # self.attribute_dict = self.agent.object_tracker.objects_track_dict[self.object_id] |
| 65 | self.attributes_check = { |
| 66 | "label", |
| 67 | "holding", |
| 68 | "sliced", |
| 69 | "dirty", |
| 70 | "cooked", |
| 71 | "filled", |
| 72 | "fillLiquid", |
| 73 | "toggled", |
| 74 | "open", |
nothing calls this directly
no test coverage detected