react-native-griswold is specifically for the measurment of driving behaviours.
We do this by reading the device sensors (e.g. accelerometer values), and determine if a notable event has occured. If so, we send the event type, and values over the bridge to JS.
Run yarn add react-native-griswold
in your project folder.
import {griswold} from 'react-native-griswold';
// setup listener within your component
useEffect(() => {
const subscription = griswold.subscribe(event => {
// Use values
console.log('>>>>event: ', event);
});
return () => {
subscription.unsubscribe();
};
}, []);
- HARD_BRAKE
- SHARP_LEFT
- SHARP_RIGHT
(to be continued...)
The events are sent based on x,y,z values read from the accelerometer. The specific values are based on the thersholds measured and identified in the book "Beyond the Internet of Things".
Recognizing Driving Behaviour Using Smartphones Prokopis Vavouranakis, Spyros Panagiotakis, George Mastorakis, Constandinos X. Mavromoustakis and Jordi Mongay Batalla
The phone must be placed flat, with the screen facing up. The device must be orientated in the same direction of the vehicle, i.e. the phone camera closer to the windscreen.
- This limitation is temporary until we account for the device orientation in our calibration step and apply it to our accelerometer values.