SensorFusion Logging
Hi folks,
I am trying to log the quaternion and linear acceleration data from the sensor fusion. But I have some problem with downloading the sensor data from the board. I am using a MetaMotion R board and have modified the metawear sample Android app 3.5.0. The problem is that the process method in the MessageHandler is never called and I receive only a lot of unknown entries in receivedUnknownLogEntry. Here are the relevant codes:
Any suggestions are greatly appreciated. Thanks!
protected void setup() {
sensorFusion.configure()
.setMode(SensorFusion.Mode.NDOF)
.setAccRange(SensorFusion.AccRange.AR_16G)
.setGyroRange(SensorFusion.GyroRange.GR_2000DPS)
.commit();
if (srcIndex == 0) {
sensorFusion.routeData().fromQuaternions().log("Q").commit()
.onComplete(new AsyncOperation.CompletionHandler<RouteManager>() {
@Override
public void success(RouteManager result) {
streamRouteManager= result;
result.setLogMessageHandler("Q", new RouteManager.MessageHandler() {
@Override
public void process(Message message) {
final Quaternion quaternion = message.getData(Quaternion.class);
LineData data = chart.getData();
data.addXValue(String.format(Locale.US, "%.2f", sampleCount * SAMPLING_PERIOD));
data.addEntry(new Entry(quaternion.w(), sampleCount), 0);
data.addEntry(new Entry(quaternion.x(), sampleCount), 1);
data.addEntry(new Entry(quaternion.y(), sampleCount), 2);
data.addEntry(new Entry(quaternion.z(), sampleCount), 3);
sampleCount++;
}
});
logModule.startLogging();
sensorFusion.start(SensorFusion.DataOutput.QUATERNION);
}
});
This discussion has been closed.
Comments
failure
function in the CompletionHandler object and log the error message if any is received. The code you have looks fine to me so the error could be from somewhere else.