Using KNN Algorithm Predictor for Data Synchronization of Ultra-Tight GNSS/INS Integration

: The INS system’s update rate is faster than that of the GNSS receiver. Additionally, GNSS receiver data may suffer from blocking for a few seconds for different reasons, affecting architecture integrations between GNSS and INS. This paper proposes a novel GNSS data prediction method using the k nearest neighbor (KNN) predictor algorithm to treat data synchronization between the INS sensors and GNSS receiver and overcome those GNSS receiver’s blocking, which may occur for a few seconds. The experimental work was conducted on a ﬂying drone over a minor Hungarian (M á ty á sföld, 47.4992 N, 19.1977 E) model airﬁeld. The GNSS data are predicted by four different scenarios: the ﬁrst is no blocking of data, and the other three have blocking periods of 1, 4, and 8 s, respectively. Ultra-tight architecture integration is used to perform the GNSS/INS integration to deal with the INS sensors’ inaccuracy and their divergence throughout the operation. The results show that using the GNSS/INS integration system yields better positioning data (in three axes (X, Y, and Z)) than using a stand-alone INS system or GNSS without a predictor. Author Contributions: Conceptualization, S.A.A., N.A.-H. and A.H.R.; methodology, S.A.A.; soft-ware, N.A.-H.; validation, N.A.-H., A.H.R. and T.Z.; formal analysis, S.A.A. and N.A.-H.; resources, T.Z. and G.C.; data curation, T.Z.; writing—original draft preparation, S.A.A. and A.H.R.; writing— review and editing, N.A.-H. and T.Z.; visualization, N.A.-H.; supervision, S.A.A., A.H.R. and G.C.


Introduction
The GNSS/INS (Global Navigation Satellite System and Inertial Navigation System) integrates an excellent navigation mechanism due to the INS's short-term accuracy when it interacts with the GNSS's long-term accuracy [1]. The INS is a self-contained system that can measure a vehicle's position, velocity, and attitude with reasonable short-term navigation accuracy. However, as the inertial measurement unit (IMU) veers, the INS navigation error exponentially increases in time, resulting in reduced navigation accuracy [2]. INS continuously calculates position, velocity, and attitude angles during GNSS signal loss for any reason. The main benefits of GNSS against INS are that GNSS globally operates and has higher data precision in all weather conditions. The GNSS, on the other hand, has a lower update rate than the INS, and the satellite signal can be lost or fragmented due to environmental circumstances, including mountains, high buildings, tunnels, and multi-path reflections [3,4].
GNSS has highly accurate guidance information, and INS has a continuously high update rate. These advantages of both stand-alone systems are merged. There are drawbacks as well, such as GNSS measurement's low update rate, the possibility of absence signal, and the IMU's drift characteristics in the INS. These drawbacks of both individual frameworks are addressed via the integration synthesis of GNSS/INS. So far, integration of the GNSS/INS framework has been usually established to determine the vehicle's position and attitude, which can be implemented by using a Kalman filter [5][6][7][8][9].
The GNSS/INS integration systems can be classified into tightly coupled (TC) and ultra-tightly coupled (UTC) integration architectures. The carrier tracking loops in (TC and LC) integration have a large enough bandwidth to retain tracking in the vicinity of drone manoeuvers. Data from the integrated navigation solution are fed back to the GNSS receiver in UTC integration to assist the carrier tracking loops. That results in decreasing the bandwidth of the carrier tracking loops, and, at the same time, it increases the signal-tonoise ratio (SNR) at the output of tracking loops, which leads to more immune systems against jamming and interference [10][11][12].
The problem in all the integration architectures mentioned above is that the INS data rate is higher than the GNSS data rate. Consequently, a predictor should be used to predict the in-between sampling instants of the GNSS receiver in order to synchronize with INS data before the integration process and overcome the GNSS receiver's stopping time (blocking data) when the signal is lost for a few seconds [12]. Hence, the prediction process benefits two important solutions: first, it gives a high GNSS data rate, and second, it overcomes the problems of GNSS lost signal.
Different prediction algorithms are used in the output of the GNSS or GPS receivers before integration with the INS data for synchronization purposes. In Reference [13], a method proposed to predict GPS data was shown by using a Normalized Least-Mean-Square (NLMS) algorithm. A different blocking time of GPS is taken to show the ability of the algorithms for GPS prediction data. In Reference [14], a comparison between the performance of Radial Basis Function Neural Networks (RBFNN) and Wavelet Neural Networks (WNNs) for GPS data prediction is presented. The results in this paper show that WNNs are more efficient than RBFNNs. Additionally, a carrier phase prediction method on baseband signal processing level to solve GNSS blocking signals in challenging environments was proposed in Reference [15].
Thus, the appropriate selection of the most effective algorithms depends on the purpose of the used technique and its adaptation. In this paper, the k nearest neighbor (KNN) predictor algorithm is used to predict in between sampling instants of GNSS receiver data based on actual GNSS data attributes. The KNN method uses the database to search for data that is similar to the current data. The obtained data are the so-called nearest neighbors of the current data. For the neighborhood classification, a KNN algorithm variant is used. In the case of KNN, when the k parameter is selected, various dataset properties need to be considered. The classification performance is a better choice of a bigger k value, as the effect of noise reduction, but at the same time, the classes will be closer to each other. Thus, the boundaries between the classes are less clear. KNN is a supervised learning algorithm where the training samples determine the classification rules without additional parameters [16]. KNN predicts the new GNSS data points based on the k training samples, which correspond to the measured GNSS data, and the output of the predictor is integrated with the INS data. The whole system is tested on data recorded with a real moving drone at the Mátyásföld airfield. Figure 1 represents the 3D trajectory of the moving drone. Electronics 2021, 10, x FOR PEER REVIEW 3 of 13 Figure 1. The 3D trajectory of the moving drone.

