Trouble logging data
Hi there,
I'm trying to log accelerometer and gyroscope data on the MetaMOTION R. It would be at a rate of 25Hz for roughly 20 minutes so I don't think memory is an issue. However, I can only get streaming to work. This is the code when logging starts:
mAccelerometer = mMetaWearBoard.getModule(AccelerometerBmi160.class);
mLogging = mMetaWearBoard.getModule(Logging.class);
mAccelerometer.configure()
.odr(25f)
.range(4f)
.commit();
mAccelerometer.acceleration().addRouteAsync(new RouteBuilder() {
@Override
public void configure(RouteComponent source) {
source.log(new Subscriber() {
@Override
public void apply(Data data, Object... env) {
Log.i("MainActivity", data.value(Acceleration.class).toString());
}
});
}
}).continueWith(new Continuation<Route, Void>() {
@Override
public Void then(Task<Route> task) throws Exception {
mLogging.start(true);
mAccelerometer.acceleration().start();
mAccelerometer.start();
return null;
}
});
This is the code when logging ends:
mLogging.stop();
mAccelerometer.stop();
mLogging.downloadAsync(100, new Logging.LogDownloadUpdateHandler() {
@Override
public void receivedUpdate(long nEntriesLeft, long totalEntries) {
Log.i("MainActivity", "Progress Update = " + nEntriesLeft + "/" + totalEntries);
}
}).continueWith(new Continuation<Void, Task<Void>>() {
@Override
public Task<Void> then(Task<Void> task) throws Exception {
Log.i("MainActivity", "Download completed");
return null;
}
});
mLogging.clearEntries();
mMetaWearBoard.tearDown();
I get the "Download completed" log but I'm not getting any of the log data. I'm also getting this warning from the Android logs after the download is 'completed'. Any help or advice would be appreciated.
06-01 14:10:26.188 15747-15781/wisdm.cis.fordham.edu.metaweardatacollection W/BluetoothGatt: Unhandled exception in callback
java.lang.NullPointerException: Attempt to invoke virtual method 'void bolts.TaskCompletionSource.setResult(java.lang.Object)' on a null object reference
at com.mbientlab.metawear.impl.LoggingImpl$4.onResponseReceived(LoggingImpl.java:260)
at com.mbientlab.metawear.impl.JseMetaWearBoard$5.onMwNotifyCharChanged(JseMetaWearBoard.java:579)
at com.mbientlab.metawear.android.BtleService$1.onCharacteristicChanged(BtleService.java:193)
at android.bluetooth.BluetoothGatt$1.onNotify(BluetoothGatt.java:443)
at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:399)
at android.os.Binder.execTransact(Binder.java:446)
at com.mbientlab.metawear.impl.LoggingImpl$4.onResponseReceived(LoggingImpl.java:260)
at com.mbientlab.metawear.impl.JseMetaWearBoard$5.onMwNotifyCharChanged(JseMetaWearBoard.java:579)
at com.mbientlab.metawear.android.BtleService$1.onCharacteristicChanged(BtleService.java:193)
at android.bluetooth.BluetoothGatt$1.onNotify(BluetoothGatt.java:443)
at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:399)
at android.os.Binder.execTransact(Binder.java:446)
This discussion has been closed.
Comments
addRouteAsync
task and see if it was successful.clearEntries
call.