Skip to content
This repository was archived by the owner on Feb 17, 2023. It is now read-only.

Getting and Processing Log Data

danielbennettagility edited this page Jun 4, 2018 · 9 revisions

Every time the Cassie Real-Time Subsystem is run, log data is saved to the local hard drive of the target machine. This log data is overwritten after every run, so in order to get data off of the robot follow the steps on this page before running the Cassie Real-Time Subsystem again.

Creating a Blank SLRT USB

A blank SLRT USB has the Simulink Real-Time kernel, but no application. When booted from the target PC, the kernel will enable the development computer to connect through the Simulink Real-Time Explorer interface.

  1. Format a USB drive to make sure there is nothing on the drive already. This is most easily done through the Windows interface
  2. Start the Simulink Real-Time Explorer by typing slrtexplr in the Matlab command prompt
  3. Set up the CassieV3 target PC as specified in Setting Up Development PC
  4. Under Boot Configuration select Removable Disk as the boot mode
  5. Click the button to the right of the drop-down menu to create a boot disk, and select the blank USB drive from step 1

Copying Files from Target Computer

  1. Follow the procedure in Setting Up Development PC.
  2. Boot the target computer from the blank SLRT USB drive created in the previous step
  3. Start the Simulink Real-Time Explorer on the development computer
  4. Make sure all of the host/target settings are correct and match the settings used to create the blank SLRT USB
  5. Click the connect icon in the Targets section of the SLRT Explorer. The red light next to CassieV3 should turn green
  6. Double-click on the File System
  7. Right-click on the desired files on the target PC and select Copy to Host...
  8. Files can be copied to the target by dragging them into the file system window

Occasionally the SLRT Explorer may display an Invalid Port error when the file system is opened. If this happens, the connection can be reset by typing the following into the Matlab command prompt:

    tg = slrt;
    tg.close();

After resetting the connection, repeat steps 5-8 above. If the problem persists, check the target PC settings and reset the target PC.

Using MATLAB Command Window to Transfer Files

With large log data files, transferring via the Real-time Explorer can be inconvenient, as it will not notify you when transfer is completed. A better method is to use the MATLAB Command Window with the following commands. This will tie up the kernel until transfer is complete.

    tg = slrt;
    SimulinkRealTime.copyFileToHost(tg, 'file.dat')

'file.dat' should be replaced by whatever file you would like to transfer. The logging files generated by our code are named 'cassie#.dat' and 'user#.dat', where # increments depending on how many files were created. Due to an uncontrollable artifact of MATLAB's logging functions, Simulink will always create an extra file at max size filled with zeros, so you can ignore the log file with the highest number.

Copying data from a target with a model running

This process can also be performed on a target PC running any model. Make sure that the robot is not turned off after an experiment, as a reset will overwrite all of the log files. While the electronics are all still running (turn off motor power), connect Cassie to the development computer using an ethernet cable, and follow steps 5-8 above. The only difference is that there should be an application under the Applications section in the SLRT Explorer. Make sure that the application is stopped (press the stop icon) before transferring files.

Copying data from a target via USB drive

Alternatively, you can copy data using a batch script and FreeDOS on a USB flash drive. To do so, follow these steps:

  1. Create a FreeDOS bootable USB flash drive as described in Creating Standalone Application
  2. Copy doslfn.com to the USB drive
  3. Copy DataLogTransfer.bat to the USB drive
  4. Rename DataLogTransfer.bat to autoexec.bat
  5. Plug the USB drive into the target PC and turn it on
  6. When you hear consecutive beeps, the files have finished being copied to the LOGS folder on the flash drive and have been deleted from the target PC hard drive

This batch script will copy all .dat, .txt, and .bin files on the target hard drive to the LOGS folder of the flash drive. NOTE: This will also delete all log files, so make sure you back them up before erasing them from the flash drive

Processing Log Data

The Cassie Real Time Subsystem produces 4 different log files during operation: message.dat, energy.dat, outputs.dat, and inputs.dat. For quick plotting of the data, use the included '''loadFileScopeData''' function, which will plot all of the data as long as the log files are on the path. Note: this function will only work if the log files still have the default names.

Manual Data Processing

The log files are saved as Simulink Real-Time file scope data objects, which can be converted to a struct and then an array by executing the commands:

    fileScopeDataStruct = SimulinkRealTime.utils.getFileScopeData('file.dat');
    fileScopeDataArray  = fileScopeDataStruct.data;

Each variable in the log file is a column of the array, and the last column in the array is the time. I.e, the array is organized as follows:

    [ data1, data2, ..., dataN, time ]

Log File Structure

The signals which comprise each log file are listed below, in order. The number in brackets is the size of the signal in columns.

message.dat

  • Status messages[4]
    Status message enumeration is defined in the documentation for CassieState. Type doc CassieState in the command prompt

energy.dat

  • Battery voltage
  • Battery current

inputs.dat

  • Actual motor torques[10]

outputs.dat

  • Orientation quaternion[4]
  • Angular velocity[3]
  • Motor positions[10]
  • Motor velocities[10]
  • Joint positions[4]
  • Joint velocities[4]

Clone this wiki locally