Mathematical Models for GNSS/INS Integration
GNSS/INS integration's main idea is to use the position information measured by GNSS to correct the INS drift errors [12].
The KNN predictor algorithm is used at the GNSS receiver's output to predict between samples instant of GNSS data for the synchronization purpose with INS.

K Nearest Neighbor (KNN) Predictor Algorithm
This algorithm's goal is to predict new GNSS data based on actual GNSS data characteristics. The position information is provided at 1Hz by the GNSS receiver. However, the system which integrates GNSS and INS measurements (see Figure 2) needs the information at 10 Hz. To fulfill this requirement, the predictor will estimate nine new data points at every measured point (for example, for a GNSS measurement at t = 6 s, the predictor provides data to t = 6.1, 6.2, ... 6.9 s). If the GNSS receiver is blocked, the predictor will produce estimates for a few seconds. The predictor needs four data points to produce the estimates. For example, at t = 6.1 s, these four preceding points are used for the estimation: t = 5.7, 5.8, 5.9, and 6 s.
The Euclidean distance between real GNSS data (testing data ( )), and training data ( ) is used in k nearest neighbor to compare the given testing data to training data; one of the similarity measures used is the Euclidean distance between testing data ( ) and training data ( ), as shown in Equation (1) [17]: where is X1, Y1, and Z1; and is X2, Y2, and Z2.

Mathematical Models for GNSS/INS Integration
GNSS/INS integration's main idea is to use the position information measured by GNSS to correct the INS drift errors [12].
The KNN predictor algorithm is used at the GNSS receiver's output to predict between samples instant of GNSS data for the synchronization purpose with INS.

