robokudo.io.file_reader_interface

File-based data reading interface for RoboKudo.

This module provides interfaces for reading sensor data from the local filesystem. It supports reading:

  • RGB-D camera data (color and depth images)

  • Camera calibration information

  • Timestamped data sequences

The module is primarily used for:

  • Unit testing with recorded data

  • Simple demos and examples

  • Development and debugging

Attributes

T

Classes

FileReaderInterface

A camera interface for reading stored data from the local filesystem.

RGBDFileReaderInterface

Specialized file reader interface for RGB-D camera data.

Module Contents

robokudo.io.file_reader_interface.T
class robokudo.io.file_reader_interface.FileReaderInterface(camera_config: typing_extensions.Any)

Bases: robokudo.io.camera_interface.CameraInterface

A camera interface for reading stored data from the local filesystem.

This interface reads sensor data from files in a specified directory. Files must follow the naming convention: * rk_TIMESTAMP_color_image.jpg - Color image data * rk_TIMESTAMP_depth_image.png - Depth image data * rk_TIMESTAMP_cam_info.json - Camera calibration data

The ‘rk_’ prefix is configurable. Data types in filenames must match CASViews definitions.

Note

This interface is primarily for testing and demos. For production, use StorageReaderInterface instead.

class DictIteratorReader(data: typing_extensions.Optional[typing_extensions.Dict[str, typing_extensions.Dict[str, typing_extensions.Any]]] = None, data_sequence: typing_extensions.Optional[typing_extensions.List[str]] = None)

Helper class for iterating over dictionary data in sequence.

This class provides cursor-based iteration over dictionary data, maintaining the sequence order and supporting reset operations.

index: typing_extensions.Optional[int] = None

Current position in the sequence

data: typing_extensions.Dict[str, typing_extensions.Dict[str, typing_extensions.Any]]

Dictionary containing the data

data_sequence: typing_extensions.List[str] = []

List defining iteration order

reset_cursor() None

Reset the iterator to the beginning of the sequence.

Sets index to 0 if there is data, None otherwise.

cursor_has_data() bool

Check if there is more data to read.

Returns:

True if more data is available, False otherwise

get_next_data() typing_extensions.Optional[typing_extensions.Dict]

Get the next data item in the sequence.

Returns:

Next data item if available, None otherwise

initialized: bool = False

Whether the interface was successfully initialized

loaded_paths: typing_extensions.Dict[str, typing_extensions.Dict[str, pathlib.Path]]

Dictionary mapping timestamps to file paths

loaded_data: typing_extensions.Dict[str, typing_extensions.Dict[str, typing_extensions.Any]]

Dictionary mapping timestamps to loaded data

data_reader

Iterator for accessing loaded data

has_new_data() bool

Check if new data is available to read.

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

Returns:

True if new data is available, False otherwise

class robokudo.io.file_reader_interface.RGBDFileReaderInterface(camera_config: typing_extensions.Any)

Bases: FileReaderInterface

Specialized file reader interface for RGB-D camera data.

This class extends FileReaderInterface to handle the specific case of reading RGB-D camera data, including color images, depth images, and camera calibration information.

Inherits all instance variables from FileReaderInterface.

set_data(cas: robokudo.cas.CAS) None

Set the next RGB-D data frame into the CAS.

This method: * Reads the next color and depth images * Applies any necessary fixes (e.g., Kinect height fix) * Sets camera calibration and transformation data * Updates the CAS with all loaded data

Parameters:

cas – Common Analysis Structure to update