robokudo.annotators.file_writer =============================== .. py:module:: robokudo.annotators.file_writer .. autoapi-nested-parse:: 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 ------- .. autoapisummary:: robokudo.annotators.file_writer.FileWriter Module Contents --------------- .. py:class:: FileWriter(name='FileWriter', descriptor=Descriptor()) Bases: :py:obj:`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. .. py:class:: Descriptor Bases: :py:obj:`robokudo.annotators.core.BaseAnnotator.Descriptor` Configuration descriptor for file writer. .. py:class:: Parameters Parameters for configuring file storage. Storage parameters: :ivar target_dir: Directory to store files in, defaults to "/tmp/" :type target_dir: str :ivar filename_prefix: Prefix for generated filenames, defaults to "rk_" :type filename_prefix: str .. note:: filename_prefix should match FileReader configuration. .. py:attribute:: target_dir :value: '/tmp/' .. py:attribute:: filename_prefix :value: 'rk_' .. py:attribute:: parameters .. py:attribute:: initialized :value: False .. py:attribute:: target_dir_path .. py:method:: 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 :param cas_view: One of the definitions from CASView.X :type cas_view: str :param file_extension: File extension without dot (e.g. "jpg") :type file_extension: str :return: A string with the full path according to our naming scheme. :rtype: str .. py:method:: 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 :return: SUCCESS after storing, FAILURE if not initialized :rtype: py_trees.Status