How to get linear acceleration and other sensor fusion modules
I am trying to get other sensor fusion modules working besides Quaternion. Here is my code for trying Linear acceleration.
view.findViewById(R.id.sensorFusion_start).setOnClickListener(v -> {
'''final SensorFusionBosch sensorFusion = metawear.getModule(SensorFusionBosch.class);
final CancellationTokenSource cts = new CancellationTokenSource();
sensorFusion.configure()
.mode(SensorFusionBosch.Mode.NDOF)
.accRange(SensorFusionBosch.AccRange.AR_16G)
.gyroRange(SensorFusionBosch.GyroRange.GR_2000DPS)
.commit();
sensorFusion.linearAcceleration().addRouteAsync(source -> source.stream((Subscriber) (data, env) ->
{
Log.i("Linear", "Linear Acceleration = " + data.value(Accelerometer.class));
})).continueWith((Continuation<Route, Void>) task ->
{
sensorFusion.linearAcceleration().start();
sensorFusion.start();
return null;
});'''
Comments
Accelerometer
is not a valid data value class. Refer to the data type table in the documentation:https://mbientlab.com/androiddocs/3/sensor_fusion.html#data
Thanks!