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¶
Sensor data storage to filesystem. |
Module Contents¶
- class robokudo.annotators.file_writer.FileWriter(name='FileWriter', descriptor=Descriptor())¶
-
Bases:
robokudo.annotators.core.BaseAnnotatorSensor 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.DescriptorConfiguration descriptor for file writer.
- class Parameters¶
-
Parameters for configuring file storage.
Storage parameters:
- Variables:
-
target_dir – Directory to store files in, defaults to “/tmp/”
filename_prefix – Prefix for generated filenames, defaults to “rk_”
Note
filename_prefix should match FileReader configuration.
- target_dir = '/tmp/'¶
- filename_prefix = 'rk_'¶
- parameters¶
- initialized = False¶
- target_dir_path¶
- generate_full_file_path_(cas_view: str, file_extension: 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 (str) – One of the definitions from CASView.X
file_extension (str) – File extension without dot (e.g. “jpg”)
- Returns:
-
A string with the full path according to our naming scheme.
- Return type:
-
str
- update()¶
-
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
- Return type:
-
py_trees.Status