Step detection XML

From University of Washington - Ubicomp Research Page
Revision as of 00:57, 10 July 2008 by Ryan Libby (talk | contribs) (explanation down to fft mill)

Jump to: navigation, search

The WorkDag contains the description of the dataflow. Its immediate sub-elements are "mills," logical steps in the computation. The DAG may specify many inputs (sensor mills) but has only one output mill, specified by the WorkDag attribute resultCollectionName. <xml> <?xml version="1.0" standalone="no"?>

<WorkDag resultCollectionName="features"

       maxCheckupPeriod="1000000" >

</xml> We instantiate the accelerometer sensor mill. All sensor mills use only the UPDATE_UNCONDITIONAL update policy. The sample period is given in microseconds. Note that this sample period is only a cross-check; it is ultimately determined by msb-server from /msp/msb.ini. 1953 μs corresponds to 512 Hz. <xml>

 <Sensor name="accel"
         updatePolicy="UPDATE_UNCONDITIONAL"
         sampPeriod="1953"
 />

</xml> The accelerometer sensor mill is a MillMo with three outputs per sample—the x- y- and z-components of a 3-dimensional accelerometer reading. The first step of the algorithm takes the 1-dimensional magnitude of each reading. UPDATE_BY_SRC_PIGGYBACK causes a mill to be updated whenever its source mill is. <xml>

 <ShortMag name="accelmag"
         srcName="accel"
         updatePolicy="UPDATE_BY_SRC_PIGGYBACK"
 />

</xml> An FFT is applied over a sliding window to operate on the signal in the frequency domain. Together, UPDATE_BY_NUM_NEW_SRC_SAMP and numSrcSampPerUpdate="1024" specify that accelmag_fft is updated once for every 1024 samples of input. (At every update, it produces one output record.) However, numSrcSampRqd="2048" indicates to accelmag_fft that the FFT is to be performed over the last 2048 samples. Thus its output windows overlap by half. This is required later for smoothing out the inverse FFT after a dynamic filter is applied.

This mill is sensitive to the sample rate. For example, to cut the sample rate in half from 512 Hz to 256 Hz and have this mill operate over the same window length (in time), numSrcSampPerUpdate and numSrcSampRqd would also need to be cut in half. <xml>


 <Fft16 name="accelmag_fft"
         srcName="accelmag"
         updatePolicy="UPDATE_BY_NUM_NEW_SRC_SAMP"
         numSrcSampPerUpdate="1024"
         numSrcSampRqd="2048"
 />

</xml> <xml>

 <EnergyThreshold name="accelmag_fft_thresholded"
         srcName="accelmag_fft"
         updatePolicy="UPDATE_BY_SRC_PIGGYBACK"
         threshold="250000"
 />
 <EnergyFilter name="accelmag_fft_filtered"
         srcName="accelmag_fft_thresholded"
         updatePolicy="UPDATE_BY_SRC_PIGGYBACK"
         threshold=".16"
 />
 <Fft16I name="accelmag_smooth"
         srcName="accelmag_fft_filtered"
         updatePolicy="UPDATE_BY_SRC_PIGGYBACK"
         overlap="1"
 />
 <IntegerFirFilter name="deriv"
         srcName="accelmag_smooth"
         updatePolicy="UPDATE_BY_NUM_NEW_SRC_SAMP"
         numSrcSampPerUpdate="1" >
   2 1 0 -1 -2
 </IntegerFirFilter>
 <ZeroCross name="peaks_max"
         srcName="deriv"
         updatePolicy="UPDATE_BY_SRC_PIGGYBACK"
         edge="falling"
 />
 
 <TimeDiffLim name="peaks_max_sane"
         srcName="peaks_max"
         updatePolicy="UPDATE_BY_SRC_PIGGYBACK"
         minSamps="16"
         maxSamps="512"
 />


 <WinSum name="steps_05s"
         srcName="peaks_max_sane"
         updatePolicy="UPDATE_BY_NUM_NEW_SRC_SAMP"
         numSrcSampPerUpdate="128"
         windowLength="2560"
 />
 <TimeDiffShort name="stridelength"
         srcName="peaks_max_sane"
         updatePolicy="UPDATE_BY_SRC_PIGGYBACK"
         windowLength="16"
         deltaMax="512"
 />
 <SplitShort name="stridelength_mean"
         srcName="stridelength"
         updatePolicy="UPDATE_BY_SRC_PIGGYBACK"
         componentName="mean"
 />
 <SplitShort name="stridelength_stddev"
         srcName="stridelength"
         updatePolicy="UPDATE_BY_SRC_PIGGYBACK"
         componentName="stddev"
 />


 <Collection name="debug"
         updatePolicy="UPDATE_BY_PERIOD"
         sampPeriod="1953" >
   <component name="accelmag" />
   <component name="accelmag_smooth" />
   <component name="deriv" />
   <component name="peaks_max_sane" />
 </Collection>
 <Collection name="features"
         updatePolicy="UPDATE_BY_PERIOD"
         sampPeriod="250000" >
   <component name="steps_05s" />
   <component name="stridelength_mean" />
   <component name="stridelength_stddev" />
 </Collection>

</WorkDag> </xml>