tracking driver behaviors - binghamtonmsha/426526/2017driving behavior.pdf · android applications,...

5
Tracking Driver Behaviors Extended Abstract Onur Ozkaraman 68 Murray St Apt:2 Binghamton, N.Y. 13905 +1 631 903 01 83 [email protected] Anil Algur 15 Chenango St. Binghamton, N.Y. 13902 United States [email protected] Yigit Gullu 68 Murray St Apt:2 Binghamton, N.Y. 13905 United States [email protected] ABSTRACT This paper aims to track driver’s behavior while they are driving their personal or commercial cars. Using gyroscope and accelerometer sensors inside an android phone, merged with an applicaTon which receives sensor values once the phone is calibrated in a standard posiTon. We do not intend to employ machine learning to train something by checking driver’s behavior by understanding them. The problem is we don’t have Tme to apply the machine learning and we implemented an algorithm to detect mistakes and errors of drivers. Today, most of the cars have their own ability to track down their user’s behavior in some specific ways. Such as using wireless network sensors to deal with gas pedal accelerometer, fuel consumpTon, weather calculator, air filter sensors, oil sensors and so on. All these sensors based on to warn driver if any change occur during driving to help driver to prevent major damages. KEYWORDS Driver, driver’s behavior, behave calculator, AppOY, tracker, TrackmyDriver, 1 INTRODUCTION Researches made by developers in past 8 years, Android showed up and increase its usability by also improving the usage of gyroscope and accelerometer sensor. With the increase of the android applications, people started to use android applications related to tracking walking distance, driving speed, location, weather. Also, gaming industry uses gyroscope sensors to let user play the game much more sensitive. After analysing all these applications, we come up with the idea to build up an android app which contains both sensors in it and use these sensor values with an specific algorithm which can detect the sharp turns and acceleration of the user. Figure 1. Android Studio Logo 2 ARCHITECTURE & DESIGN 2.1 Design Dependencies There are several design dependencies in our project which includes SDK versions, Java versions and Android Studio versions. The project needs the minimum SDK of Android 5.0 Lollipop and it is compatible in newer versions. The android studio was chosen as IDE for many reasons. One of the major reason is the compilation is easy and fast compared to another IDE’s like Intellij. The creation of virtual devices is much more reliable than other. Also; It gives two options for running the application. The application can be run on either default virtual device or virtual device with software rendering. This gives the advantage of testing many components (adds testing variety) and enable much faster development progress. The main design issue is about using two sensors simultaneously. These sensors are accelerometer sensor and gyroscope sensor. Both sensors have significant roles in determining status of vehicle and produces relative outputs of vehicle motion. Understanding these sensor usage and outputs are crucial for design of the application.

Upload: others

Post on 18-Jul-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Tracking Driver Behaviors - Binghamtonmsha/426526/2017Driving Behavior.pdf · android applications, people started to use android applications related to tracking walking distance,

TrackingDriverBehaviorsExtendedAbstract†

OnurOzkaraman68MurrayStApt:2

Binghamton,N.Y.13905+16319030183

[email protected]

AnilAlgur15ChenangoSt.

Binghamton,N.Y.13902UnitedStates

[email protected]

YigitGullu68MurrayStApt:2

Binghamton,N.Y.13905UnitedStates

[email protected]

ABSTRACTThis paper aims to track driver’s behavior while they aredriving their personal or commercial cars. Using gyroscope andaccelerometersensorsinsideanandroidphone,mergedwithanapplicaTon which receives sensor values once the phone iscalibrated in a standard posiTon.We do not intend to employmachine learning to train something by checking driver’sbehaviorbyunderstandingthem.Theproblem iswedon’thaveTme to apply the machine learning and we implemented analgorithmtodetectmistakesanderrorsofdrivers.

Today,most of the cars have their ownability to trackdowntheir user’s behavior in some specific ways. Such as usingwirelessnetwork sensors todealwith gaspedal accelerometer,fuel consumpTon, weather calculator, air filter sensors, oilsensors and soon.All these sensorsbasedon towarndriver ifanychangeoccurduringdrivingtohelpdrivertopreventmajordamages.

KEYWORDSDriver, driver’s behavior, behave calculator, AppOY, tracker,TrackmyDriver,

1 INTRODUCTIONResearches made by developers in past 8 years, Android

showed up and increase its usability by also improving the usage of gyroscope and accelerometer sensor. With the increase of the android applications, people started to use android applications related to tracking walking distance, driving speed, location, weather. Also, gaming industry uses gyroscope sensors to let user play the game much more sensitive. After analysing all these applications, we come up with the idea to build up an android app

