X Axis and Comparison Filter
I have the following code. I'm trying to filter on the X axis and only send data when it's about value Y (absolute value comparison).
When I use the pass through filter I see values between -1000 and 1000. This makes sense. As soon as I add the comparison filter, things get weird. I'll see values of 1, 95, 55, etc, and it seems pretty random.
Any ideas? Something tells me the comparison filter is not working?
Accelerometer accelModule= mwBoard.getModule(Accelerometer.class);
accelModule.setOutputDataRate(10.0f);
accelModule.setAxisSamplingRange(4.0f);
accelModule.enableAxisSampling();
accelModule.routeData().fromXAxis()
//.process(new Passthrough(Passthrough.Mode.ALL, (short) 0))
.process(new Comparison(Comparison.Operation.GTE, 700, false))
.stream("accel_x_stream_up")
.commit().onComplete(new AsyncOperation.CompletionHandler() {
@Override
public void success(RouteManager result) {
result.subscribe("accel_x_stream_up", new RouteManager.MessageHandler() {
@Override
public void process(Message msg) {
short unscaled = msg.getData(Short.class);
Log.i(LOG_TAG, "X-Axis= " + (unscaled));
}
});
}
@Override
public void failure(Throwable error) {
Log.i(LOG_TAG, "error: " + error.toString());
}
});
This discussion has been closed.
Comments