*********************** Robot/Camera Data Files *********************** During execution, all data from the robot and cameras are stored into files ``robot_data.dat`` and ``camera_data.dat``. When running locally with simulation, these files are stored to the directory that is specified with the ``--output-dir`` argument. When running on the actual robots, you can download them once the job has finished, see :ref:`download_log_files`. The data is stored in a custom binary format. We provide APIs to load them. Load Recorded Robot Data ======================== Use the `robot log reader`_ class to load the log file. **Python Example:** .. literalinclude:: ../examples/robot_log_reader.py You can also convert the binary file to a plain-text CSV file using ``robot_log_dat2csv.py``. You can easily execute it from the challenge Singularity image:: ./realrobotchallenge.sif rosrun robot_fingers robot_log_dat2csv.py \ robot_data.dat robot_data.csv After the conversion, you can use ``plot_logged_data.py`` to plot data from the CSV file. For example, to plot the observed position of the first three joints:: ./realrobotchallenge.sif rosrun robot_fingers plot_logged_data.py \ robot_data.csv observation_position_{0,1,2} Load Recorded Camera Data ========================= **Python Example:** .. literalinclude:: ../examples/camera_log_reader.py There are also tools to view a log file and to convert the camera stream to a video file, so it can easily be shared with others. You can execute them directly using the Singularity image. To view the recordings of all three cameras: .. code-block:: bash ./realrobotchallenge.sif rosrun trifinger_object_tracking tricamera_log_viewer.py \ camera_data.dat There are several options for visualizing the result of the object tracking, e.g. ``-v`` to draw the cube pose in the images. See ``--help`` for a complete list. .. _camera_log_to_video: To convert the recordings of one camera into a video file (you need to specify one of the cameras "camera60", "camera180", "camera300"): .. code-block:: bash ./realrobotchallenge.sif rosrun trifinger_object_tracking tricamera_log_converter.py \ camera_data.dat video.avi -c camera60 Load Robot and Camera Data and Synchronize ========================================== The robot and the camera are providing observations at different rates so technically there are separate "time indices" for the robot and the camera observations. To get some synchronization, the :class:`~robot_fingers.TriFingerPlatformFrontend` class allows accessing the camera observation using robot time indices by mapping to the corresponding camera time index internally. The ``TriFingerPlatformLog`` class provides an API to have the same kind of access when reading the log files. It is basically a wrapper around the robot and camera log readers described above, performing the same "robot index to camera index"-mapping as the :class:`~robot_fingers.TriFingerPlatformFrontend` class. **Python Example:** .. literalinclude:: ../examples/trifinger_platform_log.py API Documentation ================= .. autoclass:: robot_interfaces.trifinger.BinaryLogReader :members: .. autoclass:: robot_interfaces.trifinger.LogEntry .. attribute:: timeindex :type: int .. attribute:: timestamp :type: float .. attribute:: observation :type: Observation .. attribute:: desired_action :type: Action .. attribute:: applied_action :type: Action .. attribute:: status :type: Status .. autoclass:: trifinger_object_tracking.py_tricamera_types.LogReader .. attribute:: data :type: List[trifinger_object_tracking.py_tricamera_types.TriCameraObjectObservation] List of camera observations from the log file. .. attribute:: timestamps :type: List[float] List of timestamps of the camera observations. This refers to the time when the observation was added to the time series. The timestamps of when the images where acquired from the cameras are stored in the observations themselves. .. automethod:: read_file .. autoclass:: robot_fingers.TriFingerPlatformLog :members: .. _robot log reader: https://open-dynamic-robot-initiative.github.io/code_documentation/robot_interfaces/docs/doxygen/html/classrobot__interfaces_1_1RobotBinaryLogReader.html