# An In-Vehicle Smartphone RTK/DR Positioning Method Combined with OSM Road Network
## 2 Materials and Methods
### Smartphone RTK Model  
This work researches mainly the RTK positioning model under the short baseline, which means that the distance between the smartphone and the reference station is generally within 10 km. The smartphone connects to the reference station through the network and decodes the observation data of the reference station itself in real time. Firstly, the raw smartphone and reference station observations are matched. Then, the inter-satellite and inter-station differences are computed in order to obtain the pseudorange double difference equation and the carrier phase double difference equation. Additionally, the velocity is measured using Doppler observations from smartphones. Finally, the Doppler inter-satellite single difference equation, pseudorange double difference equation, and carrier phase double difference equation are combined to obtain the observation equation of the Kalman filter [22]. The observation equation is as follows:  
\[L=HX+V \tag{1}\]  
where  
\[X= \begin{bmatrix}x&y&z&v_{x}&v_{y}&v_{z}&a_{x}&a_{y}&a_{z}&\
abla\widetilde{N} ^{1}&\cdots&\
abla\widetilde{N}^{2}\end{bmatrix}  \tag{2}\]\[H= \begin{bmatrix}l^{1}&m^{1}&w^{1}&0&\cdots&0\\ l^{1}&m^{1}&w^{1}&1&\cdots&0\\ l^{1}_{v}&m^{1}&0&0&\cdots&0\\ &&\vdots&&&\\ l^{n}&m^{n}&w^{n}&0&\cdots&0\\ l^{n}&m^{n}&w^{n}&0&\cdots&1\\ l^{n}_{v}&m^{n}&0&0&\cdots&0\end{bmatrix}  \tag{3}\] \[m^{i}=l^{i}dt\] (4) \[w^{j}=\frac{1}{2}l^{i}dt^{2} \tag{5}\]  
In the above formula, \(L\) represents the observations of pseudorange double difference, carrier phase double difference, and Doppler single difference. \(X\) represents the parameter to be estimated, including position, velocity, acceleration, and double difference ambiguity. \(l^{i}\) represents the direction cosine of the satellite. \(l^{i}_{v}\) represents the satellite velocity cosine. Smartphones generally use low-cost GNSS receivers, which lack modules for anti-jamming. In order to adapt to the complex urban environment, this work uses a robust Kalman filter that accomplishes parameter estimation. During dynamic positioning, there are many cycle slips in the carrier phase data of the smartphone, and it is difficult to fix the ambiguity, so the ambiguity parameter in the model is a floating-point solution. The robust Kalman filter scheme used in this work is as follows [23]:  
\[\overline{R}_{i}=R_{i}/\alpha \tag{6}\] \[\alpha_{i}= \begin{cases}1&|\widetilde{v}_{i}|\leq k_{0}\\ \frac{k_{0}}{|\widetilde{v}_{i}|}\Big{(}\frac{k_{1}-|\widetilde{v}_{i}|}{k_{ 1}-k_{0}}\Big{)}^{2}&k_{0}<|\widetilde{v}_{i}|\leq k_{1}\\ 10^{-8}&|\widetilde{v}_{i}|>k_{1}\end{cases} \] (7) \[\widetilde{v}_{i}=\frac{v_{i}-\overline{v}}{\sigma_{v}} \tag{8}\]  
In the above formula, \(\overline{R}_{i}\) represents the equivalent variance; \(R_{i}\) represents the variance of the highest residual \(v_{i}\) corresponding to the observed value; \(\alpha_{i}\) represents the variance amplification factor; \(\widetilde{v}_{i}\) represents the standardised residual; and \(k_{0}\) and \(k_{1}\) represent the thresholds: in this work, \(k_{0}=1.2\) and \(k_{1}=3.0\). Every epoch is solved by a robust iteration. When \(\alpha_{i}\) is equal to \(10^{-8}\), the corresponding observations are removed, and the iteration is carried out until no observation is removed. The RTK positioning model designed in this work does not limit the number of constellations and satellites. All valid satellite data received by the smartphone participate in the positioning process, and the constellations used include GPS, BD, Galileo, and GLONASS. Other conventional optimisation methods are also used in smartphone RTK, e.g., gross error detection between epochs of satellite observations, smoothing pseudorange with Doppler data, and selection of reference satellites according to elevation mask and carrier-to-noise ratio information. of the forward acceleration of the smartphone is generally lower than 0.01 m/s\({}^{2}\) when it is stationary. When the forward acceleration is higher than 0.5 m/s\({}^{2}\), the vehicle can be considered as not stationary.