robokudo.io.storage_reader_interface

MongoDB storage reader interface for RoboKudo.

This module provides an interface for reading stored sensor data and annotations from a MongoDB database. It supports:

  • Reading stored RGB-D camera data

  • Loading camera calibration information

  • Restoring annotations and views

  • Automatic cursor management

  • Optional looping through stored data

The module is primarily used for:

  • Replaying recorded data

  • Testing and debugging pipelines

  • Offline data analysis

  • Visualization of stored data

Classes

StorageReaderInterface

A camera interface for reading data from MongoDB storage.

Module Contents

class robokudo.io.storage_reader_interface.StorageReaderInterface(camera_config: robokudo.descriptors.camera_configs.config_mongodb_playback.MongoCameraConfig)

Bases: robokudo.io.camera_interface.CameraInterface

A camera interface for reading data from MongoDB storage.

This interface reads sensor data and annotations that were previously stored using the StorageWriter annotator. It handles data deserialization and restoration of the Common Analysis Structure (CAS) views.

storage: robokudo.io.storage.Storage

MongoDB storage interface.

reader: robokudo.io.storage.Storage.ListReader

List-based reader for MongoDB data.

has_new_data() bool

Check if more data is available to read.

Handles looping behavior based on camera configuration and maintains cursor position in the data sequence.

Returns:

True if more data is available, False otherwise

set_data(cas: robokudo.cas.CAS) None

Update the Common Analysis Structure with data from storage.

This method: * Retrieves the next frame from storage * Restores views and annotations * Updates camera intrinsics * Sets depth availability flag

Parameters:

cas – Common Analysis Structure to update

_restore_camera_to_world_transform(cas_frame: dict) None

Restore the stored camera pose as a transform bound to the running world.

The serialized CAMERA_TO_WORLD_TRANSFORM may reference bodies from the recorded world. This method decodes the numeric transform, resolves the intended frame names, creates/updates the matching bodies in the current RoboKudo world, and stores the rebound transform in cas_frame["views"].

_decode_stored_camera_to_world_transform(view_document: dict, cas_frame: dict) tuple[semantic_digital_twin.spatial_types.HomogeneousTransformationMatrix, str, str]

Decode a stored camera transform and determine its frame names.

Recordings must carry frame names as view metadata. The returned transform contains only the numeric pose and must be rebound before use.

static _decode_transform_payload_without_frames(payload: dict) semantic_digital_twin.spatial_types.HomogeneousTransformationMatrix

Decode only the numeric transform, ignoring serialized frame UUIDs.

static _rebind_camera_to_world_transform(stored_transform: semantic_digital_twin.spatial_types.HomogeneousTransformationMatrix, world_frame: str, camera_frame: str) semantic_digital_twin.spatial_types.HomogeneousTransformationMatrix

Create a camera transform whose frames belong to the running world.

The numeric pose is copied from stored_transform. The reference and child frames are looked up or created in the current global RoboKudo world, and the corresponding world connection origin is updated.