MCPcopy Create free account
hub / github.com/Gabesarch/ICAL / pickup

Method pickup

TEACh/models/agent/api_primitives_executable.py:175–206  ·  view source on GitHub ↗

Assumes object is in view and picks it up. Returns: bool: True if action successful, otherwise False.

(self)

Source from the content-addressed store, hash-verified

173 return None
174
175 def pickup(self) -> None:
176 """
177 Assumes object is in view and picks it up.
178
179 Returns:
180 bool: True if action successful, otherwise False.
181 """
182 if self.object_id is None:
183 self.agent.step_success = False
184 return False
185 if self.check_attribute("holding", True):
186 return True
187 if self.object_class not in self.agent.PICKUPABLE_OBJECTS:
188 self.agent.step_success = False
189 return False
190 if self.agent.object_tracker.get_ID_of_holding() is not None:
191 # pre-condition check: put down the object in hand before picking up a new one
192 # if args.online_skill_learning and args.error_on_action_fail:
193 # self.agent.err_message = f"The agent tried to pick up the {self.object_class} when the agent was already holding {self.agent.object_tracker.get_label_of_holding()}. The code should be altered to only pick up one object at a time. Or use the put_down() function to put down the object in hand before picking up a new one."
194 # self.agent.help_message = ''
195 # print(self.agent.err_message)
196 # raise CustomError(self.agent.err_message)
197 self.put_down()
198 self.go_to()
199 # if self.get_attribute("supported_by") is not None:
200 # class_supported = self.get_attribute("supported_by").split('_')[0]
201 # if class_supported in self.agent.OPENABLE_OBJECTS:
202 # self.get_attribute("supported_by").split('_')[0]
203 if not self.agent.navigate_obj_info["obj_ID"]==self.object_id:
204 # pre-condition: make sure looking at object
205 self.go_to()
206 return self.execute_manipulation("Pickup")
207
208 def place(self, landmark_name) -> None:
209 """

Callers 3

placeMethod · 0.95
pourMethod · 0.95
pickup_and_placeMethod · 0.95

Calls 5

check_attributeMethod · 0.95
put_downMethod · 0.95
go_toMethod · 0.95
execute_manipulationMethod · 0.95
get_ID_of_holdingMethod · 0.80

Tested by

no test coverage detected