K Nearest Neighbor (KNN) Predictor Algorithm
This algorithm's goal is to predict new GNSS data based on actual GNSS data characteristics. The position information is provided at 1Hz by the GNSS receiver. However, the system which integrates GNSS and INS measurements (see Figure 2) needs the information at 10 Hz. To fulfill this requirement, the predictor will estimate nine new data points at every measured point (for example, for a GNSS measurement at t = 6 s, the predictor provides data to t = 6.1, 6.2, . . . 6.9 s). If the GNSS receiver is blocked, the predictor will produce estimates for a few seconds. The predictor needs four data points to produce the estimates. For example, at t = 6.1 s, these four preceding points are used for the estimation: t = 5.7, 5.8, 5.9, and 6 s.
The Euclidean distance between real GNSS data (testing data (x test )), and training data (x train ) is used in k nearest neighbor to compare the given testing data to training data; one of the similarity measures used is the Euclidean distance between testing data (x test ) and training data (x train ), as shown in Equation (1) [17]: where x train is X1, Y1, and Z1; and x test is X2, Y2, and Z2.  The KNN method selects the data points close to the testing data in GNSS ask training data. Hence, the data output from the k training can be chosen to be the nearest neighbors to predict the unknown data of GNSS. Thus, the following KNN equation is used to predict the required data [18]: where k is the number of nearest neighbors of . Hence, to consider the correlation between times, the following equation can be used for GNSS data prediction [17]: where is the testing of the predicted data, is the weight of the J-neighbor, and is the testing data. Moreover, the number of the training data (n) can be given as follows [17]:

Kalman Filter (KF)
For navigation with an INS and GNSS, the INS is the essential keeper of short-term navigation information. The Kalman filter keeps that navigation information as accurate as the noise sources will allow. In GNSS/INS integration, the Kalman filter replaces the stochastic model for unpredictable host vehicle dynamics with the one for the INS and uses it to estimate, correct, and compensate for errors in the INS implementation. A key feature of the integrated navigator is maintaining short-term accuracy when GNSS signals are not available for a few seconds [19,20].
The Kalman filter is the optimal estimator of the expected value of the state of the process in the case of zero-mean white Gaussian noise of the measurements. It is a set of The KNN method selects the data points close to the testing data in GNSS ask training data. Hence, the data output from the k training can be chosen to be the nearest neighbors to predict the unknown data of GNSS. Thus, the following KNN equation is used to predict the required data [18]:ŷ where k is the number of nearest neighbors of y j . Hence, to consider the correlation between times, the following equation can be used for GNSS data prediction [17]:ŷ whereŷ l is the testing of the predicted data, ω j is the weight of the J-neighbor, and y j is the testing data. Moreover, the number of the training data (n) can be given as follows [17]:

Kalman Filter (KF)
For navigation with an INS and GNSS, the INS is the essential keeper of short-term navigation information. The Kalman filter keeps that navigation information as accurate as the noise sources will allow. In GNSS/INS integration, the Kalman filter replaces the stochastic model for unpredictable host vehicle dynamics with the one for the INS and uses it to estimate, correct, and compensate for errors in the INS implementation. A key feature of the integrated navigator is maintaining short-term accuracy when GNSS signals are not available for a few seconds [19,20].
The Kalman filter is the optimal estimator of the expected value of the state of the process in the case of zero-mean white Gaussian noise of the measurements. It is a set of equations in a quadratic form, and the process can be described with a stochastic difference equation [21].
Regardless of any optimum criterion, the Kalman filter is considered the conditional expectation process of the state-space of concern to the whole past observation stream. Thus, the estimated value of X (k) (discrete-time from) isX(k/k) and defined by [19,22]: . . Y(k)}, and the associated estimate error covariance matrix is given by the following: where P(k/k) is the error covariance matrix. The following linear recursive formulas summarize the optimal Kalman filtering algorithm: • Filter gain • Error covariance This algorithm requires initial estimates of P (0/0) andX(0/0).