which contains both sensors in it and use these sensor values with an specific algorithm which can detect the sharp turns and acceleration of the user.

Figure1.AndroidStudioLogo

2 ARCHITECTURE&DESIGN

2.1 DesignDependencies

There are several design dependencies in our project which includes SDK versions, Java versions and Android Studio versions. The project needs the minimum SDK of Android 5.0 Lollipop and it is compatible in newer versions. The android studio was chosen as IDE for many reasons. One of the major reason is the compilation is easy and fast compared to another IDE’s like Intellij. The creation of virtual devices is much more reliable than other. Also; It gives two options for running the application. The application can be run on either default virtual device or virtual device with software rendering. This gives the advantage of testing many components (adds testing variety) and enable much faster development progress.

The main design issue is about using two sensors

simultaneously. These sensors are accelerometer sensor and gyroscope sensor. Both sensors have significant roles in determining status of vehicle and produces relative outputs of vehicle motion. Understanding these sensor usage and outputs are crucial for design of the application.

Page 2: Tracking Driver Behaviors - Binghamtonmsha/426526/2017Driving Behavior.pdf · android applications, people started to use android applications related to tracking walking distance,

Tracking Drivers Behavior AppOY

2

2.2 DesignInterface

The interface is built on Android Studio layout pages. There

are mainly 5 pages in the application. First one is the main page which is the default page appears when the application was opened. It has got the functionality to navigate through other pages. There are 4 ImageButtons on the main page. These are navigating to location page, measurement page, results page and calibration page. The location page gives current location of user. It uses Google API for determining current location. Measurement page is the page for determining driver behaviour. It measures accelerometer and gyroscope for generating outputs. Both sensors X, Y and Z values are displayed on the layout. After that measurement page inform driver about current average drive style and fuel consumption. Then user have the choice to start graph which illustrates dynamic graphic of driver’s actions. Next page is the result page which indicates number of suitable and not suitable actions of driver’s actions in alphanumeric format at text views. Also, there are two graphs shows the log of fuel consumption and driving actions in line graph format. Final page is the calibration page which has got a single operation. Sets sensor outputs to 0 and waits for getting system ready. (Specifically 4 seconds wait time).

Figure2. MainscreenoftheapplicaTon

Figure3. GoogleAPIshowsdriver’slocaToninthemap

3 IMPLEMENTATION

There are 6 classes in the Android Studio Project. Each class has its own purpose and implementation. The general structure and functionalities of each class will be examined in this report.

The first class is the main page. It contains 4 image buttons. The ImageButton has same functionality of a regular button but instead of displaying text on itself, it has certain format (.jpg, .png) images. The main page instantiates from AppCompat Activity and works for entire life cycle of the app, this will be studied in oncoming sections. Here is a snip of main activity class.

Figure 4. Main menu screenshot of the code

Page 3: Tracking Driver Behaviors - Binghamtonmsha/426526/2017Driving Behavior.pdf · android applications, people started to use android applications related to tracking walking distance,

Tracking Drivers Behavior AppOY

3

After Main page the measurement page is implemented. The

class MeasureAccAndGyro is responsible for dealing with sensor computations, handling outputs and exceptions. In order to define sensor measurements, first the sensor usage is researched and comprehended deeply. The accelerometergeneratesseveraloutputsbutweconcernspecificonesfortheapplicaTon.Therelatedoutputsofbothsensorsarevisualizedintheimagebelow.

Figure 5. VisualizedmeasurementdirecTonsofGyroscopeandAccelerometersensors

The both sensors measurement criteria were implemented. The

measurement process done in the @override method of onSensorChanged. The method must be implemented for every kind of sensor changes. The SensorManager object used for initializing both sensors and the decision of which sensor constitutes data therefore a separation condition was implemented as follows.

Figure 6. Discrimination of sensor data with sensor managers

By this discrimination, the sensor data will be processed individually. The project involves simultaneous working of both sensor outputs and computations. In order to enable computations and measurement at the same time we used AsyncTask’s. Simultaneous computations include adding sensor data, which is filtered by threshold values, into series and plotting a real time (dynamic) graph. On the following image, the usage and functionality of simultaneous work is demonstrated.

Figure 7. Implementation of dynamic graph

The graph indicates sensor outputs and their volume relative to time. A sample output of the application measurement is given in the chart below.

Figure 8. Table of sensor outputs relative to time and volume

