scene_service.ingest

Ingest: ROS 2 subscribers and the perception backends that feed the registry.

class scene_service.ingest.ConceptGraphsDetector(*, rgb_fetcher_msg: Callable[[], Any | None], depth_fetcher_msg: Callable[[], Any | None], camera_info_fetcher: Callable[[], _CamIntrinsics | None], on_detections: Callable[[list[Detection]], Awaitable[None]], registry: ObjectRegistry, world_frame_fn: Callable[[], str] | None = None, robot_base_frame_fn: Callable[[], str] | None = None, period_s: float = 0.6, pose_max_age_s: float = 2.0, confidence_threshold: float = 0.3, max_detections: int = 30, yolo_weights_path: str | None = None, sam_weights_path: str | None = None, clip_model_name: str | None = None, clip_pretrained: str | None = None, cfg_overrides: dict | None = None, hub: Any = None, camera_frame: str = '', base_frame: str | None = None, profile: str = 'lite')[source]

Bases: object

Per-frame detector that runs the canonical concept-graphs merge pipeline.

async delete_object(object_id: str) → None[source]

Drop the CG map entries whose uuid is bound to object_id.

embed_text(texts: list[str]) → list[list[float]] | None[source]

Encode texts with CLIP, normalized to match object image features.

export_3d_snapshot(max_points_per_obj: int = 256) → dict[source]
latest_depth_metres()[source]

The current depth image in metres, or None.

latest_detection_views(max_age_s: float = 3.0)[source]

(rgb_bgr, [(object_id, (u0, v0, u1, v1))], camera_xy) for the last frame whose detections matched objects, or None.

Each box is the one the detector drew for that object in that frame, so the photograph shows what the label was given to.

latest_frame_bundle()[source]

Return (rgb_bgr, K, T_cam_map) for projecting map-frame points into the current camera image, or None when any piece is unavailable.

async reset_derived_state() → None[source]

Empty the CG map and uuid bindings (flush).

async start() → None[source]
async stop() → None[source]
class scene_service.ingest.SubscribersHub(specs: list[TopicSpec], *, node_name: str = 'scene_subscribers')[source]

Bases: object

The rclpy node, its spin thread and one latest-message slot per kind.

add_spec(spec: TopicSpec) → bool[source]

Subscribe to a topic that appeared after start(). False when the kind is already known or its message class is unavailable.

has(kind: str) → bool[source]
has_kinds() → set[str][source]
latest(kind: str) → tuple[Any, float, int][source]

(msg, stamp_unix, count); msg is None until the first message arrives.

lookup_transform_4x4(target_frame: str, source_frame: str, stamp: Any = None)[source]

4x4 transform mapping points from target_frame into source_frame, or None.

stamp (a message header stamp) asks for the transform at that moment: a frame is placed with the pose the robot had when it was captured, not the pose it has once detection on it has finished. Outside the buffered history the latest transform is used, as before.

async start() → None[source]
async stop() → None[source]
class scene_service.ingest.TopicSpec(kind: str, topic: str, msg_type: str, qos_profile: str = 'default')[source]

Bases: object

One observation kind (rgb, depth, lidar2d, pose, …) wired to a ROS topic; qos_profile is the publisher’s declaration from Atlas.

kind: str
msg_type: str
qos_profile: str = 'default'
topic: str
class scene_service.ingest.VLMObjectDetector(*, rgb_fetcher: ~typing.Callable[[], bytes | tuple[bytes, int | float] | None], camera_to_world_fn: ~typing.Callable[[], tuple[object, str] | None], on_detections: ~typing.Callable[[list[~scene_service.state.data_assoc.Detection]], ~typing.Awaitable[None]], period_s: float = 3.0, intrinsics: ~scene_service.ingest.perception_vlm._CamIntrinsics | None = None, intrinsics_fn: ~typing.Callable[[], ~scene_service.ingest.perception_vlm._CamIntrinsics | None] | None = None, frame_change_threshold: float | None = None, cache_max_age_s: float | None = None, failure_backoff_base_s: float | None = None, failure_backoff_max_s: float | None = None, clock: ~typing.Callable[[], float] = <built-in function monotonic>)[source]

Bases: object

Polls rgb_fetcher, asks the VLM, and hands Detection batches to on_detections.

property inference_counts: dict[str, int]
async start() → None[source]
async stop() → None[source]

Modules

capabilities

Perception routing: which tier and detector Scene runs, from the wired inputs.

perception_concept_graphs

ConceptGraphs perception and persistent object-map integration.

perception_vlm

VLM object detection: ask an OpenAI-compatible vision model (VLM_BASE_URL, VLM_API_KEY, VLM_MODEL) for the objects in an RGB frame and project them into the world frame.

ros_subscribers

ROS 2 ingest: an rclpy node on its own thread keeps the latest message of each observation kind in a thread-safe slot that asyncio code reads on its own schedule.