SignalLogger
A library for signal logging.
Log File

Naming convention

The files are stored in the current working directory (when using ros, /home/$user/.ros/ ) with the following naming convention.

silo_#y#m#d_#H-#M-#S_#NR
  • #y year as a four-digit number
  • #m month of the year as a two-digit number
  • #d day of the month as a two-digit number
  • #H hour of the day as a two-digit number
  • #M minutes of the hour as a two-digit number
  • #S seconds of the minute as a two-digit number
  • #NR continuous numeration of all log files as a five-digit number

Example: The 113th dataset overall, recorded at September 13th 2016 at 12:13:49, would be stored as:

silo_20160913_12-13-49_00113

File structure

Header

The file starts with a warning that you should not edit the log file in a text-editor, since this could corrupt the binary data.

The next line states the file name.

# Log File: silo_20160913_12-13-49_00113

Then the total number of collect calls is provided for time synchronization of data originating from a looping buffer. We know that at collect = 0 all log elements were collected. Thus one can calculate the corresponding time for every element.

# Time synchronization offset:
27

For easier parsing the total number of logged elements is stored to the file as well.

# Number of Log Elements:
6

A list of all saved log elements is given in the manor described by the first (commented) line. The time will always be written to the file, has always a divider of 1, and the complete number of data values. The other types can vary depending on the logger configuration. The data type is a string that defines the corresponding matlab data type.

# (Element Name) (Data Size In Bytes) (No Data Points) (Divider) (Buffer looping (1 or 0)) (Data Type)
/myLoggerNamespace/time_s 8 100 1 0
/myLoggerNamespace/time_ns 8 100 1 0
/myLoggerNamespace/myGroup1/myDataA 1 50 2 0 uint8
/myLoggerNamespace/myGroup1/myDataB 8 50 1 1 double
/myLoggerNamespace/myGroup2/myDataC 4 10 5 0 single
/myLoggerNamespace/myGroup2/myDataD 2 25 4 1 int16

Note:

  • myDataA has 1 byte, a divider of 2 and could save all data (100/2=50), thus the bufferSize >= 50 and not looping. It can be parsed as a uint8 in matlab.
  • myDataB has 8 bytes, a divider of 1 and could not save all data (100/1=100 > 50), thus the bufferSize = 50 and looping. It can be parsed as a double in matlab.
  • myDataC has 4 bytes, a divider of 5 and could not save all data (100/5=20 > 10), thus the bufferSize = 10 and not looping. It can be parsed as a single in matlab.
  • myDataD has 2 bytes, a divider of 4 and could save all data (100/4=25), thus the bufferSize >= 25 and looping. It can be parsed as a int16 in matlab.

This information is enough for lossless parsing of the binary data. The time has to be matched differently depending on the buffer type.

Binary Data

The third part of the file lists the complete binary data of all log elements.

# Binary Data

The binary data is written in the order of the header. The first SizeInBytesElement1*NrDataElement1 bytes correspond to the first element and so on.
Considering our header:

  • The first 800 bytes are the time in seconds
  • The second 800 bytes are the time in nanoseconds
  • The next 50 bytes are myDataA
  • The next 400 bytes are myDataB
  • The next 40 bytes are myDataC
  • The last 50 bytes are myDataD

Parse the log file with Matlab

A Matlab script that enables you to plot the logged data is provided in signal_logger_std/matlab/processData.m. The script is documented and should therefore be self-explanatory.