Accelerometer reading stream data
Hi, I'd like to read stream data from the accelerometer (something like in the iOS sample app) but I don't receive anyting on acclerometer.callbak.
I would also like to receive stream freefall event or accelerometer data filtered after high pass data filter douring streaming data.
Here is my code snippet
private ServiceConnection mServiceConnection = new ServiceConnection() {
@Override
public void onServiceDisconnected(ComponentName name) {
mServiceBound = false;
}
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
mwService = ((MetaWearBleService.LocalBinder) service).getService();
mwController = mwService.getMetaWearController();
mServiceBound = true;
mwController.addModuleCallback(accelCallback);
Accelerometer accelCtrllr= (Accelerometer) mwController.getModuleController(Module.ACCELEROMETER);
accelCtrllr.enableTapDetection(TapType.SINGLE_TAP, Axis.Z);
accelCtrllr.enableFreeFallDetection();
accelCtrllr.startComponents();
}
};
private ModuleCallbacks accelCallback = new Accelerometer.Callbacks() {
@Override
public void receivedDataValue(short x, short y, short z) {
super.receivedDataValue(x, y, z);
Log.d("accelCallback", "receivedDataValue");
}
@Override
public void singleTapDetected(MovementData moveData) {
super.singleTapDetected(moveData);
Log.d("accelCallback", "singleTapDetected");
}
};
Actually if I tap or move the metawear board I don't receive anything. I double checked the board or the battery level with the iOS app and everything is ok.
Thanks
I would also like to receive stream freefall event or accelerometer data filtered after high pass data filter douring streaming data.
Here is my code snippet
private ServiceConnection mServiceConnection = new ServiceConnection() {
@Override
public void onServiceDisconnected(ComponentName name) {
mServiceBound = false;
}
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
mwService = ((MetaWearBleService.LocalBinder) service).getService();
mwController = mwService.getMetaWearController();
mServiceBound = true;
mwController.addModuleCallback(accelCallback);
Accelerometer accelCtrllr= (Accelerometer) mwController.getModuleController(Module.ACCELEROMETER);
accelCtrllr.enableTapDetection(TapType.SINGLE_TAP, Axis.Z);
accelCtrllr.enableFreeFallDetection();
accelCtrllr.startComponents();
}
};
private ModuleCallbacks accelCallback = new Accelerometer.Callbacks() {
@Override
public void receivedDataValue(short x, short y, short z) {
super.receivedDataValue(x, y, z);
Log.d("accelCallback", "receivedDataValue");
}
@Override
public void singleTapDetected(MovementData moveData) {
super.singleTapDetected(moveData);
Log.d("accelCallback", "singleTapDetected");
}
};
Actually if I tap or move the metawear board I don't receive anything. I double checked the board or the battery level with the iOS app and everything is ok.
Thanks
This discussion has been closed.
Comments
I reviewed my code and I found that somehow I forgot to implement the MetaWearBroadcastReceiver.
I've some more questions with tha accellerometer.
The isFreeeFall feature is now deprecated. I've implemented movementdetected wich receives MovementData. During freeFall I receive the movementdetected callback but I can't find any documentation in the 1.0.8 version of docs-api on your website regarding MovementData. Shall I assume that if I receive movementdetected is only FreeFall?
From the sample app I've found how to read stream data
samplingConfig.withFullScaleRange(FullScaleRange.values()[dataRange])
.withOutputDataRate(OutputDataRate.values()[samplingRate]);
but in the docs I can't find FullScaleRange or OutputDataRate
Could you please also give some example on how to set the highPassFilter to a particular G force?
Have you sheduled some demo app or project that show hot to use highPassFilter ?
I'd like to be notified only if the metawear board receive an impact( calculated as rms like in the link above or on at least one axys) greater than 3 or 4g. I thought that the high pass filter could be the right way to achive this but I am not able to implement it.
Could be something like a tap. Wich is the force needed to the tap to be triggered?