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);
}
});

Comments

  • You can't stream at a data throughput higher than 100-125Hz.  Use the on-board logger if you need to collect data from multiple high frequency sources.
  • Thank you for your fast reply Eric.

    Unfortunately, we want to do real time streaming, so logging is not really an alternative for us.

    Is there a possibility to use Processors to downsample the DataSignal streams fromCorrectedGyro, fromCorrectedAcc and fromQuaternions?

    We tried to do the following to introduce a Sample Preprocessor into the route (with the intention of reducing the sample rate to 50Hz), but this resulted in no messages at all being handled in the MessageHandler:

    // stream acceleration values from the board
    sensorFusion.routeData().fromCorrectedAcc().process(new Sample((byte) 2))
    .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) {
    Log.d("Receiver", "Acc received");
    aCount += 1;
    aTimestmps.addLast(msg.getTimestamp().getTimeInMillis());
    accMessages.add(msg);
    }
    });
    sensorFusion.start(SensorFusion.DataOutput.CORRECTED_ACC);
    }
    });
  • No, in the current firmware these is minimal support for data processing for sensor fusion data.  If you need to stream raw data, then simply stream the data directly from the corresponding module.  Use the sensor fusion algorithm if you need to retrieve quaternion values or euler angles.
This discussion has been closed.