addRouteAsync fails when adding account() to RouteComponent
Board: MetaMotion R
FW: 1.3.6.
Android Compile SDK: 27
SDK: 3.3.0
======================================
I try to use account() on my RouteComponent. Removing account() leads to everything working correctly. I configure the board in this function to output quaternions:
private Task<Route> configure() {
sensorFusion = board.getModule(SensorFusionBosch.class);
sensorFusion.configure()
.mode(SensorFusionBosch.Mode.IMU_PLUS)
.accRange(SensorFusionBosch.AccRange.AR_8G)
.gyroRange(SensorFusionBosch.GyroRange.GR_1000DPS)
.commit();
dataProducer = sensorFusion.quaternion();
//Send quaternions to stream route
return dataProducer.addRouteAsync(new RouteBuilder() {
@Override
public void configure(RouteComponent source) {
source.account().stream(new Subscriber() {
@Override
public void apply(Data data, Object... env) {
Log.i("ts", data.toString());
Quaternion q = data.value(Quaternion.class);
emitter.onNext(getMeasurement(data.timestamp().getTimeInMillis(), new float[]{q.w(), q.x(), q.y(), q.z()}));
}
});
}
});
}
I call and evaluate the returned task like this:
configure().onSuccess(new Continuation<Route, Object>() {
@Override
public Object then(Task<Route> task) throws Exception {
if(task.isCompleted()) {
Log.i("task", "yay");
dataProducer.start();
sensorFusion.start();
}
return null;
}
}).continueWith(new Continuation<Object, Object>() {
@Override
public Object then(Task<Object> task) throws Exception {
if(task.isFaulted()) {
Log.i("task", "we faulted!!");
}
return null;
}
});
This discussion has been closed.
Comments
If you need accurate timestamps, you will have to log the data.