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

Getting and Processing Log Data

patrickclaryagility edited this page Jun 12, 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 all of the files under DataLogTransfer to the root of the USB drive
  3. Plug the USB drive into the target PC and turn it on
  4. 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

Reading Log Files

Cassie log files can be read using the CassieLog class, by either passing the filename to the constructor or calling the CassieLog.load(filename) method. The CassieUserIn and CassieOut bus structures are logged in a packed format at the real-time rate. All floating-point data is converted to single precision when logging. Data from individual bus fields can be examined using the CassieLog.getField method.

As an example, to plot the accelerometer readings throughout the duration of the run, one would run:

log = CassieLog('CASSIE1.DAT');
plot(log.getTime, log.getField('out.pelvis.vectorNav.linearAcceleration'));

Multiple files from the same run can be concatenated by calling CassieLog(["CASSIE1.DAT" "CASSIE2.DAT"]). Other types of log files can be read using SimulinkRealTime.utils.getFileScopeData.

Clone this wiki locally