# GNSS Spoofing Identification and Smoothing Localization Method for GNSS/Visual SLAM System
## 3 Time-Localization Verification and Smoothing Localization Method
### Localization Verification  
In the localization verification process, we need to unify the localization information output by GNSS and visual SLAM system under the same coordinate system. Through the analysis of the visual SLAM frame, the GNSS localization result is inverted to identify whether the GNSS is spoofed. For the GNSS system, the latitude and longitude coordinates \(\mathbf{x}^{\text{L}}=(l_{o},l_{a},h)\) obtained from the GNSS system are first converted to the Earth-centered and Earth-Fixed Coordinate System (ECEF), and then converted to the local Cartesian coordinates coordinate system (ENU) to get \(\mathbf{\chi}^{\text{G}}=(x,y,z)\) to realize the unification of the global coordinate system and the local coordinate system [15]. \(\mathbf{\chi}^{\text{G}}\) is the ENU coordinate vector calculated by GNSS system. The origin of the ENU coordinate system is the initial point in the ECEF coordinate system, which is also the initial position of the visual SLAM system. For the visual SLAM system, we set the left-eye camera as the origin of the camera coordinate system. According to Section 2.3, the ENU coordinate vector of the visual SLAM system at time \(i\) is defined as \(\mathbf{\chi}^{\text{V}}_{i}\). However, the visual SLAM system is usually not in the same plane with GNSS system, which requires a 4-degree-of-freedom (4 DoF) rotation and translation to achieve spatial unification with GNSS. The coordinate conversion relationship between the visual SLAM system and the GNSS system is  
\[\mathbf{\chi}^{\text{G}}=\mathbf{R}^{\text{GV}}\mathbf{\chi}^{\text{V}}+\mathbf{f}^{\text{GV}} \tag{9}\]  
where \((\mathbf{R}^{\text{GV}},\mathbf{f}^{\text{GV}})\) is the external parameters of the camera (It should be noted that \((\mathbf{R}^{\text{GV}},\mathbf{f}^{\text{GV}})\) is the rotation and translation matrix between the visual frame and the GNSS frame, and \((\mathbf{R}_{k},\mathbf{t}_{k})\) is the rotation and translation matrix for visual SLAM system from frame \(k-1\) to frame \(k\)). The optimized coordinates of the visual SLAM system in the ENU coordinate system \(\mathbf{\hat{\chi}}^{V}_{i}\) can be obtained as  
\[\mathbf{\hat{\chi}}^{V}_{i}=\mathbf{R}^{\text{GV}}_{i}\times\mathbf{\chi}^{V}_{i}+\mathbf{t}^ {\text{GV}}_{i} \tag{10}\]  
There are generally two types of GNSS spoofing. One of them is forwarding spoofing. After the forwarding spoofing is tracked to the receiver signal, the location spoofing information is applied, so that the terminal calculates the wrong position and continues to move toward the target point. In fact, it reaches the location designated by the spoofing terminal. The other type is inducing spoofing, which applies small displacement spoofing to the terminal, causing the terminal to be gradually pulled away. Assume that \(E_{d}\) is the location verification threshold of forwarding spoofing and \(E_{s}\) is the location verification threshold of inducing spoofing. The localization verification methods of the two types of spoofing are analyzed separately. In order to identify whether the GNSS is spoofed, the GNSS measurement data will be checked with visual SLAM data. By inverting the offset of GNSS data, it is judged whether the offset result exceeds the threshold. When GNSS forwarding spoofing occurs, the forwarding spoofing deviation \(\psi_{i}\) at time \(i\) is  
\[\psi_{i}=\|\mathbf{\chi}^{\text{G}}_{i}-\mathbf{\hat{\chi}}^{V}_{i}\| \tag{11}\]  
Figure 2: Time Verification. If \(\psi_{i}\leq E_{d}\), the deviation between GNSS and visual SLAM system is within the threshold range, the localization verification is judged to be normal, and the localization domain verification flag is set to \(C_{i}^{\text{L}}=0\). If \(\psi_{i}>E_{d}\), the deviation between GNSS and visual SLAM system exceeds the threshold range, the localization verification is judged to be abnormal, and the localization domain verification flag is set to \(C_{i}^{\text{L}}=1\), that is  
\[C_{i}^{\text{L}}=\left\{ \begin{array}{ll}0&\psi_{i}\leq E_{d}\\ 1&\psi_{i}>E_{d}\end{array} \right.