Bases: AbsoluteObjectState
The value of this state is the list of rooms that the object currently is in.
Source code in object_states/room_states.py
| class InsideRoomTypes(AbsoluteObjectState):
"""
The value of this state is the list of rooms that the object currently is in.
"""
def _get_value(self):
if hasattr(self.obj, "fixed_base") and self.obj.fixed_base:
# For fixed objects, we can use the in_rooms attribute.
if hasattr(self.obj, "in_rooms") and self.obj.in_rooms:
return self.obj.in_rooms
# Otherwise we need to calculate using room segmentation function. Check that it exists.
if not hasattr(self._simulator.scene, "get_room_type_by_point"):
return ["undefined"]
pose = self.obj.get_position()
return [self._simulator.scene.get_room_type_by_point(np.array(pose[:2]))]
def _set_value(self, new_value):
raise NotImplementedError("Room state currently does not support setting.")
|