Stream Filtered Accelerometer Data
Hi,
I am trying to filter and stream filtered accelerometer data. Eventually I'd like to program the board to only store data from when the board is moving.
I very new to Java and Metawear, but from what I can tell I need to map or split the data before filtering. Can the full set of data (x, y and z) be streamed after satisfying filter conditions?
Here is the code I've got (adapted from the freefall tutorial which was super helpful!). Outputting "data.value(Acceleration.class)"in any form doesn't seem to work but doesn't give an error in the log
return accelerometer.acceleration().addRouteAsync(new RouteBuilder() {
@Override
public void configure(RouteComponent source) {
source.map(Function1.RSS).average((byte) 4).filter(ThresholdOutput.ABSOLUTE,1f,0.01f)
.multicast()
.to()
.stream(new Subscriber() {
@Override
public void apply(Data data, Object... env) {
Log.i("freefall", "move");
Log.i("freefall", String.valueOf(data.value(Acceleration.class).x()));
CONTENT = CONTENT + "\n" + data.formattedTimestamp() + "," + data.value(Acceleration.class).toString();
}
})
.end();
}
});
I'm using a metawear C with the latest firmware on a samsung galaxy s 6 edge.
Thanks!
-Tom
This discussion has been closed.
Comments