# An In-Vehicle Smartphone RTK/DR Positioning Method Combined with OSM Road Network
## 2 Materials and Methods
### RTK/DR Positioning Method  
RTK/DR positioning method uses the standard Kalman filter for a combined navigation solution. The parameters to be estimated are position and velocity. The order of state update and measurement update are as follows:  
\[\left\{\begin{array}{l}\hat{\mathbb{X}}_{k/k-1}=\Phi_{k/k-1}\hat{\mathbb{X}}_ {k-1}\\ P_{k/k-1}=\Phi_{k/k-1}P_{k-1}\Phi_{k/k-1}^{T}+\Gamma_{k-1}Q_{k-1}\Gamma_{k-1}^{ T}\end{array}\right. \tag{17}\]  
\[\left\{\begin{array}{l}K_{k}=P_{k/k-1}H_{k}^{T}\left(H_{k}P_{k/k-1}H_{k}^{T}+ R_{k}\right)^{-1}\\ \hat{\mathbb{X}}_{k}=\hat{\mathbb{X}}_{k/k-1}+K_{k}\left(Z_{k}-H_{k}\hat{ \mathbb{X}}_{k/k-1}\right)\\ P_{k}=\left(I-K_{k}H_{k}\right)P_{k/k-1}\end{array}\right. \tag{18}\]  
The system state transition matrix is constructed according to the uniform motion equation, as follows:  
\[\Phi_{k/k-1}=\begin{bmatrix}1&0&0&0&\frac{dt}{R_{m}+H_{k}^{DR}}&0\\ 0&1&0&\frac{dt}{(R_{m}+H_{k}^{DR})\cos B_{k}}&0&0\\ 0&0&1&0&0&1\\ 0&0&0&1&0&0\\ 0&0&0&0&1&0\\ 0&0&0&0&0&1\end{bmatrix} \tag{19}\]  
In complex urban environments, satellite signals are easily affected by multipath reflection and obstruction, resulting in drift and jumps of smartphone RTK. Incorrect RTK results will not only destroy the combination filter but also cause deviations in the subsequent range estimation, so it is necessary to stop the measurement update. The covariance matrix \(R_{k}^{RTK}\), after robust RTK Kalman filtering, correlates with the positioningerror. The position variance \(P_{k}^{RTK}\) is converted from the WGS84 coordinate system into the ENU coordinate system, so that the horizontal variance \(S_{p}^{RTK}\) is calculated:  
\[S_{p}^{RTK}=\sqrt{\left(S_{\epsilon}^{RTK}\right)^{2}+\left(S_{n}^{RTK}\right)^{2}} \tag{20}\]  
This work treats \(S_{p}^{RTK}\) as a rough prediction of horizontal position error. Figure 4 shows the comparison between \(S_{p}^{RTK}\) and actual horizontal position error. The green line (pre) represents horizontal variance \(S_{p}^{RTK}\), and the red line (real) represents the actual RTK horizontal position error of the smartphone. It can be found that the overall \(S_{p}^{RTK}\) is higher than the actual horizontal error of the smartphone, even though, as far as the fluctuations, the two parameters are similar, and the performance is more consistent in areas affected by higher errors. The actual positioning error cannot be obtained during vehicle navigation. Therefore, according to the experimental results, this work regards \(S_{p}^{RTK}\) as an empirical indicator for assessing positioning quality. However, since the predicted horizontal position error is smaller than the actual error at some moments, additional information is needed to evaluate the positioning quality.  
When the RTK positioning result jumps, its direction will drastically change, while the heading angle change of DR is closer to reality. Therefore, the difference of the heading angle change between RTK and DR can be used as an indicator to assess the positioning accuracy. The DR heading angle variation is also used to assess the vehicle motion state during the correction of this angle. Therefore, during the driving stage along a straight line, the RTK heading angle variation is directly used to determine whether there is a jump in the positioning result. Combined with the heading angle change information of RTK, this work adds a measurement update switch. When the vehicle is on a straight road, if \(S_{p}^{RTK}\) is higher than 2 and the RTK heading angle change exceeds 10 degrees, RTK/DR positioning method will perform only a state update but not a measurement update.