Skip to content
Mike Wu edited this page Jan 13, 2014 · 1 revision

Step 1: Create a GaitAnalysis object

GaitAnalysis mGaitAnalysis = new GaitAnalysis(); or GaitAnalysis mGaitAnalysis = new GaitAnalysis(myCadenceDetector, myGaitClassifier);

where the second constructor call allows passing in customized algorithms. If only one of cadence estimation and gait classification requires customized algorithm, use the second constructor call and pass in null for the other parameter.

Step 2: Receive Sensor Events

Call registerListener(); for each type of sensor to allow SignalListener to receive sensor data.

SensorManager sensorManager;
SignalListener signalListener;
sensorManager.registerListener(signalListener,
    sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
    SensorManager.SENSOR_DELAY_FASTEST);

Step 3: Define Actions

Create an IGaitUpdateListener and register it with GaitAnalysis.

IGaitUpdateListener listener =
  new IGaitUpdateListener() {
    public void onGaitUpdated(GaitData data) {
       // define actions
    }
 }
};
mGaitAnalysis.registerGaitUpdateListener(listener);

Step 4: Start GaitAnalysis

mGaitAnalysis.startGaitAnalysis(2000, 1000); begins collecting sensor data and sending out result through gait update events. Default window size and sampling interval can be overridden by passing in their value as parameters: mGaitAnalysis.startGaitAnalysis(2000, 1000);.

Clone this wiki locally