Set threshold not working for configure any motion for Bma255Accelerometer
Im trying to only log data if the tracker hits a threshold of 1g. However it seems like even if i move it a few cm it logs an anymotion value.
As per my understanding the set threshold method in configureAnyMotionDetection is in Gs (https://mbientlab.com/docs/metawear/android/2/com/mbientlab/metawear/module/Bmi160Accelerometer.AnyMotionConfigEditor.html)
I am using version 2.8.6 of the android api.
Below is my configuration code, Id be grateful for any inputs on what might need to be changed for setThreshold to work.
Bma255Accelerometer accModule = mwBoard.lookupModule(Bma255Accelerometer.class);
accModule.configureAnyMotionDetection()
.setThreshold(1.0f).commit(); //
accModule.enableMotionDetection(Bma255Accelerometer.MotionType.ANY_MOTION);
accModule.routeData()
.fromMotion()
.log(ACC_STREAM_KEY)
.commit().onComplete(accelerometerHandler);
final AsyncOperation.CompletionHandler<RouteManager> accelerometerHandler = new AsyncOperation.CompletionHandler<RouteManager>() {
@Override
public void success(RouteManager result) {
Log.i(TAG, "Received acc log id:" + result.id());
editor.putInt(mwBoard.getMacAddress() + ACC_STREAM_KEY, result.id());
editor.commit();
mwBoard.lookupModule(Bma255Accelerometer.class).start();
}
@Override
public void failure(Throwable error) {
Log.i(TAG, "Adding accelerometer route timed out");
error.printStackTrace();
}
};
This discussion has been closed.
Comments