# GNSS Spoofing Identification and Smoothing Localization Method for GNSS/Visual SLAM System
## 2 System Model
### Visual SLAM System Modeling and Error Analysis
Assuming that the set of common-view feature points of \(\mathbf{P}_{l}\) and \(\mathbf{P}_{r}\) is \(\mathbf{\alpha}=\{\alpha_{1},\cdots,\alpha_{i},\cdots,\alpha_{t}\},\mathbf{\alpha}\in \mathbf{P}_{l}\), the normalized camera coordinates of the feature points in the left and right images are \(\mathbf{x}_{l}= \begin{matrix}-\mathbf{\alpha}_{1}&-\mathbf{\alpha}_{2}&-\mathbf{\alpha}_{n}\\ \mathbf{x}_{r}=\begin{matrix}-\mathbf{\alpha}_{1}&-\mathbf{\alpha}_{2}&-\mathbf{\alpha}_{n}\\ \mathbf{x}_{r}&\mathbf{x}_{r}&\ldots,\mathbf{x}_{r}\end{matrix}\end{matrix} \) and \(\mathbf{x}_{r}= \begin{matrix}-\mathbf{\alpha}_{1}&-\mathbf{\alpha}_{2}&-\mathbf{\alpha}_{n}\\ \mathbf{x}_{r}=\begin{matrix}-\mathbf{x}_{r}&-\mathbf{x}_{r}&\ldots,\mathbf{x}_{r}\end{matrix} \end{matrix} \). Then, according to the epipolar constraint [18], the eight-pointmethod [19] and the SVD decomposition method [20], the homogeneous coordinates \(x^{\alpha_{1}}\) of feature point \(\alpha_{1}\) in the world 3D coordinate, the depth values \(d_{1}^{\alpha_{1}}\) and \(d_{r}^{\alpha_{1}}\) of the feature point \(\alpha_{1}\) in the left and right images and the relative pose \((\mathbf{R}_{l,r},\mathbf{t}_{l,r})\) of the two frames at this time can be obtained. Similarly, all the world 3D coordinates of feature points \(\mathbf{x}^{\alpha}=(x^{\alpha_{1}},x^{\alpha_{2}},\ldots,x^{\alpha_{n}})\) can be estimated. In the stable updating stage, we first use the world 3D coordinates of the common view feature points, the normalized coordinates in the camera frame and depth in the current frame \(f_{k}\), to calculate the rotation and translation matrix \((\mathbf{R}_{k},\mathbf{t}_{k})\). Then, we use the obtained rotation and translation matrix to estimate the world 3D coordinates of the non-common view feature points. We can get the world 3D coordinates \(\mathbf{x}^{\mathbf{P}_{k}}\) of all feature points in the current frame \(f_{k}\), and the rotation and translation matrix \((\mathbf{R}_{k},\mathbf{t}_{k})\) of the camera in the current frame. In order to reduce the accumulated mileage error caused by the estimation above, we optimize the depth of the common view feature points of the key frame and the camera pose in the visual processing sliding window. The state vector \(\mathbf{\eta}^{\rm V}\) to be optimized includes the poses of \(m\) cameras and the depths of \(n\) feature points in the visual processing sliding window, as shown in the following formula:  
\[\mathbf{\eta}^{\rm V}=[\mathbf{T}_{0},\mathbf{T}_{1},\cdots,\mathbf{T}_{m},d_{0},d_{1},\cdots,d _{n}] \tag{3}\]  
where \(\mathbf{T}\) is the camera homogeneous transformation matrix containing the rotation and translation matrix information, and \(d\) is the depth of the feature point observed in the first frame. Then, the visual reprojection error of the feature points from frame \(f_{t}\) to frame \(f_{k}\) is  
\[f(\mathbf{x}_{k}^{\beta_{i}},\mathbf{\eta}^{\rm V})=\mathbf{\hat{x}}_{k}^{\beta_{i}}-\left[ \mathbf{T}_{w}^{\mathbf{b}_{k}}(\mathbf{T}_{b_{i}}^{\omega}d_{\beta_{i}}\mathbf{\hat{x}}_{t}^{ \beta_{i}})\right] \tag{4}\]  
where \(\mathbf{\hat{x}}_{k}^{\beta_{i}}\) is the normalized camera coordinate of feature point \(\beta_{i}\) in the frame \(f_{k},\mathbf{\hat{x}}_{t}^{\beta_{i}}\) is the normalized camera coordinate of the feature point \(\beta_{i}\) observed by the camera for the first time, \(\mathbf{T}_{b_{1}}^{\omega}\) is the homogeneous transformation matrix from frame \(f_{t}\) to the world coordinate system and \(\mathbf{T}_{w}^{\mathbf{b}}\) is the homogeneous transformation matrix from the world coordinate system to frame \(f_{k}\).