Skip to content

robot_related_states

Bases: AbsoluteObjectState, RobotStateMixin

Source code in omnigibson/object_states/robot_related_states.py
class ObjectsInFOVOfRobot(AbsoluteObjectState, RobotStateMixin):
    def _get_value(self):
        """
        Gets all objects in the robot's field of view.

        Returns:
            list: List of objects in the robot's field of view
        """
        if not any(isinstance(sensor, VisionSensor) for sensor in self.robot.sensors.values()):
            raise ValueError("No vision sensors found on robot.")
        obj_names = []
        names_to_exclude = set(["background", "unlabelled"])
        for sensor in self.robot.sensors.values():
            if isinstance(sensor, VisionSensor):
                _, info = sensor.get_obs()
                obj_names.extend([name for name in info["seg_instance"].values() if name not in names_to_exclude])
        return [x for x in [self.obj.scene.object_registry("name", x) for x in obj_names] if x is not None]