Another implemented page is the result page. This page shows

the accuracy of the driver, past driver behaviour (aggressive, standard), fuel efficiency, good and bad driving counters to inform driver. Related computations are given in the following images.

300

5

XAxis YAxis ZAxis Time(secon

ds)

SensorVolum

e

ChartTitle

30 60 90

Page 4: Tracking Driver Behaviors - Binghamtonmsha/426526/2017Driving Behavior.pdf · android applications, people started to use android applications related to tracking walking distance,

Tracking Drivers Behavior AppOY

4

Figure 9. Computation of fuel consumption and driver action accuracy The other classes are about calibration and sharing variables like series across application. The calibration is responsible for clearing sensor outputs and setting their initial values to 0 to support measurement accuracy. It is the overall structure of the application. The .java files and their functionalities are explained in the report. The .xml files which are layout files are the UI part of the application and they are responsible from user interactions. These UI components were explained in the presentations.

Figure10.Runningappwiththereal-Tmegraphandperfectdriving

Figure11.Driverdrivesoverthethresholdvalues.Warnedwiththeredsign

4 RESULTSANDDISCUSSION In the result part the algorithm, definitions and possible outcomes of operations discussed. A part of the algorithm is illustrated as below.

Figure 12. Snapshot from algorithm

The Z axis changes are significantly higher than other outputs when the smart phone attached facing towards driver in a vertical position. Thus, the impact of Z axis will have a higher weight than other two outputs in the algorithm. Second most changeable axis is Y axis. It measures changes in the vertical motion. So, that axis is also considered during the development phase of algorithm. It is less significant than Z axis, however, while the difference in sensor outputs are taken both are considered depended on Pythagoras Theorem, and their square’s root are taken. This application developed ignored the changes in altitude due to the fact that the complexity increases dramatically and accuracy will fell. Thus, the changes in X axis are not considered.

Page 5: Tracking Driver Behaviors - Binghamtonmsha/426526/2017Driving Behavior.pdf · android applications, people started to use android applications related to tracking walking distance,

Tracking Drivers Behavior AppOY

5

As in the gyroscope sensor, the computation involves all kind of rotation coming from the sensor. Changes in all axis values has same amount of weight and computed evenly. The picture below contains information about the gyroscope algorithm.

Figure 13. Gyroscope sensor average The average difference is taken and compared to a certain threshold value (#3, approximately 45°) and it measures if the change is bigger than that threshold values in 2 second than the driver’s behaviour (turning vehicle) is a fault. The 2 seconds is the wait time of thread (AsyncTask) and the computation result at the end taken as sample data. Besides the structure of the algorithm there are small adjustments in the application to standardize outputs coming from driver’s actions. These adjustments are explained in related parts of the code in inline comments.

Figure14.Resultpageofthedrivingwithtotalaccuracy,averagefuelconsumpTonandgraphs

5 CONCLUSIONSIn this report, we have presented the analysis and

implementation of our AppOY Android project. To sum up, the Android Studio platform is used to build an application which uses accelerometer and gyroscope to measure whether driver’s actions are suitable for traffic level. We inform the driver by showing the red or green lights on the screen in regards of the accelerometer and gyroscope measurements. Driver also can see the effectiveness of the driving by looking the fuel consumption and the plotted graphs of measurements of sensors. There is also additional information for evaluation. Accuracy is calculated by looking the driving over or under the threshold values. We also use Google Maps in the application. So, driver can see his/her location without closing the application.

6 ACKNOWLEDGMENTS

ThanksforadvisingusontheprojecttoProfessorMoShaandDiMu.TheirhelpsledtoovercomesomeproblemsanddifficulTesduringtheimplementaTonphase.WealsothankourclassmatesforlisteningusbothpresentaTonsanddemos.Finally,thanksforallteammemberswiththeirgreateffortsandthecontribuTonsontheproject.

7 REFERENCES

[1]AndroidStudiohhps://developer.android.com/studio/intro/index.html[2]DriverBehavior-FuncTonalityOverviewhhp://www.nextraq.com/images/NexTraq-Driver-Behavior-FuncTonality-Overview.pdf [3]GoogleMapshhps://developers.google.com/maps/documentaTon/android-api/ [4]GelngMulTpleSensorDatahhp://stackoverflow.com/quesTons/12326429/get-mulTple-sensor-data-at-the-same-Tme-in-android[5]PythagorasTheoremhhp://www.mathcentre.ac.uk/resources/uploaded/mc-ty-pythagoras-2009-1.pdf