Ultra-Tightly Coupled Integration of GNSS/INS
The ultra-tight GNSS/INS integration is more and more popular despite its implementation complexities (the INS is collocated with the GNSS), as it has unique advantages, such as excellent anti-jamming performance and increased dynamic ranges.
In the case of ultra-tight GNSS/INS integration, the I and Q (in-phase and quadrature) variables from the GNSS correlator are integrated with the position, velocity, and attitude of the INS. The main difference between the ultra-tight coupling and the widely used loose or tight GNSS/INS integration methods is that the INS aiding of GNSS receiver is optional in loosely or tightly coupled systems, whereas, in the case of ultra-tight coupling, it is part of the integration. The main reason behind this is that the GNSS and INS variables are strongly connected through the vehicle's dynamics. Another advantage of integrating INS data into the GNSS tracking loop is that it can negate the Doppler effect between the satellites and the receiver introduced by the vehicle dynamics. Thus, this design makes the GNSS more reliable in an extended dynamic range, which is almost impossible to achieve with other techniques (such as increasing the carrier tracking loop bandwidth, which increases the thermal noise, possibly degrading the measurement accuracy). The mathematical analysis and the ultra-tight integration design based on the Kalman filter are introduced in Reference [23]. The architecture and equations are as follows.
Equation (11) is used to estimate the phase and frequency of the GNSS signal [20,21]: By neglecting the effect from the atmosphere, the delay propagation (τ) can be given as follows: where τ t is the time of the transmitting signal, τ r is the time of the receiving signal, t is the time of the routing period, X s (τ t ) is the GNSS satellite position, X u (τ r ) is the user position, P is the signal power, C(t) is the sequence of the code C/A, τ is the delay propagation, D(t) is the navigation message 50 Hz, ψ d is the phase of the initial carrier, ξ is the Gaussian Noise, c is the velocity of light, and w is the angular frequency. From the above equations, one can write Equation (11) as follows [24]: Equations (17) and (18) represent the association of velocity and position with the frequency and phase. The sequential loop function may represent the path for existing parameters in order to obtain navigation data.
where w is the receiver carrier frequency, ψ is the phase of the GNSS signal, and t 0 is the time at the reference point. To explain the relationship between I, Q, w , and ψ , let wˆand ψˆbe the estimated values of the receiver and k (number of iteration); hence, by multiplying the estimated local carrier (ψˆ) with the signal arriving and integrating redetection interval, one can get a quadrature signal [25].
I and Q data are quadrature-phase signal data. According to Figure 2 in the manuscript, there is feedback link data from the Kalman filter to the INS, and then we make measure-Electronics 2021, 10, 1513 7 of 13 ments to evaluate I and Q data according to Equations (21) and (22). When they are feedback from the Kalman filter, which has a link from GNSS, their rates, in the beginning, are 1 Hz. Before the KNN predictor, the GNSS rate is 1 Hz. Thus, we assume that the GNSS data are available every 1 s. Equations (21) and (22), as shown above, can be written as follows [23,25]: where I and Q are the elements generated by the mixer, ξ I and ξ Q are the components of Quadrature noise, w e is the frequency error, and ψ e is the error of the phase. The errors are then reduced from the iteration loops, and by taking the supposition and integration of Equations (23) and (24), the result is as follows [24,25]: where T is the rate data; Hence, by combining velocity and position with (I and Q) measurements, and according to Figure 2, one can get the following equations [12,25]: where dI and dQ are the deviations of INS measurements due to the inertial INS sensor (I and Q), ξ I , and ξ Q are the GNSS (I and Q) measurements' components of the quadrature noise, and k is the iteration number. The two measured components from the INS (I and Q) will be subtracted from the GNSS receiver components (I and Q). The result is Equation (34). Thus, the Kalman filter treats the remaining signal after subtraction and generates the estimation error.

Simulation Results
The INS and GNSS data used for the calculations were extracted from aircraft autopilot logs. The logs were produced when a video recording campaign was run at the Mátyásföld Electronics 2021, 10, 1513 8 of 13 model airfield near Budapest, for Reference [26]. The data were recorded with a 3DR Iris+ [27] drone running the ArduCopter [28] firmware.
The INS information is available every 0.1 s, while the GNSS receiver information is available every one second. Nevertheless, the INS and GNSS must be time-synchronized to estimate the errors from the two frameworks in a specific time interval. Figure 3 shows the comparison of the drone trajectory coordinates in (X, Y, and Z) when using the (GNSS data without predictor) and (GNSS data with KNN predictor). From this figure, the drone's trajectory in the three coordinates can be seen, represented by 60 points. At each point, GNSS provides the target position (X, Y, and Z). These points are 1 s apart, and hence the whole duration of the trajectory is 60 s. noise, and k is the iteration number. The two measured components from the INS (I and Q) will be subtracted from the GNSS receiver components (I and Q). The result is Equation (34). Thus, the Kalman filter treats the remaining signal after subtraction and generates the estimation error.

