CAR TRAJECTORY CORRECTION AND PRESENTATION USING GOOGLE MAPS CAR TRAJECTORY CORRECTION AND PRESENTATION USING GOOGLE MAPS

an opportunity to approve automatically corrected positions (automatically detected defective samples filtered using Kalman filters), define the parameters of the tracked object, everything in real-time using a web-service, GPS locator and online maps or from recorded position database. The paper is organized as follows: firstly, the Kalman filter algorithm is presented, the detection of defective sample conditions are described and then, the principle of retroactive correction is explained. Next, the pilot trial GPS tracking data samples collection is presented, and finally the web-service This paper describes a trajectory correction algorithm which calculates the kinetic parameters of the tracked object (car using GPS data from tracking device) and detects faulty GPS samples. Input parameters contain GPS geographical coordinates of the object and the times-tamp code of capturing the position. Based on these data and physical object limits, which the operator could modify, the algorithm decides if the sample is precise or faulty. In the case of faulty sample the algorithm suggests the estimated location of the point using Kalman filter implementation and the results are presented on the map using online web interface. When the operator confirms a predicted sample, the previous predicted (not confirmed samples) are recomputed using a backward correction algorithm. The final corrected trajectory is presented using a developed specialized interactive web interface with embedded Google maps API.


Introduction
The security forces tasks involve tracking of escaping mobile objects (man, car, motorcycle, etc.) whose position is scanned from a hidden GPS device and transmitted using MANET or infrastructure wireless network [1]. The operator of the dispatching centre or the security officer with mobile terminal needs to track the position of the suspicious object on the map, using the most accurate and reliable trajectory of the tracked object. The tracking application should give him an opportunity to correct detected (by the system) defective samples (according to the mobile object parameters and the calculated actual parameters). Next improvement is that the tracking application could offer the most probable trajectory approximation according to the physical probabilities of the observed object (weight, maximal acceleration, speed, turning radius). This work was motivated by solving a task in the 7 th Framework Programme project INDECT [2].
The problem of a simple route presentation on the map is that the GPS device inaccuracy is causing a wobble of the point on the screen [3]. The navigation devices are trying to put the point on the road (because they expect a decent vehicle), but the escaping car (followed by security forces) could use undocumented roads, or even sidewalks. Next approach is using so called "static GPS" which is presenting a new position only if the measured speed of the vehicle is larger than the defined limit (5 m/s), so the result is that the point on the map is "more static" [4] if it is not moving, but this is not this case. So we try to build a solution without relation to existing maps (road vector data were not used).
The application developed should be cross-platform and capable of using on wide range of mobile terminals so we decided to use web-application whose input samples are supplied from the GPS device of the tracked object with time stamp. The involved algorithms were first tested in the Matlab environment and then reprogrammed in PHP and JavaScript to be able to run independently from the operating system and without additional claims on operator's mobile terminal software [5].
This paper describes the final solution of interactive tracked object trajectory presentation. This solution gives the operator an opportunity to approve automatically corrected positions (automatically detected defective samples filtered using Kalman filters), define the parameters of the tracked object, everything in real-time using a web-service, GPS locator and online maps or from recorded position database.
The paper is organized as follows: firstly, the Kalman filter algorithm is presented, the detection of defective sample conditions are described and then, the principle of retroactive correction is explained. Next, the pilot trial GPS tracking data samples collection is presented, and finally the web-service c) maximum change in direction at a given speed -here, it is important to note that for low speed the object is limited by its maneuverability, and from calculated marginal speed (depends on weight -momentum) the object is limited by centrifugal force.
An important feature of the system is the backward correction. In principle, the correction is made using newly adopted correct samples after the detection of defective input data described below.
In Figure 1 the empty circles are properly measured and algorithm assessed as realistic position of the object. In point 3 defective samples are detected and the inaccurate data are removed using the predictor (algorithm) which predicts values for samples 4, 5 on the basis of the last samples (3, 2, 1, further previous samples). This prediction is shown in the picture for the sake of the clarity of the image. After the algorithm gets the correct value of another point confirmed by operator (point 6), it makes backward correction for the points 4 and 5 as follows [5]: 1) Recent correct samples (sample 6 was confirmed by the operator as correct using web-application) -points 3 and 6 are connected using a straight line and plotted points on it have been predicted (in this case points 4p, 5p) the distance between points 3 -4p -5p -6 are the same. 2) Next, using the Kalman filter, the coefficients of the filter in point 3 (which are characteristics of object movement in point 3) and using points 4p and 5p, the prediction is performed and subsequent correction of the points thus resulting in 4K and 5K. In this step it uses the object properties in point 3. 3) In the final step of the backward correction the algorithm connects the point 4K with the 4p and 5p with 5K using a straight line, and in the middle the points 4c and 5c are defined (presented on the web-application output -screen), as a result of backward correction (see Matlab simulation example in Fig. 2) [5].
trajectory presentation Google maps API based solution is described.

