Logger

Untitled-1_swfRecords and plays back data streams

The Logger widget is used to collect a stream of data and record it to a file, and later play back that data. Once the widget has a data file (in CSV format) Logger can act as a source of data for other widgets, playing back the data in the file at the original speed, or a slower or faster speed specified in parameters.

For example, the widget can listen to an AnalogIn widget, and record data coming from a knob. Once recorded, the widget could listen to any input, but instead of recording the data from that input, it can play back the original recorded data when triggered by a threshold value from the input. This playback of data could then drive a ClipControl widget to control the motion of a graphic.

AnalogInput -> Logger -> ClipControl

The Logger widget also has the same capabilities as the Code widget for inserting AS3 code.

On Screen Features

  • in – The value received from the inputSource
  • out – By default, the IN value is passed directly to the OUT. If playBackTrigger is checked, the input values will be used as a trigger for playback of recorded data in a file.
  • record button – Starts and stops recording of values from the inputSource (including values feed by ActionScript via insertOutput())
  • play button – Plays back values from the “dataFile” as set in the parameters. Values can be processed by ActionScript using the insertInput function.

Parameters

  • dataFile – The name of the file in the directory of the Flash file that data logging values will be recorded into and played back from.
  • inputSource – the instance name of the source the widget listens to, e.g AnalogIn or DigitalIn.
  • invisible – if set to “yes”, the widget will disappear when the Flash movie is run
  • playbackLoop – If set to true, log playback will loop forever.
  • playbackSpeedX – A multiplier for the speed of playback for data logging. For example if playbackSpeedX is set to 2, the values will play back in sequence at twice the rate that they were recorded. Numbers less than 1 can be used to play back at speeds slower than real time – e.g. a value of 0.5 would play the sequence of values at half speed.
  • playbackTrigger – If set to true, values from the inputSource will not be processed normally, but instead the widget will begin playback of the data log values in in the dataFile when the threshold of 500 is reached.
  • playFromFirstTime – If set to true, playback of data will start relative to the timestamp of the first entry in the dataFile. This allows you to remove entries from a file in an editor and have playback start immediately from the remaining first entry in the file. If set to false, playback will start at zero time, and play each entry in the dataFile based on it’s actual timestamp.
  • recordSampleRate – This number determines how often data log values will be recorded, in milliseconds. For example, if set to 30, values will be recorded every 30 thousandths of a second (about 30 times per second). Or if set to 3000, then a value will be recorded every 3 seconds.
  • recordSparse – If set to true, data log values will only be recorded when they change. So if the same value came into the Code widget for 10 seconds, no data would be recorded until after a different value came in. Setting this will help keep the dataFile smaller, and playback will be exactly the same since each data value is played back according to its time-stamp.

Code Interface

These are the code interfaces available for the Code widget:

myLogger.startPlay();

When called, the Insert widget will start playing a recorded log.

myLogger.stopPlay();

When called, the Insert widget will stop playing a recorded log.

myLogger.startRecord();

When called, the Insert widget will start recording a log.

myLogger.stopRecord();

When called, the Insert widget will stop recording a log.

Data logging notes

The recorded values and time-stamps are stored in a comma separated file that can be imported into a spreadsheet – each data point is on a line in the file and contains four values:

  • data value
  • milliseconds since the start of recording
  • date and time stamp
  • name of the widget that created the log

For example, here are the first 5 data points from a recording:

0,31,2011-03-25 17:51:33:635,myLogger
184,1362,2011-03-25 17:51:34:965,myLogger
347,1431,2011-03-25 17:51:35:034,myLogger
490,1468,2011-03-25 17:51:35:071,myLogger
582,1493,2011-03-25 17:51:35:096,myLogger
643,1531,2011-03-25 17:51:35:134,myLogger

 


Last modified December 26th, 2013