Simulation Results
The INS and GNSS data used for the calculations were extracted from aircraft autopilot logs. The logs were produced when a video recording campaign was run at the Mátyásföld model airfield near Budapest, for Reference [26]. The data were recorded with a 3DR Iris+ [27] drone running the ArduCopter [28] firmware.
The INS information is available every 0.1 s, while the GNSS receiver information is available every one second. Nevertheless, the INS and GNSS must be time-synchronized to estimate the errors from the two frameworks in a specific time interval. Figure 3 shows the comparison of the drone trajectory coordinates in (X, Y, and Z) when using the (GNSS data without predictor) and (GNSS data with KNN predictor). From this figure, the drone's trajectory in the three coordinates can be seen, represented by 60 points. At each point, GNSS provides the target position (X, Y, and Z). These points are 1 s apart, and hence the whole duration of the trajectory is 60 s.  Comparing the drone trajectory coordinates in (X, Y, and Z) when using the GNSS data without predictor and GNSS data with KNN predictor; a-1 shows the drone trajectory in X-axis without using KNN predictor; a-2 shows the drone trajectory in X-axis by using the KNN predictor; b-1 shows the drone trajectory in Y-axis without using KNN predictor; b-2 shows the drone trajectory in Y-axis by using the KNN predictor; c-1 shows the drone trajectory in Z-axis without using KNN predictor; c-2 shows the drone trajectory in Z-axis by using the KNN predictor.
The KNN predictor algorithm was used to enable GNSS receiver output to predict between samples instant when using the GNSS signal is lost for a few seconds. Hence, after adding the KNN predictor to the GNSS receiver's output, it will have 600 points of (target position (X, Y, and Z)); these points are 0.1 s apart for the same whole 60 s duration of the trajectory.
The following scenarios are taken for the evaluation performance of the proposed GNSS  Comparing the drone trajectory coordinates in (X, Y, and Z) when using the GNSS data without predictor and GNSS data with KNN predictor; a-1 shows the drone trajectory in X-axis without using KNN predictor; a-2 shows the drone trajectory in X-axis by using the KNN predictor; b-1 shows the drone trajectory in Y-axis without using KNN predictor; b-2 shows the drone trajectory in Y-axis by using the KNN predictor; c-1 shows the drone trajectory in Z-axis without using KNN predictor; c-2 shows the drone trajectory in Z-axis by using the KNN predictor.
The KNN predictor algorithm was used to enable GNSS receiver output to predict between samples instant when using the GNSS signal is lost for a few seconds. Hence, after adding the KNN predictor to the GNSS receiver's output, it will have 600 points of Electronics 2021, 10, 1513 9 of 13 (target position (X, Y, and Z)); these points are 0.1 s apart for the same whole 60 s duration of the trajectory.
The following scenarios are taken for the evaluation performance of the proposed GNSS/INS system (all of these scenarios are taken after adding the KNN predictor for the integration of GNSS/INS):

Scenario (I):
This scenario compares the positions in three coordinates (X, Y, Z) for INS, GNSS, and the integration of GNSS/INS without blocking the GNSS data (see Figure 4).

Scenario (II):
This scenario is like Scenario (I) but with a blocking time of 1 s in the GNSS receiver (see Figure 5).

Scenario (III):
This scenario is like Scenario (II), but with a blocking time of 4 s in the GNSS receiver (see Figure 6).

Scenario (IV):
This scenario is like Scenario (III), but with a blocking time of 8 s in the GNSS receiver (see Figure 7).
GNSS data with KNN predictor; a-1 shows the drone trajectory in X-axis without using KNN predictor; a-2 shows the drone trajectory in X-axis by using the KNN predictor; b-1 shows the drone trajectory in Y-axis without using KNN predictor; b-2 shows the drone trajectory in Y-axis by using the KNN predictor; c-1 shows the drone trajectory in Z-axis without using KNN predictor; c-2 shows the drone trajectory in Z-axis by using the KNN predictor.
The KNN predictor algorithm was used to enable GNSS receiver output to predict between samples instant when using the GNSS signal is lost for a few seconds. Hence, after adding the KNN predictor to the GNSS receiver's output, it will have 600 points of (target position (X, Y, and Z)); these points are 0.1 s apart for the same whole 60 s duration of the trajectory.
The following scenarios are taken for the evaluation performance of the proposed GNSS/INS system (all of these scenarios are taken after adding the KNN predictor for the integration of GNSS/INS):

