robokudo.annotators.file_writer

Sensor data storage to filesystem.

This module provides an annotator for:

  • Storing sensor data to local filesystem

  • Supporting color and depth images

  • Saving camera calibration info

  • Using consistent naming schemes

The module uses:

  • OpenCV image writing

  • JSON serialization

  • Timestamp-based filenames

  • Configurable storage paths

Note

Designed to work with robokudo.io.file_reader_interface.

Classes

FileWriter

Sensor data storage to filesystem.

Module Contents

class robokudo.annotators.file_writer.FileWriter(name: str = 'FileWriter', descriptor: FileWriter = Descriptor())

Bases: robokudo.annotators.core.BaseAnnotator

Sensor data storage to filesystem.

This module provides methods to store sensor data into the local filesystem. This way you can work on recorded data without having to use bag files. It is intended to be used with robokudo.io.file_reader_interface

Note

Target directory must exist and be writable.

class Descriptor

Bases: robokudo.annotators.core.BaseAnnotator.Descriptor

Configuration descriptor for file writer.

class Parameters

Parameters for configuring file storage.

Note

filename_prefix should match FileReader configuration.

target_dir: str = '/tmp/'

Directory to store files in

filename_prefix: str = 'rk_'

Prefix for generated filenames, make sure that this matches the FileReader filename_prefix

parameters
initialized = False
target_dir_path: pathlib.Path
generate_full_file_path_(cas_view: str, file_extension: str) str

Generate the full filename and path where data should be stored.

Creates a filepath using:

  • Configured prefix

  • Current timestamp

  • CAS view name

  • File extension

Parameters:
  • cas_view – One of the definitions from CASView.X

  • file_extension – File extension without dot (e.g. “jpg”)

Returns:

A string with the full path according to our naming scheme.

update() py_trees.common.Status

Process and store sensor data.

The method:

  • Checks initialization status

  • Loads color image, depth image and camera info

  • Writes color image as JPG

  • Writes depth image as PNG

  • Saves camera info as JSON

Returns:

SUCCESS after storing, FAILURE if not initialized