Kalman filter and object trajectory correction
In 1960, R. E. Kalman presented the recursive algorithm for linear discrete data filtering [6]. Since then, the Kalman filter is the subject of extensive research and applications, particularly in the area of self or assisted navigation [7]. This publication and the main conclusions, which are presented, were used to develop algorithms to predict the location of the tracked object.
Equations of predictions (updates in time) for the discrete Kalman filter are as follows (A -state transition model, B -controlinput model applied to the control vector u, R-Q noise): x Ax Bu where Pkis a priori error covariance matrix, P k-1 a posteriori error covariance matrix from previous state. And for the correction (updates from new measured samples from mobile object) the following equations are used: which implies that Kalman gain K k for the correction should be calculated first, then the a posteriori estimation xk t is computed.
The final step is to obtain a posteriori covariance matrix P k . Every time a posteriori correction is used as input from previous prediction for the current prediction of a new a priori prediction. The recursive principle is one of the main characteristics of the Kalman filter [8] and [9] and this algorithm is used for the trajectory correction described below.

Defective samples detection & backward correction
Detection of the defective sample is based on knowledge of the physical properties of the observed object which can be summarized as follows [10]: a) maximum speed -current speed is calculated as the distance of the last measured points divided by time between samples (or the average speed is calculated from the last 5 samples taken at short intervals, thereby reducing inaccuracy), b) maximum acceleration -change in velocity divided by time between samples for which the speed was calculated,

Developed web interface for tracked object position presentation based on Google maps API
The web interface was developed respecting the multiplatform usage of the presentation module for mobile devices of the operators in the field. After Matlab simulations of all developed algorithms, the equations were rewritten to PHP scripts which could do the calculations on the server side, with minimal requirements on the mobile device hardware.
The design and deployment of the solution is using web application, calculations are done on the server side using PHP scripts and the interaction with the operator and GUI (Graphical User Interface) is performed using JavaScript language. The map resources were solved using evaluation license for Google maps [13] and their application programming (API) interface with registered API key [14].
In Fig. 4 you can see the web interface of the monitored objects location where the operator has a large number of options: Fig. 4 Options of the web interface on the left side of the screen 1. Set how many points will be displayed on the map ("none/all/ last 5" -choose a bullet). 2. Determine the maximum speed and acceleration of the object ("max spe" / "max acc") or set it using JavaScript input field by clicking on the displayed numbers. 3. Can allow automatic updating of the map when a new sample arrived or slide display trajectory manually ("auto" / "manual update"). 4. Can save the corrected trajectory in a defined format (small icon in the upper right corner of "AutoSave" in the table in Fig. 4). 5. Replay the saved trajectory from external/internal XML file (not visible in Fig. 4).

Trajectory measurements
Realistic trajectories were measured using a specialized GPS device GPSMAP 60CSx (Fig. 3) -navigation device that is equipped with a sensitive GPS module. Using this device a set of measure actions were taken saving a trajectory of the buses in public transport of city Kosice to the internal flash card and data was copied to the server for simulation purposes. There were 4 trajectory measurements done as you can see in the table depicted in Fig. 4.
In the final solution the system is able to replay the recorded trajectory, or tracking the observed object in the real time as the data will arrive using a wireless network communication infrastructure developed in another project [11].
The device allows recording the route travelled and storing it in GPX format (location and time stamp for each reading sample). This allows simulation of actual conditions when using the proposed system [12].
We choose a time interval 5s for recording the travelled tracks. This is the time interval that is also used to update the position on the web interface. Fig. 3 GPSmap 60CSx device a possibility to restart the simulation from loaded XML file is depicted ("reset simulacie").

Conclusion
In our system the trajectory correction of mobile objects (GPS tracked and coordinates transferred to the server in realtime) and final trajectory presentation using Google maps API have been implemented. The system allows the deployment on the server that receives data from location sensors of monitored objects, provides a multi-user interface with easy object tracking (thanks to unified interface), detection of the faulty samples, proposal of a predicted sample, correction of the faulty sample confirmation by the operator and subsequent backward correction of the trajectory (of the detected faulty samples). The resulting trajectory can be archived and played back (from the XML file). This system represents an important contribution to the presentation of position in real applications and is suitable also for modern mobile devices (tablets, smartphones, etc.).
We plan to increase the security of the transferred data in WLAN [15] and mobile ad-hoc networks environment [16] using recently developed algorithms to ensure the privacy of the transferred data for security forces applications. Recently, also work on integration of the acoustic event detection module [17] for indicating gunshots or explosions on the map and a speech interface [18 and 19] has started. 6. Set auto zoom the map so that the entire visible trajectory of all objects displayed (depending on configuration in 1) should be visible. 7. Creating a RSS channel (link to it -"Link to RSS" in Fig.  5) with corrected samples (detected as defective and the operator confirmed the correction). The operator can also see a description of the observed objects, their location on the map (using the proposed new icons -designed in our laboratory), the last time the samples were obtained when the last time the calculation of corrections using the Kalman filter was performed, etc. The map in Fig. 5 is developed using official Google maps API for educational purposes [14]. Below the map also