# GNSS Spoofing Identification and Smoothing Localization Method for GNSS/Visual SLAM System
## 3 Time-Localization Verification and Smoothing Localization Method
### Localization Verification Threshold Analysis  
When the terminal is moving, the position calculated by GNSS is usually within a certain error range from the true value, and the position calculated by the visual SLAM system also has a certain error. According to the predicted position and the true value, the calculated position (the total number is \(N\)) can be divided into four states: True positive (TP), False negative (FN), False positive (FP) and True negative (TN). The accuracy rate of navigation prediction (PD), the probability of false alarm (PFA) and the missing alarm rate (PMD) are  
\[PD=\frac{N_{TP}+N_{TN}}{N},\ PFA=\frac{N_{FP}}{N_{FP}+N_{TN}},\ PMD=\frac{N_{ FN}}{N_{TP}+N_{FN}} \tag{15}\]  
Let \(\mathbf{\chi}_{i}^{0}\) be the true value of location \(i\), then we have  
\[e_{i}^{G}=\|\mathbf{\chi}_{i}^{G}-\mathbf{\chi}_{i}^{0}\|\,e_{i}^{V}=\|\mathbf{\chi}_{i}^{V}- \mathbf{\chi}_{i}^{0}\| \tag{16}\]  
where \(e_{i}^{G}\) is the measurement error of the GNSS system at time \(i\) and \(e_{i}^{V}\) is the estimation error of the visual SLAM system at time \(i\). According to the Pauta criterion, a classical method in metrology, it is possible to perform error analysis on a measurement error that is subject to Gaussian distribution. When the deviation between the measurement error and the average value exceeds \(n\) times the standard deviation (which traditionally recommended value of coefficient \(n\) is usually 3), the measurement error can be regarded as an extreme error. It is assumed that the measurement error of the GNSS system conforms to the Gaussian distributed \(N\sim(0,\sigma_{\rm G}^{2})\), and the estimation error of the visual SLAM system conforms the Gaussian distributed \(N\sim(0,\sigma_{\rm V}^{2})\). For the one-dimensional Gaussian distribution of errors, if the error is within the confidence interval, the error value is considered to be within the normal range, and if it exceeds the confidence interval, it is considered to be in the abnormal range. Therefore, the size of the confidence interval can be regarded as the limit error and the threshold of the system. According to the \(3\sigma\) principles, the confidence probability of the true value in the confidence interval \([\mu-3\sigma,\mu+3\sigma]\) is 99.73%. At this time, the probability that the measurement error exceeds the range is only 0.27%. The GNSS/Visual SLAM system is a joint system fused with the GNSS system and the visual SLAM system, and its joint probability density is two-dimensional. The joint probability density function of the GNSS/Vision SLAM system is  
\[f(x_{\rm G},x_{\rm V})=\frac{1}{2\pi\sigma_{\rm G}\sigma_{\rm V}\sqrt{1-\rho^ {2}}}\exp\left\{-\frac{1}{2(1-\rho^{2})}\left[\frac{(x_{\rm G}-\mu_{\rm G})^{ 2}}{\sigma_{\rm G}^{2}}-2\rho\frac{x_{\rm G}x_{\rm V}}{\sigma_{\rm G}\sigma_{ \rm V}}+\frac{(x_{\rm V}-\mu_{\rm V})^{2}}{\sigma_{\rm V}^{2}}\right]\right\} \tag{17}\]  
During the verification process, the localization of the two systems are independent of each other, and the GNSS system is not related to the visual SLAM system, where \(\rho=0\). According to the nature of the normal distribution, the joint probability density function can be simplified to  
\[f(x_{\rm G},x_{\rm V})=\frac{1}{2\pi\sigma_{\rm G}\sigma_{\rm V}}\exp\left[- \frac{1}{2}\left(\frac{x_{\rm G}^{2}}{\sigma_{\rm G}^{2}}+\frac{x_{\rm V}^{2} }{\sigma_{\rm V}^{2}}\right)\right] \tag{18}\]  
For the GNSS/Vision SLAM system, set the confidence interval \(D\{x_{\rm G}\in(-a,a),x_{\rm V}\in(-b,b)\}\), and the probability \(P\{(x_{\rm G},x_{\rm V})\in D\}\) can be calculated as  
\[