Double Tap event false positives in 4.0+ GThreshold event

edited May 2017 in Hardware
Sensor: mBient Metawear C 


A double tap will often cause a 4.0+ or even 5.0+ GThreshold event when using this code to detect an accelerometer event exceeding a GThreshold of 4.0, I will call this implementation CustomGForceThresholdListener. This false positive GThreshold event always fires before the DoubleTap event listener  is called to handle what is actually a double tap.


MBLAccelerometerBMI160 *accelerometer = (MBLAccelerometerBMI160 *)device.accelerometer;
accelerometer.fullScaleRange = MBLAccelerometerBoschRange16G;



MBLEvent *gEvent = [device.accelerometer.zAxisReadyEvent changeOfEventAcrossThreshold:4.0 hysteresis:0.0 output:MBLThresholdValueOutputAbsolute];
[gEvent startNotificationsWithHandlerAsync:^(MBLNumericData *obj, NSError *error) {
bool deviceIsConnected = [[Device sharedInstance] deviceIsConnected];
NSLog(@Gforce Crossed Threshold!: %@", obj);

}];



Here is my implementation of "convenience" event MBLAccelerometerTapTypeDouble: 

 accelerometer.tapEvent.type = MBLAccelerometerTapTypeDouble; 
 [accelerometer.tapEvent startNotificationsWithHandlerAsync:^(id obj, NSError *error) {
NSLog(@Sensor Double Tapped);
[[NSNotificationCenter defaultCenter] postNotificationName:@deviceTap
object:self];

}];
 

Is there anyway I can prevent false positive DoubleTap events in what I call my CustomGForceThresholdListener implementation above?




**Information Only below, not seeking a solution, I share Italics only for Mbient's information, it is not currently relevant to the solution I seek.
The CustomGForceThresholdListener event listener above will NOT cause false positive DoubleTap events.

Yet, if I use my original implementation to listen to HighGThreshold events:

        accelerometer.lowOrHighGEvent.lowGEnabled = NO;
        accelerometer.lowOrHighGEvent.highGThreshold = self->_gForceThreshold;
        accelerometer.lowOrHighGEvent.highGEnabledAxis = MBLAccelerometerAxisX;
        
        [accelerometer.lowOrHighGEvent startNotificationsWithHandlerAsync:^(MBLDataSample *result, NSError *error) {
            NSLog(@G Shock Data: %@", [result csvRepresentation]);

        }];

Many false positive Double Tap events will trigger during the swing of a golf club with the sensor on top of the golf glove wearing hand of the golfer swinging. I have no idea why that would be, just sharing the information, I cannot use the lowOrHighGEvent because I need the actual gForce number of the movement, so I use my CustomGForceThresholdListener implementation above, which does not trigger false Double Tap events, and yes I know that statement does not seem logical but I can reproduce this time and time again)

Comments

This discussion has been closed.