robokudo.io.file_reader_interface ================================= .. py:module:: robokudo.io.file_reader_interface .. autoapi-nested-parse:: 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 Classes ------- .. autoapisummary:: robokudo.io.file_reader_interface.FileReaderInterface robokudo.io.file_reader_interface.RGBDFileReaderInterface Module Contents --------------- .. py:class:: FileReaderInterface(camera_config) Bases: :py:obj:`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. :ivar initialized: Whether the interface was successfully initialized :type initialized: bool :ivar target_dir: Target directory path as string :type target_dir: str :ivar target_dir_path: Target directory as Path object :type target_dir_path: Path :ivar filename_prefix: Prefix for data files, defaults to "rk_" :type filename_prefix: str :ivar loaded_paths: Dictionary mapping timestamps to file paths :type loaded_paths: dict :ivar loaded_data: Dictionary mapping timestamps to loaded data :type loaded_data: dict :ivar data_reader: Iterator for accessing loaded data :type data_reader: DictIteratorReader .. py:class:: DictIteratorReader(data=dict(), data_sequence=[]) 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. :ivar index: Current position in the sequence :type index: int or None :ivar data: Dictionary containing the data :type data: dict :ivar data_sequence: List defining iteration order :type data_sequence: list .. py:attribute:: index :value: None .. py:attribute:: data .. py:attribute:: data_sequence :value: [] .. py:method:: reset_cursor() Reset the iterator to the beginning of the sequence. Sets index to 0 if there is data, None otherwise. .. py:method:: cursor_has_data() Check if there is more data to read. :return: True if more data is available, False otherwise :rtype: bool .. py:method:: get_next_data() -> Optional[dict] Get the next data item in the sequence. :return: Next data item if available, None otherwise :rtype: dict or None .. py:attribute:: initialized :value: False .. py:attribute:: loaded_paths .. py:attribute:: loaded_data .. py:attribute:: data_reader .. py:method:: has_new_data() Check if new data is available to read. Handles looping behavior based on camera configuration and maintains cursor position in the data sequence. :return: True if new data is available, False otherwise :rtype: bool .. py:class:: RGBDFileReaderInterface(camera_config) Bases: :py:obj:`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. .. py:method:: set_data(cas: robokudo.cas.CAS) 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 :param cas: Common Analysis Structure to update :type cas: robokudo.cas.CAS