Tram Positioning with Map-Enabled GNSS Data Reconciliation* (preprint) Jakub Kašpar, Vít Fanta, Vladimír Havlena Abstract This paper presents an approach to tackle the problem of tram localization through utilizing a custom processing of Global Navigation Satellite System (GNSS) observables and the track map. The method is motivated by suboptimal performance in dense urban environments where the direct line of sight to GNSS satellites is often obscured which leads to multipath propagation of GNSS signals. The presented concept is based upon the iterated extended Kalman filter (IEKF) and has linear complexity (with respect to the number of GNSS measurements) as opposed to some other techniques mitigating the multipath signal propagation. The technique is demonstrated both on a simulated example and real data. The root-mean-squared errors from the simulated ground truth positions show that the presented solution is able to improve performance compared to a baseline localization approach. Similar result is achieved for the experiment with real data, while treating orthogonal projections onto the tram track as the true position, which is unavailable in the realistic scenario. This proof-of-concept shows results which may be further improved with implementation of a bank-of-models method or χ 2 \chi^{2} -based rejection of outlying GNSS pseudorange measurements. I INTRODUCTION Reliable position estimation is a prerequisite for many advanced driver assistance and anti collision systems in trams. GNSS reception in urban canyon environment is frequently disturbed by multi-path or non-line-of-sight (NLOS) propagation of satellite signals resulting in significant position bias. Typically, several satellites from an NLOS segment of the sky are affected. Classical receiver autonomous integrity monitoring (RAIM) algorithms developed for aerospace applications rely on high data redundancy and assume only a single fault detection [ 1 , 2 , 3 , 4 ] . To detect multiple faults, all possible fault models have to be considered resulting in combinatorial complexity and heavy computational burden [ 5 , 6 , 7 , 8 , 9 ] . References to integrity monitoring in urban environment can be characterized as measurement rejection and error characterization methods. The first approach rejects faulty measurements to achieve consistent residuals and works well in open sky environment. The second approach identifies measurements contaminated by a large bias and assigns them corresponding weights but does reject them completely [ 10 ] . An alternative approach based on fusion of information from multiple sources (GNSS, IMU, map, odometry etc.) is elaborated. Previously published map-enabled approaches are described in e.g. [ 11 , 12 ] . The core idea of the presented algorithm is to evaluate the accuracy of pseudorange measurements based on the predicted tram position fixed to rail and provide realistic variance and bias estimates for all individual satellites. Note that under NLOS conditions, multiple outliers from blocked sky segment may produce a large position error with small residuals, so the analysis based on residuals only [ 13 , 14 ] will not be efficient. With linear complexity, this approach covers multiple fault detection with reasonable computational burden. Also – unlike in the classical RAIM approach – individual pseudoranges are characterized not only by the weights, but also the biases. Using Gaussian mixture distribution concept, the probability distribution function (pdf) of raw data and estimated biased pseudorange are approximated by a new pdf with equivalent first and second moments. In this way, biased measurements will strongly affect the resulting GNSS-based position estimate covariance ellipsoid which then serves as an input to a master fusion algorithm to calculate maximum a posteriori probability estimate of the tram position. The master fusion algorithm comes in the form of non-linear least squares problem utilizing the assumption of Gaussian distribution and conditional independence of the relevant sources of information. To see this, consider the Bayesian update p(x|a,b,c)\propto p(a,b,c|x)\ p(x), (1) where p(x)\sim\mathcal{N}(\hat{x},P_{x}) is the prior information and a=g_{a}(x)\!+\!e_{a},b=g_{b}(x)\!+\!e_{b},c=g_{c}(x)\!+\!e_{c} are individual sources of information about x with \mbox{cov}\{e_{\bullet}\}=P_{\bullet} . Under the aforementioned assumptions, the likelihood l(x|a,b,c)=p(a,b,c|x) can be factorized into p(a,b,c|x)=p(a|x)p(b|x)p(c|x). (2) Finding a maximum a posteriori (MAP) estimate that maximizes ( 1 ) for a given prior \hat{x} and data a,b,c \hat{x}_{\rm MAP}=\mathop{\arg\max}_{x}\exp{\left(-\|x\!-\!\hat{x}\|^{2}_{P^{-1}_{x}}-\|a\!-\!g_{a}(x)\|^{2}_{P^{-1}_{a}}\right.}\\ -\left.\|b\!-\!g_{b}(x)\|^{2}_{P^{-1}_{b}}-\|(c\!-\!g_{c}(x)\|^{2}_{P^{-1}_{c}}\right), (3) is equivalent to the non-linear least squares problem \min_{x}\left(\|x-\hat{x}\|^{2}_{P^{-1}_{x}}+\|a-g_{a}(x)\|^{2}_{P^{-1}_{a}}+\right.\\ \left.+\|b-g_{b}(x)\|^{2}_{P^{-1}_{b}}+\|c-g_{c}(x)\|^{2}_{P^{-1}_{c}}\right). (4) Solution of ( 4 ) using the Gauss-Newton method leads to the iterated (extended) Kalman filter algorithm. The master fusion algorithm that is able to incorporate GNSS pseudorange measurement inconsistencies and the fact that the motion is constrained onto the track network directly into the localization scheme can be illustrated graphically. Whereas the usual data update step of a Kalman filter (see Figure 1 ) combines only the position measurement (blue) with the prior state estimate (orange), the presented approach (see Figure 2 ) processes the individual pseudorange measurements to form an inconsistency-aware reading (purple) and also forms a soft constraint on the posterior state in the form of an artificial position measurement in the vicinity of the track network (pink). The posterior estimate lies closer to the tracks and the covariance reflects the fact that the uncertainty of pseudorange measurements coming from GNSS satellites in the segment of the sky which is obscured by an obstacle (e.g. a building) is larger than of the readings from other directions. Fig. 1: Illustration of the filtering step of the localization scheme without taking the inconsistencies of the individual pseudoranges into account. The coloured areas represent covariance ellipsoids of the specified quantities. The paper is organized as follows: First, the iterated extended Kalman filter framework is briefly introduced in section II , along with its reformulation to an instance of a Gauss-Newton problem and how the constraint of the state to the tram track network is constructed. In section III the basic principles of GNSS localization and description of the pseudorange measurement data reconciliation are described. In section IV the application of the proposed framework on a simulated and real data is presented. The final part of the paper consists of a conclusion and possible future improvements. Fig. 2: Illustration of the filtering step of the localization scheme while taking inconsistencies of the individual pseudoranges and track constraint into account. The coloured areas represent covariance ellipsoids of the specified quantities. II INFORMATION FUSION State estimation seeks to find an estimate at time k , \hat{\mathbf{x}}_{k}\in\mathbb{R}^{n} , of the true state \mathbf{x}_{k} at time k . For the specific case of iterated extended Kalman filter (IEKF), we assume that the system evolves according to the discrete model in the form \displaystyle\mathbf{x}_{k+1} \displaystyle=\mathbf{f}_{k}(\mathbf{x}_{k})+\mathbf{w}_{k}, (5) \displaystyle\mathbf{z}_{k} \displaystyle=\mathbf{g}_{k}(\mathbf{x}_{k})+\mathbf{v}_{k}, (6) where \mathbf{f}_{k} is the transition function, \mathbf{g}_{k} is the output function, \mathbf{z}_{k}\in\mathbb{R}^{m} is the measurement vector, \mathbf{w}_{k}\in\mathbb{R}^{n} and \mathbf{v}_{k}\in\mathbb{R}^{m} are the process and measurement noises, respectively, which are not correlated with the state vector nor between themselves. Furthermore, the noise vectors are assumed to be white and normally distributed around the zero vector of appropriate dimension with a given covariance matrix: \displaystyle\mathbf{w}_{k} \displaystyle\sim\mathcal{N}(\mathbf{0},\mathbf{\Sigma}^{\mathbf{w}}_{k}), (7) \displaystyle\mathbf{v}_{k} \displaystyle\sim\mathcal{N}(\mathbf{0},\mathbf{\Sigma}^{\mathbf{v}}_{k}). (8) The IEKF algorithm consist of repeated computation of the filtering step and the prediction step after the filter is initialized at the initial time step, k=0 , with an initial estimate of the state and its covariance, i.e. \displaystyle\hat{\mathbf{x}}_{0|-1} \displaystyle=\hat{\mathbf{x}}_{0}, (9) \displaystyle\mathbf{P}_{0|-1} \displaystyle=\mathbf{P}_{0}. (10) The filtering step performs an inner loop of repeated linearization of the output equation ( 6 ) around the current best estimate of the state, \hat{\mathbf{x}}_{k}^{i} while utilizing the most recent measurement \mathbf{z}_{k} (the upper index i denotes the i -th iteration of the inner loop). The inner loop is initialized with \hat{\mathbf{x}}_{k}^{0}=\hat{\mathbf{x}}_{k|k-1}. (11) The following equations form the inner linearization loop: \displaystyle\mathbf{G}_{k}^{i}=\left.\frac{\partial\mathbf{g}_{k}}{\partial\mathbf{x}_{k}}\right|_{\hat{\mathbf{x}}_{k}^{i}}, (12) \displaystyle\mathbf{K}_{k}^{i}=\mathbf{P}_{k|k-1}\left(\mathbf{G}_{k}^{i}\right)^{T}\left(\mathbf{G}_{k}^{i}\mathbf{P}_{k|k-1}\left(\mathbf{G}_{k}^{i}\right)^{T}+\mathbf{\Sigma}_{k}^{\mathbf{v}}\right)^{-1}, (13) \displaystyle\hat{\mathbf{x}}_{k}^{i+1}=\hat{\mathbf{x}}_{k|k-1}+\mathbf{K}_{k}^{i}\left(\mathbf{z}_{k}-\mathbf{g}_{k}(\hat{\mathbf{x}}_{k}^{i})-\mathbf{G}_{k}^{i}(\hat{\mathbf{x}}_{k|k-1}-\hat{\mathbf{x}}_{k}^{i})\right). (14) The computations ( 12 )-( 14 ) are performed repeatedly with incrementing i:=i+1 until the subsequent iterations fulfils the convergence condition \|\hat{\mathbf{x}}_{k}^{i}-\hat{\mathbf{x}}_{k}^{i+1}\|<\varepsilon for a small predefined parameter \varepsilon>0 . The posterior state estimate and its covariance are given as \displaystyle\hat{\mathbf{x}}_{k|k} \displaystyle=\hat{\mathbf{x}}_{k}^{i}, (15) \displaystyle\mathbf{P}_{k|k} \displaystyle=(\mathbf{I}-\mathbf{K}_{k}^{i}\mathbf{G}_{k}^{i})\mathbf{P}_{k|k-1}. (16) The prediction step consists of linearization of the state equation ( 5 ) at the current best estimate of the state and propagating the covariance and state estimate through the state equation: \displaystyle\mathbf{F}_{k}=\left.\frac{\partial\mathbf{f}_{k}}{\partial\mathbf{x}_{k}}\right|_{\hat{\mathbf{x}}_{k}^{i}}, (17) \displaystyle\mathbf{P}_{k+1|k}=\mathbf{F}_{k}\mathbf{P}_{k|k}\mathbf{F}_{k}^{T}+\mathbf{\Sigma}_{k}^{\mathbf{w}}, (18) \displaystyle\hat{\mathbf{x}}_{k+1|k}=\mathbf{f}_{k}(\hat{\mathbf{x}}_{k|k}). (19) The filtering and prediction steps are computed for k=1,2,\ldots repeatedly in alternating manner. For the purpose of the next sections, it is useful to explicitly introduce a way how to include additional information (readings from secondary sensors or other problem-specific data) into the IEKF framework. This would correspond to having more than one output equation ( 6 ). Consider (without loss of generality) that we have an additional prior information we would like to include in the filtering step, i.e. we can write \mathbf{y}_{k}=\mathbf{h}_{k}(\mathbf{x}_{k})+\mathbf{u}_{k} (20) for some function \mathbf{h}_{k} and normal noise \mathbf{u}_{k}\sim\mathcal{N}(\mathbf{0},\mathbf{\Sigma}_{k}^{\mathbf{u}}) . Under the assumption that \mathbf{y}_{k} are independent from \mathbf{z}_{k} , we can use the IEKF framework described above with augmented measurement vector, measurement noise covariances and the output function: \displaystyle\mathbf{z}_{k}:=\begin{bmatrix}\mathbf{z}_{k}^{T}&\mathbf{y}_{k}^{T}\end{bmatrix}^{T}, (21) \displaystyle\mathbf{\Sigma_{k}^{\mathbf{v}}}:=\begin{bmatrix}\mathbf{\Sigma}_{k}^{\mathbf{v}}&\mathbf{O}\\ \mathbf{O}&\mathbf{\Sigma}_{k}^{\mathbf{u}}\end{bmatrix}, (22) \displaystyle\mathbf{g}_{k}(\mathbf{x}_{k}):=\begin{bmatrix}\mathbf{g}_{k}^{T}(\mathbf{x}_{k})&\mathbf{h}_{k}^{T}(\mathbf{x}_{k})\end{bmatrix}^{T}, (23) where \mathbf{O} is a zero matrix of appropriate dimension. If there are more sources of additional information, the quantities above are augmented with all of the required terms. This way, the soft constraint, GNSS reading and the prior estimate from Figure 2 can be incorporated to get the posterior estimate. II-A Improving Filtering Step Convergence Repeating the procedure from [ 15 ] which itself is built upon the approaches presented in [ 16 ] and [ 17 ] , one can interpret the filtering step as an instance of a non-linear least squares problem. Under the assumption that the prior distribution of the state estimate (from the prediction step) 1 1 1 The symbol \mathbf{x}^{k} denotes the set of all historical values \{\mathbf{x}_{1},\ldots,\mathbf{x}_{k}\} . , p(\mathbf{x}_{k}|\mathbf{z}^{k-1}) , and the likelihood of the measurement, p(\mathbf{z}_{k}|\mathbf{x}_{k}) , are normally distributed, we can write the following for the posterior distribution p(\mathbf{x}_{k}|\mathbf{z}^{k})\propto p(\mathbf{z}_{k}|\mathbf{x}_{k})p(\mathbf{x}_{k}|\mathbf{z}^{k-1})\\ \propto\exp\left[-\frac{1}{2}\left([\mathbf{z}_{k}-\mathbf{h}_{k}(\mathbf{x}_{k})]^{T}(\mathbf{\Sigma}_{k}^{\mathbf{v}})^{-1}[\cdots]\right.\right.\\ \left.\left.+[\hat{\mathbf{x}}_{k|k-1}-\mathbf{x}_{k}]^{T}\mathbf{P}_{k|k-1}^{-1}[\cdots]\right)\right], (24) where [\cdots] denotes repetition of the same term in the last set of brackets. To obtain the maximum a posteriori (MAP) estimate we have find the maximizer of the exponential function ( 24 ). Finding the posterior estimate is a result of the non-linear least squares optimization problem \mathop{\arg\min}_{\mathbf{x}_{k}\in\mathbb{R}^{n}}\left([\mathbf{z}_{k}-\mathbf{g}_{k}(\mathbf{x}_{k})]^{T}\left(\mathbf{\Sigma}_{k}^{\mathbf{v}}\right)^{-1}[\cdots]\right.+\\ \left.[\hat{\mathbf{x}}_{k|k-1}-\mathbf{x}_{k}]^{T}\mathbf{P}^{-1}_{k|k-1}[\cdots]\right)=\\ \mathop{\arg\min}_{\mathbf{x}_{k}\in\mathbb{R}^{n}}V(\mathbf{x}_{k}), (25) which can be solved using the Gauss-Newton method as described in [ 17 ] . Rewriting ( 14 ) into a recurrent form ( [ 17 ] ) results in \hat{\mathbf{x}}_{k}^{i+1}=\hat{\mathbf{x}}_{k}^{i}+\Delta_{k}^{i}, (26) where the step direction \Delta_{k}^{i} is defined as \Delta_{k}^{i}=\hat{\mathbf{x}}_{k|k-1}-\hat{\mathbf{x}}_{k}^{i}+\mathbf{K}_{k}^{i}\left(\mathbf{z}_{k}-\mathbf{g}_{k}(\hat{\mathbf{x}}_{k}^{i})-\mathbf{G}_{k}^{i}(\hat{\mathbf{x}}_{k|k-1}-\hat{\mathbf{x}}_{k}^{i})\right). (27) The reformulations in the ( 25 ) and ( 26 ) allow us to improve convergence properties of the filtering step. The basic IEKF scheme does not ensure improvement of ( 25 ) in subsequent iterations V(\hat{\mathbf{x}}_{k}^{i+1})\leq V(\hat{\mathbf{x}}_{k}^{i}), (28) but using the reformulations above, we can perform a constrained line search \alpha^{i}=\mathop{\arg\min}_{\alpha\in[0,1]}V(\hat{\mathbf{x}}_{k}^{i}+\alpha\Delta_{k}^{i}), (29) and perform the step of the iteration as \hat{\mathbf{x}}_{k}^{i+1}=\hat{\mathbf{x}}_{k}^{i}+\alpha^{i}\Delta_{k}^{i} (30) to make sure ( 28 ) does hold. The choice of \alpha=1 correspond to the usual EKF step. See [ 16 , 17 ] for more details. II-B Constraining the State Estimate To improve performance of a localization scheme for rail vehicles, a heuristic approach to attract the state estimates towards tracks was developed in [ 15 ] . If tracks are modelled as a set of waypoints (which is often the case), constraining the state estimate to the track network can be difficult using traditional techniques described in e.g. [ 18 ] because of the non-convex nature of such a constraint. The aforementioned heuristic technique fabricates a new position measurement which always lies in the vicinity of tracks. When such measurement is incorporated into the filtering scheme according to ( 21 )-( 23 ), the posterior estimate is driven closer to the track network. This soft constraint is constructed from waypoints of the track network which lie close to the prior estimate. Further details are described in [ 15 ] . The heuristic introduces additional hyperparameters which have to be tuned for performance improvement. Fig. 3: Proposed filtering scheme utilizing GNSS measurements and track map data. III GNSS Positioning GNSS satellites transmit a known pseudorandom code modulated onto the carrier signal. The receiver measures the frequency of the received carrier signal and compares it with its nominal value. The difference is the Doppler measurement which serves as a measurement of relative motion between the satellite and the receiver. The receiver also cross-correlates the received code with the code transmitted by the satellite. The estimated delay serves as a measure of distance between the satellite and the receiver. The distance is corrupted by multiple sources of error. Two major sources of error in urban environment are the multipath effect where the receiver receives multiple replica of the signal and the non-line-of-sight (NLOS) error, where the receiver only receives a reflection of the signal from other objects. The proposed localization scheme is shown in Figure 3 . When a new vector of pseudoranges from the individual GNSS satellites, \bar{\mathbf{z}} , with the covariance \bar{\mathbf{R}} becomes available, it is processed into a mixed distribution with the predicted measurement value ( \hat{\mathbf{z}}=g(\hat{\mathbf{x}}) , with covariance \hat{\mathbf{R}} ) corresponding to the current state estimate, \hat{\mathbf{x}} with covariance \mathbf{\Sigma} (the details are described below). The processed GNSS readings, \tilde{\mathbf{z}} with covariance \tilde{\mathbf{R}} , are passed into an IEKF which also takes the track map into the account when yielding the posterior state estimate (described above). The GNSS measurement is naturally influenced by the position and velocity of the satellites, \mathbf{p}^{(i)} and \dot{\mathbf{p}}^{(i)} , respectively. In this section, GNSS positioning solution is described. First GNSS pseudorange and Doppler observables models are described. Then a Kalman filter model for position estimation is presented. Lastly, equations for conversion of coordinates from Earth-centered, Earth-fixed (ECEF) frame to the geodetic (latitude, longitude, altitude) frame and to the east, north, up (ENU) frame are described. III-A GNSS Observables Models Pseudorange and Doppler shift observables were used for position and velocity estimation. III-A 1 Pseudorange The pseudorange measurement \rho^{(i)} belonging to the i -th satellite can be modelled as \rho^{(i)}=r^{(i)}+c(\delta t_{r}-\delta t^{(i)})+I^{(i)}+T^{(i)}+M^{(i)}+\epsilon^{(i)}, (31) where r^{(i)} is the true distance from the receiver position at signal reception time to satellite position at transmission time, c is the speed of light, \delta t_{r} is the receiver clock offset, \delta t^{(i)} is the satellite clock error, I^{(i)} and T^{(i)} are ionospheric and tropospheric delays, respectively, M^{(i)} is the multipath error and \epsilon^{(i)} are other unmodelled sources of error. Receiver clock offset \delta t_{r} needs to be estimated. The satellite clock error \delta t^{(i)} is the sum \delta t^{(i)}=\Delta_{\mathrm{\mathrm{clk}}}t^{(i)}+\Delta_{\mathrm{rel}}t^{(i)}. (32) The symbol \Delta_{\mathrm{clk}}t^{(i)} denotes the satellite internal clock offset and can be computed using the parameters included in satellite navigation message [ 19 ] and \Delta_{\mathrm{rel}}t^{(i)} is relativistic clock error and can be computed as [ 20 ] \Delta_{\mathrm{rel}}=-2\frac{\mathbf{p}^{(i)}\cdot\mathbf{\dot{p}}^{(i)}}{c^{2}}, (33) with \mathbf{p}^{(i)} , \mathbf{\dot{p}}^{(i)} being the satellites position and velocity in ECEF coordinate system. Different models exist to estimate I^{(i)} . Single frequency receivers rely on approximation models such as the GPS Klobuchar model or Galileo NeQuick model ( [ 21 , 22 ] ) whose parameters are broadcasted in satellite navigation messages. The I^{(i)} is frequency-dependent, so when using multi-frequency receiver, it can be compensated for using the equation from [ 23 ] \hat{\rho}^{(i)}=\frac{f_{1}^{2}\hat{\rho}_{1}^{(i)}-f_{2}^{2}\hat{\rho}_{2}^{(i)}}{f_{1}^{2}-f_{2}^{2}}. (34) Here, \hat{\rho}^{(i)} represents the ionosphere-delay-free pseudorange measurement, f_{1},f_{2} are frequencies of the carrier signals, and \hat{\rho}_{1}^{(i)},\hat{\rho}_{2}^{(i)} are their respective pseudorange measurements corrected for other known sources of error. The tropospheric delay was neglected for the purposes of this paper, but models exist to compensate for the error [ 24 , 25 , 26 ] . We believe this simplification to be justified as the contribution of the tropospheric delay to the pseudorange measurement error is relatively low compared to other sources of error in urban environment such as the multipath error. M^{(i)} and \epsilon^{(i)} were modelled as single additive white noise. Covariance and mean value of the noise were determined by mixing the distribution of the measured pseudorange and the theoretic pseudorange value distribution predicted by Kalman filter. This will be further discussed in section III-B2 . III-A 2 Doppler shift The Doppler shift observable is a measure of the relative motion between the receiver and the i -th satellite. It can be modelled as \dot{\rho}^{(i)}=\lambda\Delta f=(\dot{\mathbf{p}}^{(i)}-\dot{\mathbf{p}}_{r})\mathbf{L}^{(i)}+c\delta\dot{t}_{r}+\nu^{(i)}, (35) where \dot{\rho}^{(i)} is the measurement of the magnitude of relative velocity, \lambda is the carrier wavelength, \Delta f is the measured deviation from carrier nominal frequency, \mathbf{\dot{p}}^{(i)},\mathbf{\dot{p}}_{r} are the true satellite and receiver velocities in ECEF frame, \mathbf{L}^{(i)} is the line of sight vector \mathbf{L}^{(i)}=\frac{\mathbf{p}_{r}-\mathbf{p}^{(i)}}{\|\mathbf{p}_{r}-\mathbf{p}^{(i)}\|}, (36) \delta\dot{t}_{r} is receiver clock bias rate which needs to be estimated and \nu^{(i)} is measurement noise assumed to be white and Gaussian. III-B GNSS Kalman Filter Model III-B 1 System model An interated extended Kalman filter was used to estimate the augmented state vector \mathbf{x}=\begin{bmatrix}\mathbf{p}_{r}^{T}&\dot{\mathbf{p}}_{r}^{T}&c\delta t_{r}&c\delta\dot{t}_{r}\end{bmatrix}^{T} . The constant velocity model augmented by the clock error model \displaystyle\mathbf{x}_{k+1}=\mathbf{F}\mathbf{x}_{k}=\begin{bmatrix}\mathbf{I}&\Delta t\,\mathbf{I}&0&0\\ 0&\mathbf{I}&0&0\\ 0&0&1&\Delta t\\ 0&0&0&1\end{bmatrix}\mathbf{x}_{k}+\mathbf{\omega}_{k} (37) was used, where \mathbf{\omega}_{k} is the process noise, \mathbf{I} is the identity matrix and \Delta t is the sampling period. Subtracting the known deterministic errors from equation ( 31 ) gives us the pseudorange measurement equation \displaystyle\mathbf{g}_{k}^{\rho^{(i)}}(\mathbf{x_{k}}) \displaystyle=\rho^{(i)}+\delta t^{(i)}-I^{(i)} \displaystyle=\|\mathbf{p}_{r}-\mathbf{p}^{(i)}\|+c\delta t_{r}+\epsilon+M^{(i)}. (38) Linearizing equation ( III-B1 ) around current state yields the pseudorange measurement matrix \displaystyle\mathbf{G}_{k}^{\rho^{(i)}} \displaystyle=\begin{bmatrix}L_{x}^{(i)}&L_{y}^{(i)}&L_{z}^{(i)}&0&0&0&1&0\end{bmatrix}, (39) where L_{x}^{(i)},L_{y}^{(i)},L_{z}^{(i)} are the components of the line of sight vector \mathbf{L}^{(i)} . Similarly, the Doppler measurement given by equation ( 35 ) can be linearized around the current velocity and clock error rate, which yields the Doppler measurement matrix: \mathbf{G}_{k}^{\dot{\rho}^{(i)}}=\begin{bmatrix}0&0&0&L_{x}^{(i)}&L_{y}^{(i)}&L_{z}^{(i)}&0&1\end{bmatrix}. (40) III-B 2 Measurement Noise Computation The variance \mathbf{\bar{R}} of the pseudorange measurement noise \epsilon^{(i)} was selected using the model used in [ 27 , 28 ] : \mathbf{\bar{R}}=\frac{10^{-\frac{CN_{o}-T}{a}}\left((\frac{A}{10^{-\frac{F-T}{a}}}-1)\frac{CN_{o}-T}{F-T}+1\right)}{\sin^{2}E}, (41) where E is the elevation angle, CN_{o} is the carrier signal to noise ratio, T=50,\ F=10,\ A=30,\ a=40 are empirical constants. As previously mentioned, however, measurements are often corrupted not only by zero mean noise, but also by multipath error, which has unknown mean and covariance. To partially compensate for this, the measurement \bar{z} and its covariance \mathbf{\bar{R}} were not used directly in the data step of the Kalman filter. Instead a mixed distribution \tilde{z} of the measurement \bar{z} and the theoretical (predicted) value \hat{z} of the measurement is used. This pulls the mean values of the measurements closer to their predicted values and inflates the covariance of measurements that are highly inconsistent with the predicted position thus smoothing sudden jumps in pseudorange measurements caused by multipath and NLOS. The mixing is done individually for each satellite. The computation of the mixed distribution is represented by the Distribution mixing block in Figure 3 . The mixed pseudorange measurement distribution is described by the mean \tilde{z} and variance \mathbf{\tilde{R}} . These later serve as the measurement and its covariance and are computed using equations (for clarity, superscripts (i) are omitted) \displaystyle\mu_{a}=\frac{\bar{\mathbf{R}}_{k}^{-1}}{\bar{\mathbf{R}}_{k}^{-1}+\hat{\mathbf{R}}_{k}^{-1}}, (42) \displaystyle\mu_{b}=1-\mu_{a}, (43) \displaystyle\tilde{z}_{k}=\mu_{a}\bar{z}_{k}+\mu_{b}\hat{z}_{k}, (44) \displaystyle\tilde{\mathbf{R}}_{k}=\mu_{a}(\bar{\mathbf{R}}_{k}+(\bar{z}_{k}-\tilde{z}_{k})^{2})+\mu_{b}(\hat{\mathbf{R}}_{k}+(\hat{z}_{k}-\tilde{z}_{k})^{2}), (45) where \bar{z}_{k} is the value measured by the receiver corrected for known deterministic errors, \mu_{a},\mu_{b} are the weights of the measurement and the prediction and \hat{z}_{k},\mathbf{\hat{R}} are the predicted values of the measurement and the variance of the prediction computed by projecting the covariance of the position estimate onto the line of sight vector \displaystyle\hat{z}_{k} \displaystyle=g_{k}(\mathbf{x}_{k}), (46) \displaystyle\mathbf{\hat{R}} \displaystyle=\mathbf{L}^{T}\mathbf{P}_{k|k-1}\mathbf{L}. (47) III-C Coordinate Frame Conversions The GNSS positioning described above was done in ECEF frame. In order to convert position to geodetic coordinates, one needs to solve the following equations \displaystyle p_{x} \displaystyle=(R_{N}+h)\cos\phi\cos\lambda, (48) \displaystyle p_{y} \displaystyle=(R_{N}+h)\cos\phi\sin\lambda, (49) \displaystyle p_{z} \displaystyle=(R_{N}+h-e^{2}R_{N})\sin\phi, (50) \displaystyle R_{N} \displaystyle=a/(1-e^{2}\sin^{2}\phi)^{\frac{1}{2}}, (51) where \phi is geodetic latitude, \lambda is geodetic longitude, h is height above ellipsoid, a=$6\,378\,137\text{\,}\mathrm{m}$ is WGS-84 equatorial radius and e^{2}=0.00669437999 is WGS-84 squared ellipsoid eccentricity. Algorithms for solving equations ( 48 )-( 51 ) can be found in [ 29 ] . The velocity and covariance matrix can be rotated to local tangent plane (ENU frame) coordinates using the rotation matrix from [ 23 ] \mathbf{T}=\begin{bmatrix}-\sin\lambda&\cos\lambda&0\\ -\cos\lambda\sin\phi&-\sin\lambda\sin\phi&\cos\phi\\ \cos\lambda\cos\phi&\sin\lambda\cos\phi&\sin\phi\end{bmatrix}. (52) ENU velocity \mathbf{v}_{\mathrm{ENU}} can then be computed as \mathbf{v}_{\mathrm{ENU}}=\mathbf{T}\mathbf{\dot{p}}_{r}. (53) Rotation matrix \mathbf{T} can be also used to rotate the position or velocity covariance matrix from ECEF to ENU frame \Sigma_{\mathrm{ENU}}=\mathbf{T}\Sigma_{\mathrm{ECEF}}\mathbf{T}^{T}. (54) IV EXAMPLE The proposed algorithm was first tested in a simulation and then on real data collected in Prague. IV-A Simulation A vehicle moving north in a straight line was simulated using a satellite constellation depicted in Figure 4 . A total of 5 GPS satellites were simulated, 3 with clear line of sight (LOS) measurements during the entire simulation, 2 with NLOS measurements for a part of the simulation. The pseudorange measurements were simulated as the sum \bar{\rho}^{(i)}=\|{\mathbf{p}_{r}-\mathbf{p}^{(i)}}\|+\epsilon^{(i)}+b+M^{(i)}, (55) where \bar{\rho}^{(i)} is the simulated measurement belonging to the i -th satellite, \|{\mathbf{p}_{r}-\mathbf{p}^{(i)}}\| is the distance from the i -th satellite to the receiver, b is a constant simulating the receiver clock bias, \epsilon^{(i)}\sim\mathcal{N}($0\text{\,}\mathrm{m}$,$3\text{\,}{\mathrm{m}}^{2}$) for LOS and \epsilon^{(i)}\sim\mathcal{N}($0\text{\,}\mathrm{m}$,$10\text{\,}{\mathrm{m}}^{2}$) for multipath/NLOS measurements is the measurement noise and M^{(i)}=$0\text{\,}\mathrm{m}$ for LOS and a uniformly distributed random value M^{(i)}\subset($5\text{\,}\mathrm{m}$,$20\text{\,}\mathrm{m}$) for multipath/NLOS measurements is the offset caused by the multipath/NLOS signal propagation. Doppler measurements were not used in the simulation scenario. Fig. 4: Skyplot of the visible satellites used in simulation. The green circles represent healthy measurements, red represent measurements corrupted by multipath or NLOS signals. An illustration of the simulated effect of the distribution mixing on the position estimate in multipath/NLOS environment is depicted in Figure 5 . The RMS error of the position estimate (RMS distance from ground truth) for different filters is shown in Table I . The baseline localization scheme which does not utilize the mixed distribution or constraining the state estimate results in the largest RMSE value. The RMSE lowers with the proposed techniques (distribution mixing, constraining the state) being applied during the estimation process. Fig. 5: Illustration of the simulated effect of multipath on the position estimate before being projected onto the map of the track. TABLE I: Root-mean-squared distance of the simulated position estimates from ground-truth Without soft constr. With soft constr. With distribution mixing 6.8\text{\,}\mathrm{m} 6.0\text{\,}\mathrm{m} Without distribution mixing 13.3\text{\,}\mathrm{m} 9.7\text{\,}\mathrm{m} IV-B Experiment The raw pseudorange and Doppler measurement data were collected using a U-Blox ZED-F9R satellite navigation receiver. The antenna was placed inside of a tram travelling along the route of line 22 in Prague. The data were recorded between the Vršovické náměstí and Malostranská stops. A total of 1430 seconds with 1 second sampling period were recorded. The GPS, BeiDou and Galileo observables were used. OpenStreetMap data were used as an aiding map [ 30 ] . Perpendicular distances of the position estimates from the track according to the map were calculated. Table II shows the root-mean-squared distance from the track map. For comparison, the RMS distance of state estimates provided by the U-Blox commercial solution was included. As in Table I , the proposed solution using both the mixed distribution and the map aid results in the lowest RMS distance value, however, without using the map aid, the filter using the mixed distribution has higher RMS distance value than the baseline filter. This is likely due to the fact that the distribution mixing has a low-pass effect on the measurement sequence. Therefore, when the state is not constrained to the track network and the vehicle remains under the effect of multipath/NLOS signals for a prolonged period of time, the position estimate slowly diverges from the true position. When the vehicle leaves the multipath/NLOS environment, the low-pass effect of the distribution mixing prevents the state estimate from quickly recovering from the influence of the past multipath/NLOS measurements. Constraining the state estimate to the track network in each time step compensates this effect. Figure 6 shows the development of the distance from track in time. It can be seen that the estimates coming from the filters which lack the constraint on the state estimate lie further of the tram tracks for most of the recorded period. Figure 7 compares the distances between consecutive position estimates of the proposed filter that uses the distribution mixing and the baseline filter. As we can see, using distribution mixing leads to smoother trajectory that resembles realistic speed profile of the vehicle. Figure 8 shows the location estimates of the tested filters. The vehicle travelled northbound through a park (open space) where the position estimates matched the track. Then, as the vehicle entered a narrow street, the raw position measurements shifted west due to multipath-affected pseudorange measurements. The map aided estimates remained close to the track. The filter using the distribution mixing followed the track more closely than the baseline filter. Fig. 6: Distance of position estimates from the orthogonal projection onto track. Fig. 7: Distance between consecutive position estimates. Fig. 8: Visualized trajectories of the state estimates from the four filters. The accuracy deteriorates significantly when the trams enters an urban corridor. TABLE II: Root-mean-squared distance of the position estimates from the orthogonal projection onto track map Without soft constr. With soft constr. With distribution mixing 9.29\text{\,}\mathrm{m} 0.91\text{\,}\mathrm{m} Without distribution mixing 8.55\text{\,}\mathrm{m} 1.19\text{\,}\mathrm{m} U-Blox solution – 5.32\text{\,}\mathrm{m} V CONCLUSION A method for tram localization utilizing the combination of GNSS measurements with map of the track using soft-constrained iterated Kalman filter was presented. A GNSS pseudorange and Doppler measurement models together with a satellite measurement weighting scheme were described. The performance of the mixed distribution and the soft constraint based algorithm was tested in a simulation environment and also on real data. We have observed, that while using the mixed distribution, it is necessary to use map or other source of information to be able to avoid measurement drift. It was shown that activation of both of the features resulted in best performance compared to the baseline filter which shows the potential of this approach for the problem of tram localization. Future work The presented filter might be further improved by using the interacting multiple models (IMM) method. This would allow us to better model different dynamic modes of tram movement such as stationary vehicle, vehicle moving in a straight line segment and a vehicle moving along a curve. This could, especially in the case of the stationary vehicle model, further decrease the drift of the measurement. Using bank of models would also allow us to extend the functionality to take track branching into account which would improve the positioning especially in tram depots where track-exact positioning is required but naive projection onto closest track might lead to errors. The proposed method of using the mixed distribution helps smooth out the estimates. However, when enough satellites are in view, it might be beneficial to discard some measurements completely or to not modify some at all. A decision scheme for outlier rejection should therefore be considered. Such scheme might employ \chi^{2} based test to decide whether the measured pseudorange value falls within the predicted distribution or is biased. Also, dynamic bias tracking may be included to replace the presented ”snapshot-based” approach. Finally, it could be beneficial to also constraint the state prediction step of the filter and not only during the data update step, which is currently the case. REFERENCES