Scenario (I):
This scenario compares the positions in three coordinates (X, Y, Z) for INS, GNSS, and the integration of GNSS/INS without blocking the GNSS data (see Figure 4). Scenario (II): This scenario is like Scenario (I) but with a blocking time of 1 s in the GNSS receiver (see Figure 5).

Scenario (III):
This scenario is like Scenario (II), but with a blocking time of 4 s in the GNSS receiver (see Figure 6).

Scenario (IV):
This scenario is like Scenario (III), but with a blocking time of 8 s in the GNSS receiver (see Figure 7).             From the above scenarios, one can conclude that using GNSS/INS with KNN predictor can decrease the deviation in the three coordinates (X, Y, and Z) when there is blocking in time (lost signal) for a few seconds in the GNSS receiver.
The standard deviation of INS, GNSS without predictor, and GNSS/INS with KNN predictor can be seen in Table 1, when the GNSS receiver with and without blocking in a few seconds. In References [13][14][15], different algorithm predictors to predict the output values of GPS were used, while, in this paper, a new algorithm was used to predict GNSS output values. Figures 5-7 and Table 1 show the main results of this new method. Additionally, a brief evaluation of this research is shown in Table 2.  From the above scenarios, one can conclude that using GNSS/INS with KNN predictor can decrease the deviation in the three coordinates (X, Y, and Z) when there is blocking in time (lost signal) for a few seconds in the GNSS receiver.
The standard deviation of INS, GNSS without predictor, and GNSS/INS with KNN predictor can be seen in Table 1, when the GNSS receiver with and without blocking in a few seconds. In References [13][14][15], different algorithm predictors to predict the output values of GPS were used, while, in this paper, a new algorithm was used to predict GNSS output values. Figures 5-7 and Table 1 show the main results of this new method. Additionally, a brief evaluation of this research is shown in Table 2.  Table 2. Brief evaluation of prediction methods.

Reference Prediction for GPS or GNSS Method of Predictor Accuracy
[13] GPS NLMS low [14] GPS RBFNN and WNNs better [15] GNSS Carrier phase prediction high Our method GNSS KNN high

Conclusions
The integration of GNSS and INS systems can make up for the weaknesses inherent in each and combine their individual advantages. Because the time synchronization between INS and GNSS must be achieved to estimate the errors from the two systems simultaneously, this paper adds a new technique of using a predictor on GNSS output before integrating with the INS. As a result, a prediction between the GNSS receiver's sampling instants is required. The INS information is available every 0.1 s, while the GNSS receiver information is available every one second. Different predictors can be used for GNSS receivers, selecting the best one depending on its prediction results.
KNN predictor algorithm uses the database to search for data that is similar to the current data; hence, this algorithm is implemented at the output of the GNSS receiver to satisfy the synchronization process between INS and GNSS and predict the output of the GNSS receiver when its signal is lost (data blocking) for a few seconds. The ultratight integration of GNSS and INS was used in this study due to its advantages, such as anti-jamming immunity and increased dynamic ranges. The GNSS data were clutched in different scenarios, both with and without blocking for a few seconds. From the obtained results, it can be concluded that the error values in the three axes (X, Y, and Z) are increasing as the GNSS-data-blocking period is increased. In simple terms, whenever the GNSS datablocking time is extended, the error values increase. Furthermore, the errors obtained when using GNSS/INS with predictor are less than INS alone, and GNSS without predictor for the same blocking periods in the GNSS data (see Figures 5-7).
From Table 1, one can conclude that using GNSS/INS with the KNN predictor will make a smooth change in the standard deviation in all three axes, even when there is a blocking time in the GNSS receiver.