Inertial log format
These files contain measurements of the acceleration, magnetic field and angular rotation rates measured throughout the trial. They are measured at a constant 100Hz sampling rate. These were measured using an SK6 SHAKE sensor pack, using the built in logging firmware to log directly to on-device flash. These files are the raw dumps extracted from the flash recording.
The data file is in ASCII format and has an entry on each line. Each field is a constant number of characters, and the data is comma seperated. Each entry consits of a timestamp and a sensor reading. The lines have the following structure:
$TIM,nnnnnnnnnnnnnn,$sss,xxxxx,yyyyy,zzzzz
- nnnnnnnnnnnnnn (14 chars) is the timestamp, in seconds since the epoch, to three decimal places, and is 14 characters long (11.3 format).
The absolute time isn't really useful, only the relative time since the start is important.
- sss (3 chars) Specifies the sensor for this reading. Either ACC (for accelerometer), MAG (for magnetometer) or ARS (for angular rate sensor (gyro)).
- xxxxx,yyyyy,zzzzz (5 chars each) Specifies the values for each of the three axes for the current sensor, as 4 digit integers, always with a leading sign (e.g. +0124,-0152,+0001).
Scales
- Acceleration values are in milliG (1000 = 1g)
- Magnetometer values are in milliGauss (1000 = 1G)
- Angular rate values are in tenths of degrees per second (3600 = 1 revolution per second / 60 RPM)
The sensor values should be reasonably well calibrated, but the angular rate sensor in particular is generally subject to significant drift.
Example
An example:
$TIM,1247663638.517,$ACC,-0185,+0011,+1033
$TIM,1247663638.517,$MAG,-0040,+0189,+0462
$TIM,1247663638.517,$ARS,-0136,-0081,-0037
The sensor readings are interleaved, and there should always be an ACC, MAG and ARS reading for each unique timestamp.
Parsing
parse_inertial.py is a simple Python script which will read a file in this format, and return three Numpy arrays (one for the accelerometer, one for the magnetometer and one for the gyroscope). This data will be a time-series with a fixed 100Hz sampling rate.
Example usage:
import pylab
acc, mag, gyro = sensors_to_array("trial-1-1_phone-3.txt")
# plot the first acceleration axis
pylab.plot(acc[:,0])