Sensor Fusion Raw Data Sampling Rates
I just collected some accelerometer and gyroscope data, together with quaternions, using the android API and the sensor fusion NDoF mode.
Based on the number of samples received and the accompanying timestamps, I get a sampling rate of 67.4Hz for the accelerometer and 62.7Hz for the gyroscope, which is significantly less than the 100Hz for both sensors you state in the docs.
The relevant part in my code for data collection (sensor rate calculation is done using the counters and timestamps) is the following:
sensorFusion = mwBoard.getModule(SensorFusion.class);
sensorFusion.configure().setMode(SensorFusion.Mode.NDOF).setAccRange(SensorFusion.AccRange.AR_8G)
.setGyroRange(SensorFusion.GyroRange.GR_1000DPS).commit();
sensorFusion.routeData().fromQuaternions().stream("quaternion").commit()
.onComplete(new AsyncOperation.CompletionHandler<RouteManager>() {
@Override
public void success(RouteManager result) {
result.subscribe("quaternion", new RouteManager.MessageHandler() {
@Override
public void process(Message msg) {
quatMessages.add(msg);
}
});
sensorFusion.start(SensorFusion.DataOutput.QUATERNION);
}
});
sensorFusion.routeData().fromCorrectedAcc().stream("acceleration").commit()
.onComplete(new AsyncOperation.CompletionHandler<RouteManager>() {
@Override
public void success(RouteManager result) {
result.subscribe("acceleration", new RouteManager.MessageHandler() {
@Override
public void process(Message msg) {
aCount += 1;
aTimestmps.addLast(msg.getTimestamp().getTimeInMillis());
accMessages.add(msg);
}
});
sensorFusion.start(SensorFusion.DataOutput.CORRECTED_ACC);
}
});
sensorFusion.routeData().fromCorrectedGyro().stream("gyro").commit()
.onComplete(new AsyncOperation.CompletionHandler<RouteManager>() {
@Override
public void success(RouteManager result) {
result.subscribe("gyro", new RouteManager.MessageHandler() {
@Override
public void process(Message msg) {
gCount += 1;
gTimestmps.addLast(msg.getTimestamp().getTimeInMillis());
gyroMessages.add(msg);
}
});
sensorFusion.start(SensorFusion.DataOutput.CORRECTED_GYRO);
}
});
This discussion has been closed.
Comments