Source code for concepts.pdsketch.perception_interface

#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File   :
# Author : Jiayuan Mao
# Email  :
# Date   : 03/04/2024
# This file is part of Project Concepts.
# Distributed under terms of the MIT license.

from dataclasses import dataclass
from typing import Any, Sequence, Dict

import numpy as np
from concepts.pdsketch.domain import Domain
from concepts.pdsketch.executor import PDSketchExecutor

[docs]@dataclass class ObjectMemoryItem(object): """A memory item for an object.""" identifier: int """The index of the object in the memory.""" query: str """The query that is used to detect the object.""" partial_pcd: Any """The partial point cloud of the detected object.""" pcd: Any """The completed point cloud of the detected object.""" mesh: Any """The mesh of the detected object.""" last_updated_frame: int """The frame number when the memory item is last updated.""" last_updated_frame_segmenetation: np.ndarray """The point cloud segmentation of the detected object.""" features: Dict[str, Any] """Any additional features of the detected object."""
[docs]class PDSketchPerceptionInterface(object): """The perception interface for PDSketch. The perception interface takes the raw sensory data and supports various types of perception queries, including - Occupancy point clouds. This is useful for performing collision checking. - Identifying of objects given particular queries, such as the name of an object. """
[docs] def __init__(self, executor: PDSketchExecutor): self.executor = executor
[docs] def get_partial_scene_pcd(self) -> Any: """Get the partial point cloud of the scene. This point cloud might be partial so we may not directly use it for collision checking.""" raise NotImplementedError()
[docs] def get_scene_pcd(self) -> Any: """Get the point cloud of the scene. This will be used for collision checking.""" raise NotImplementedError()
[docs] def detect_object(self, name: str) -> Sequence[ObjectMemoryItem]: """Detect the object with the given name.""" raise NotImplementedError()