Development of a Kalman Filter in the Gauss-Helmert Model for Reliability Analysis in Orientation Determination with Smartphone Sensors

The topic of indoor positioning and indoor navigation by using observations from smartphone sensors is very challenging as the determined trajectories can be subject to significant deviations compared to the route travelled in reality. Especially the calculation of the direction of movement is the critical part of pedestrian positioning approaches such as Pedestrian Dead Reckoning (“PDR”). Due to distinct systematic effects in filtered trajectories, it can be assumed that there are systematic deviations present in the observations from smartphone sensors. This article has two aims: one is to enable the estimation of partial redundancies for each observation as well as for observation groups. Partial redundancies are a measure for the reliability indicating how well systematic deviations can be detected in single observations used in PDR. The second aim is to analyze the behavior of partial redundancy by modifying the stochastic and functional model of the Kalman filter. The equations relating the observations to the orientation are condition equations, which do not exhibit the typical structure of the Gauss-Markov model (“GMM”), wherein the observations are linear and can be formulated as functions of the states. To calculate and analyze the partial redundancy of the observations from smartphone-sensors used in PDR, the system equation and the measurement equation of a Kalman filter as well as the redundancy matrix need to be derived in the Gauss-Helmert model (“GHM”). These derivations are introduced in this article and lead to a novel Kalman filter structure based on condition equations, enabling reliability assessment of each observation.


Introduction
Determining the orientation in pedestrian navigation with geometric-based approaches is an essential step for positioning. There are several possibilities to mathematically parameterize the orientation. In [1] three possibilities are given: the direction-cosine-matrix, Euler angles and quaternions. Discussion on the advantages and disadvantages of these concepts can be found in [2]. In this article the Euler angles-roll, pitch and yaw-are used as it is the yaw angle that is especially necessary for calculating the 2D-Position in pedestrian navigation approaches like Pedestrian Dead Reckoning ("PDR"). The orientation can be calculated directly by the use of an accelerometer and a magnetometer respectively a gyroscope, which are nowadays integrated in most of the available smartphones. Each of these sensors is subject to specific systematic effects [3], which have to be considered in detail when integrating low-cost sensors in smartphones. These systematic deviations clearly can have a noticeable impact on the resulting position of PDR, which makes determining the orientation the critical part.

Existing Approach
In the Kalman filter used for orientation determination in this article, the state parameters are the Euler angles roll ϕ, pitch θ and yaw ψ. Based on the assumption that roll and pitch are constant while the user is walking, they are predicted at actual epoch k with a random-walk model (1) and (2). The yaw angle is predicted with two different system equations, whereby (3) will be used if the user is walking straight and (4) will be used at detected turns. In the second case the observed turn rates from gyroscope g y,k and g z,k are included as control quantities summed in the vector u k . By doing this, the predicted yaw should immediately follow the user's turn. The noise components of the state parameters are c k−1,ϕ , c k−1,θ , c k−1,ψ and ∆t is the time interval between two consecutive Kalman updates: f 3 : ψ k = ψ k−1 + ∆t cos θ k−1 g y,k sin ϕ k−1 + g z,k cos ϕ k−1 + c k−1,ψ Turn detection is done by applying a statistical test on the filter innovations of the yaw angle d ψ,i [29,31]. The null hypothesis H 0 of this statistical test says that the vector d ψ containing the filter innovations d ψ,i from the last n epochs is equal to the zero vector (5), whereas the alternate hypothesis H A states that d ψ is significantly different to the zero vector (6). If the test value exceeds the corresponding quantile of the chi-square distribution (7), (4) will be used to predict the yaw angle. D ψ is the variance-covariance matrix (VCM) of the innovation vector d ψ and only contains variances on the diagonal belonging to the corresponding d ψ,i . This is a simplification, as auto-covariances may be present. The use of random-walk (3) results in smoother trajectories in sections when the user walks straight. By neglecting the observations from gyroscope in the random-walk model, the influence of systematic sensor deviations (gyro-drift) on the filter result is minimized: For the update equations also the VCM of the predicted state is needed (8): Therein, Σ ii,k -with the index i =x k−1 , u, c-are the VCMs of the corresponding observation groups in epoch k. T k,k−1 is the state transition matrix, U k,k−1 the control matrix and C k,k−1 is the noise matrix, each referred to epoch k. These system matrices are Jacobi matrices and in general contain the derivatives of the system equations with respect to the corresponding observation group [27][28][29]. Equations (9)- (11) show the system matrices for the approach presented in this section where E is the identity matrix.
The observations in the measurement equation are directly observed Euler angles, as also shown in [32]. Therefore, the design matrix A m,k of the Kalman filter equals the identity matrix. They are calculated outside of the Kalman filter ((12)- (14)) by using observed accelerations a x,k , a y,k , a z,k and magnetic flux densities m x,k , m y,k , m z,k [33]. The accelerations are filtered in a separate Kalman filter to remove high-frequency components due to the movement of the user [2]: The yaw angle calculated with (14) can be subject to magnetic perturbations, especially inside buildings. The redundant determination of the Euler angles in the Kalman filter by using the system equation and the measurement equation dampens the influence of magnetic perturbations. Additionally, the standard deviation of the magnetometer measurements σ m will be increased if the magnitude of the measured magnetic field m k is not stable (15), leading to an adaptive standard deviation σ m,k for each Kalman filter epoch. As the geomagnetic field should be constant related to the dimensions of a building, it will be assumed that magnetic perturbations are present if the measured magnitude changes: Using the covariance propagation law, the VCM belonging to the directly observed Euler angles Σ ϕθψ,k is derived (16), wherein H k is a Jacobi matrix containing the derivatives of (12)- (14) with respect to the accelerometer and magnetometer measurements.

Problem Description
To determine the user's position, the step length is also estimated and will be used with fixed variance in PDR. Figure 1 shows a trajectory calculated with PDR, whereby the yaw is estimated with the Kalman filter mentioned in Section 2.1. Additionally, the 95% confidence ellipses as well as the reference trajectory are part of Figure 1. This measured trajectory will also be used to analyze the partial redundancy in Section 3. During the measurements, the user held the smartphone in portrait mode (Figure 2 left, ϕ k~0 • ). The reference trajectory is calculated from the measurements of the TS16 total station (Leica Geosystems, Heerbrugg, Switzerland) which is tracking the user by the help of a 360 • -mini-prism on a helmet (Figure 2 right). scale. Hence in Figure 1, the estimated orientation causes the deviations between the estimated and the reference trajectory. As these deviations are not captured by the confidence ellipses-which are a measure for the precision [34]-there are two possible reasons for their appearance: systematic deviations in the observed data or non-Gaussian distributed data. Because of the obvious systematics in the estimated trajectory, it is assumed that systematic deviations are present in the observed data. Reliability theory deals with the detection of large systematic deviations (inner reliability) and their effect on the estimated quantities (outer reliability) [35,36]. To identify the measurements responsible for the systematic deviations of the orientation between estimated and reference trajectory, the inner reliability is used. Here the partial redundancies ri play a key role. According to [29,37,38], all quantities with stochastic information can be treated as observations.   Reliability theory deals with the detection of large systematic deviations (inner reliability) and their effect on the estimated quantities (outer reliability) [35,36]. To identify the measurements responsible for the systematic deviations of the orientation between estimated and reference trajectory, the inner reliability is used. Here the partial redundancies ri play a key role. According to [29,37,38], all quantities with stochastic information can be treated as observations.  In PDR, the yaw angle is responsible for the shape of the trajectory and the step length for the scale. Hence in Figure 1, the estimated orientation causes the deviations between the estimated and the reference trajectory. As these deviations are not captured by the confidence ellipses-which are a measure for the precision [34]-there are two possible reasons for their appearance: systematic deviations in the observed data or non-Gaussian distributed data. Because of the obvious systematics in the estimated trajectory, it is assumed that systematic deviations are present in the observed data.
Reliability theory deals with the detection of large systematic deviations (inner reliability) and their effect on the estimated quantities (outer reliability) [35,36]. To identify the measurements responsible for the systematic deviations of the orientation between estimated and reference trajectory, the inner reliability is used. Here the partial redundancies r i play a key role. According to [29,37,38], all quantities with stochastic information can be treated as observations.
Observations related to the system equation are the estimated state from the previous epochx k−1 , the control variables u and the noise variables c. The observations of the measurement equation are  (20) the partial redundancy can be calculated for the previously mentioned observations according to [29]: Therein, n i is the number of observations in each observation group and D k is the VCM of the filter innovation [27][28][29]. e j is the unity vector to select the corresponding r i respectively diagonal element. In the above formulation of the Kalman filter, the r i can only be calculated for the directly observed angles in the measurement equation but not for the original observations from accelerometer and magnetometer due to the structure of (12)-(14).

Kalman Filter in the Gauss-Helmert Model
In the GMM, the true observations l can be modeled as a function of the true parameters x-which also holds for the estimated observationsl and estimated parametersx (21). As mentioned above, the measurement Equations (12)- (14) have another structure, which matches the GHM [39] shown in (22). Hence, the update equations of the Kalman filter have to be derived in the GHM, to directly use the observations from smartphone-sensors. Afterwards, the corresponding r i need to be derived for this case. In [30] the GHM is also used to estimate variance components for the system noise. Though, there is still the assumption of using the GMM in the measurement equation and the results cannot be used in this article.
As the functional relations (22) are non-linear in general-and especially in this article-they have to be linearized. Neither the real observations and parameters, nor their estimated values are known a priori. Hence, to do Taylor linearization, approximate values l 0 and x 0 have to be used which also have to satisfy the non-linear relations [34]. In least-squares, especially x 0 is assumed to be non-stochastic. According to [40], l 0 can be replaced by the observed data l after linearization, which results in the linearized, functional model (23): The first term corresponds to the misclosure vector w, the bracketed expression in the second term equals the stochastic additions ∆x to the approximate parameters x 0 and the bracketed expression in the third term equals the residuals v. Formula (23) is only valid for the first iteration of least-squares estimation, because linearization of the functional model necessitates an iterative approach. In the subsequent iterations, the functional model is always linearized at the previously estimated observations and parameters [40]. Formulas (24)- (27) show, how the searched quantities with corresponding VCM are calculated in the GHM in the context of least-squares [41]: B is the observation matrix, Σ ∆x∆x is the VCM of the estimated additions, Σ ll the VCM of the observations and Σ vv is the VCM of the residuals. It is important that A and B are column-regular matrices. Otherwise the inverse matrices cannot be calculated. To avoid singular matrices, the functional relations have to be chosen, such that there will be no linearly dependent columns in these matrices.
The Kalman filter is based on sequential least-squares with an additional state transition model. The state transition model respectively system equation is described in general by non-linear, stochastic, vector-matrix differential equations. We assume, that such differential equations have the form shown in (28) after linearization, which is also basis for deriving the system equation in [27][28][29]: .
t is the continuous time variable. The system matrix F, control-input matrix L and noise-input matrix G are assumed to be time-invariant. Solving such differential equations in the state space-also shown in [27][28][29]-unambiguously defines the state parameters at time k and gives the approximate formulation (29): As mentioned in [27], the predicted parameter vector x k should be calculated from the original set of functions (30) in the non-linear case to avoid linearization errors. Equation (29) is necessary for calculating the VCM of x k with the covariance propagation law (8).
The system can also be described by several sub-systems which yields in an over-determined system equation. This will be dealt with in the next section, where one yaw angle will be estimated from multiple trajectory data. Thus, the system equation decomposes into two sets of equations. The first set unambiguously defines the predicted parameters by usingx k−1 , u k and c k which is already shown in (29) respectively (30). This set of equations will be-analogue to [29]-formulated in the GHM, such that it contains the residuals belonging tox k−1 , u k and c k (31). The derivation of (31) can be found in the Appendix A: The second set consists of condition equations, having the same structure like (23). These condition equations contain the same quantities like the first set of equations and can therefore be formulated as shown in (32). w * s,k are the misclosures, arising because of the overdetermined system equation respectively condition equations. A * s,k is the design matrix and T * k.k−1 , U * k,k−1 and C * k,k−1 are the observation matrices which belong to the condition equations of the system equation: The functional model of the measurement equation has the structure (23). Fusing the system equation and the measurement equation leads to the functional model of a Kalman filter formulated in the GHM with additional condition equations in the system Equation (33): Now the formulas of the GHM in least-squares can be applied and the parameters with corresponding VCM can be calculated. Equation (34) shows the VCM of the estimated parameters, which is derived by inserting A and B into (24): Σxx ,s,k is the VCM of the parameters which would be the result of a Kalman filter only considering the system equation. Similarly, Σxx ,m,k is the VCM of the parameters if only the measurement equation would be considered in the Kalman filter. Σxx ,k is the inverse of the sum of these two matrices. To further process (34), the Woodbury formula for matrix inversion-according to [42]-is applied (35), where M, N, O and P are arbitrary matrices and not related to the derivations made in this section: Depending on which term of the sum in (34) is chosen to be the matrix M in the Woodbury formula (35), results will show two equivalent representations (36) and (37) of the VCM of the estimated parameters. It has to be mentioned, that this VCM corresponds tox k and not to ∆x k . The reason is that x 0 equals x k , which is stochastic and its stochastic information is implicitly integrated by adding its calculation to the functional model ( (31) and (33)). Whereas in least-squares x 0 is non-stochastic and therefore Σxx equals Σ ∆x∆x .
By comparing (36) with the update equation for the VCM of the estimated parameters in the GMM (see [29] or [27]), the VCM of the filter innovation D m,k and the gain matrix K m,k -belonging to the measurement equation-can be found ((39) and (41)). In the same manner, the VCM of the filter innovation D s,k of and the gain matrix K s,k belonging to the system equation are derived ( (38) and (40)): The estimated additions to the approximate parameters are derived by using (25) and (33). Formula (42) shows these additions, where the results from the previous paragraph are already considered. Hence, it includes corrections respectively updates for the system equation as well as for the measurement equation: If the system equation is not overdetermined, (32) will not be used in the functional model (33), which leads to simplifications in the update equations. The classical Kalman filter update equations as well as the two GHM variants are summarized in Table 1.

Gauss-Markov
Gauss-Helmert (Simplification) Gauss-Helmert Approaches whose aim is to detect systematic deviations in the observations respectively to quantify the inner reliability in the GMM, are often based on the disturbed residuals v [43]. The error-term ∇v in (43) is caused by the systematic deviations in the observations, summed in the error-vector ∇l: v = v + ∇v (43) r i is the factor which specifies how an observation deviation ∇l i influences the corresponding residual v i (44). Hence, high r i are desirable to detect systematic deviations [29]: Transferring these thoughts to the GHM, (26) has to be used to derive R, containing the r i on its diagonal. R is an idempotent matrix, whose trace equals the overall redundancy of the estimation problem [34]. Formula (26) only contains the misclosures w, which can be linearized by Bl according to [34]. If ∇l is taken into account, results show the disturbed model (45): Thus, there is a direct relation between observations and residuals and the redundancy matrix for the GHM is now available (46): By using (27), (46) equals the matrix product Σ vv Σ −1 ll , whereby the analogy to the GMM is stated again [34]. The proof that the trace of R equals the overall redundancy can be found in Appendix B.

Results
In this section the results of the trajectory shown in Section 2.2. will be analyzed by applying the simplified GHM (Table 1) on the approach described in Section 2.1. In a first step, the influence of the observation groups-accelerometer a, magnetometer m, estimated parameters of the previous epoch x, system noise c and gyroscope g-on the estimated orientation will be assessed by means of the r i . Figure 3 shows a representative section of the calculated group redundancies for two different specifications of the sensor-and system noise standard deviations. For the beginning the focus lies on the left part of Figure 3, where the original standard deviations are used ( Table 2). These are derived for each observation in the trajectory parts where the user walked straight. Using these standard deviations leads to a small partial redundancy of the observation groups (x, c, g) of the system equation in comparison to the ones of the measurement equation (a, m). This means that the estimated orientation mainly relies on the system equation. The reason for the high weight of the system equation is that the resulting trajectory should be smoothed [32]. The problem is that if the model assumptions made in the system equation do not capture the reality, the resulting deviations have high influence on the estimated orientation. There are mainly two possibilities to intervene in the partial redundancy respectively the inner reliability, which will be covered in the next two sections.

Adaption of the Stochastic Model
Adaption of the stochastic model means to change the standard deviations of the different observations. To align the group redundancies of the observation groups (Figure 3 left), the standard deviations of the sensors and system noise are changed until an improvement is visible. This leads to the group redundancies in the right part of Figure 3, where the adapted standard deviations of Table 2 were used. The weight of the system equation in comparison to the measurement equation is now reduced, whereas the ri of the gyroscope and the system noise are now clearly higher. The ri of the magnetometer get close to the ones of the gyroscope if it is used when the user is turning, which yields in good mutual controllability.
To identify the critical observations, the ri of the individual observations are analyzed. Figure 4 shows, that the ri of the accelerometer are continuously higher than 0.2, which means that controllability is sufficient. Calculating the thresholds from which deviations can be-statistically For the beginning the focus lies on the left part of Figure 3, where the original standard deviations are used (Table 2). These are derived for each observation in the trajectory parts where the user walked straight. Using these standard deviations leads to a small partial redundancy of the observation groups (x, c, g) of the system equation in comparison to the ones of the measurement equation (a, m). This means that the estimated orientation mainly relies on the system equation. The reason for the high weight of the system equation is that the resulting trajectory should be smoothed [32]. The problem is that if the model assumptions made in the system equation do not capture the reality, the resulting deviations have high influence on the estimated orientation. There are mainly two possibilities to intervene in the partial redundancy respectively the inner reliability, which will be covered in the next two sections.

Adaption of the Stochastic Model
Adaption of the stochastic model means to change the standard deviations of the different observations. To align the group redundancies of the observation groups (Figure 3 left), the standard deviations of the sensors and system noise are changed until an improvement is visible. This leads to the group redundancies in the right part of Figure 3, where the adapted standard deviations of Table 2 were used. The weight of the system equation in comparison to the measurement equation is now reduced, whereas the r i of the gyroscope and the system noise are now clearly higher. The r i of the magnetometer get close to the ones of the gyroscope if it is used when the user is turning, which yields in good mutual controllability.
To identify the critical observations, the r i of the individual observations are analyzed. Figure 4 shows, that the r i of the accelerometer are continuously higher than 0.2, which means that controllability is sufficient. Calculating the thresholds from which deviations can be-statistically justified-detected (according to [29]), gives~1.4 m/s 2 for the y-component of the accelerometer and~2 m/s 2 for the x-and z-component. The user's motion causes systematic deviations which exceeds these thresholds. Hence, accelerometer observations which should not be used for calculating pitch and roll can be detected.  The ri of the magnetometer show a remarkable, alternating behavior. In the trajectory parts where the user walks straight, the ri of my are close to zero. Whereas in parts where the user turns, controllability of mx and mz is bad. If there are systematic deviations in these observations, they cannot be detected and have a high influence on the estimated orientation angles. The ri of xϕ and xθ are again continuously higher than 0.2 and therefore sufficiently controlled. The same findings hold for cϕ and cθ, whereas cψ is totally uncontrolled. Generally the ri of the previously estimated parameters and the system noise behave in a similar manner. gy is also uncontrolled as its ri is very close to zero. The ri of gz are again higher than 0.2. The behavior of the ri of the previously estimated yaw angle is interesting, as they go up to 0.25 if the gyroscope measurements are used in the system equation. If the gyroscope is not used in the following epochs the ri decrease.
From the analysis of Figure 4 it can be concluded that there are uncontrollable observations in this approach, even if the standard deviations are adapted. To better understand the behavior of the ri, the influence of the change of the standard deviation σi of one observation on the partial redundancy of the other observations is analyzed. This analysis should support an aimed change of the standard deviations to improve the ri. Table 3 shows how the ri change, if the standard deviation of one observation is multiplied with the factor 10 (left sign in Table 3) respectively 0.1 (right sign in Table 3). The standard deviation of all the observations was varied, except for the ones of the previously estimated parameters, as they are a direct result of the Kalman filter.
The grey shaded cells show the influence of a change of σi of one observation on the corresponding ri. If σi is increased, the weight of the observation will be less in state estimation. Hence the corresponding ri should also be increased. A reduction of σi should cause a smaller ri on the contrary. This is the case for most of the observations, except for gy. The reason therefore is that its ri are already close to zero and a reduction of σi has no effect.
Green shaded cells show a direct functional relation of the corresponding observations (see (1)-(4) and (12)-(14)). The change of σi of one observation influences also the partial redundancy of other observations. A raise of one σi should cause a reduction of partial redundancy of other observations, The r i of the magnetometer show a remarkable, alternating behavior. In the trajectory parts where the user walks straight, the r i of m y are close to zero. Whereas in parts where the user turns, controllability of m x and m z is bad. If there are systematic deviations in these observations, they cannot be detected and have a high influence on the estimated orientation angles. The r i of x ϕ and x θ are again continuously higher than 0.2 and therefore sufficiently controlled. The same findings hold for c ϕ and c θ , whereas c ψ is totally uncontrolled. Generally the r i of the previously estimated parameters and the system noise behave in a similar manner. g y is also uncontrolled as its r i is very close to zero. The r i of g z are again higher than 0.2. The behavior of the r i of the previously estimated yaw angle is interesting, as they go up to 0.25 if the gyroscope measurements are used in the system equation. If the gyroscope is not used in the following epochs the r i decrease.
From the analysis of Figure 4 it can be concluded that there are uncontrollable observations in this approach, even if the standard deviations are adapted. To better understand the behavior of the r i , the influence of the change of the standard deviation σ i of one observation on the partial redundancy of the other observations is analyzed. This analysis should support an aimed change of the standard deviations to improve the r i . Table 3 shows how the r i change, if the standard deviation of one observation is multiplied with the factor 10 (left sign in Table 3) respectively 0.1 (right sign in Table 3). The standard deviation of all the observations was varied, except for the ones of the previously estimated parameters, as they are a direct result of the Kalman filter. Table 3. Influence of the change of the standard deviation of one observation on the partial redundancy of the other observations. "+" indicates a raise and "−" a reduction of the partial redundancy. At the left sign, the standard deviation was increased by the factor 10 and at the right sign it was decreased by the factor 0.1. Grey shaded cells show the change in the corresponding observation and green means that the observations are functionally related.
The grey shaded cells show the influence of a change of σ i of one observation on the corresponding r i . If σ i is increased, the weight of the observation will be less in state estimation. Hence the corresponding r i should also be increased. A reduction of σ i should cause a smaller r i on the contrary. This is the case for most of the observations, except for g y . The reason therefore is that its r i are already close to zero and a reduction of σ i has no effect.
Green shaded cells show a direct functional relation of the corresponding observations (see (1)-(4) and (12)-(14)). The change of σ i of one observation influences also the partial redundancy of other observations. A raise of one σ i should cause a reduction of partial redundancy of other observations, as they get more weight in the state estimation. A reduction of one σ i should raise the partial redundancy of other observations on the contrary. Though, the change of σ i of c ϕ and c θ , show another behavior. By increasing as well as decreasing σ c-ϕ and σ c-θ , the r x-ϕ and r x-θ are reduced. A raise of σ i of g z respectively of c ψ causes also a raise of the r i of the previously estimated yaw angle.
A relation which is not expected from the system equations respectively the measurement equations, appears at the accelerometer measurements. a y is only related to x ϕ and c ϕ , whereas a x and a z are related to x θ and c θ . The change of σ i of one of the magnetometer measurements influences the r i of x ψ , g z and the other two magnetometer components. m y stands out, as a reduction of σ i positively influences the r i of c ϕ and c θ and the r i of a z . Hence, a reduction of σ i of m y would have the most positive influence on the r i . As the controllability of this observation is bad, a further reduction is not advisable.
Changing the stochastic model clearly has an impact on the inner reliability but it also has limitations. As shown in Table 3, g y as well as c ψ are not controlled by any of the other observations (i.e., changing the standard deviation of any other observation does not influence r g-y and r c-ψ ). The only way left in the stochastic model is to increase the standard deviation of such observations. In this case it is very likely, that the raised standard deviations cover the systematic deviations which actually should be detected.

Adaption of the Functional Model
In general, the functional model can be adapted by changing respectively extending the system equations and the measurement equations. As seen in the previous section, the y-component of the gyroscope and the system noise of the yaw angle stay problematical observations, as their controllability cannot be improved by changing σ i of other observations. Through the example of the r i of the gyroscope, the functional influences should be analyzed. (47) and (48) show the formulas to calculate the r i of the gyroscope: These equations are derived by evaluating (18), which is shown in Appendix C. d 33 * corresponds to the third diagonal element of the inverse of D. The difference of (47) and (48) is the trigonometric function of the roll angle ϕ (σ 2 g-y and σ 2 g-z are assumed to be equal). As the roll angle is close to zero in the considered trajectory, also r g-y will be close to zero even when changing σ i of other observations (which influences d 33 *). Hence, the smartphone orientation during the trajectory measurements has a huge impact on the calculated r i -not only the ones from gyroscope, but also the ones from accelerometer and magnetometer ((12)- (14)). This seems reasonable if a closer look is taken on the quantities used to determine the smartphone orientation. The accelerometer should sense the gravity vector and the magnetometer the Earth magnetic field, which are both a vector quantity. The more sensor components sense these quantities, the better the mutual controllability should be. This should be the same for the gyroscope, which should sense the rotation of the user around the z-axis of the reference respectively navigation coordinate frame.
To check whether the assumptions made above are true, the recorded sensor data from the trajectory are rotated with the rotation matrix R given in (49): ϕ is chosen to be 45 • and θ and ψ are 0 • . Evaluating the rotated sensor data in the same Kalman filter as used above, gives the partial redundancies shown in Figure 5. The r i of the previously estimated parameters, the system noise as well as the x-components of the sensors are not affected by the rotated data, when comparing the results with Figure 4. The y-and z-components of the sensors are more balanced now, leading to a better mutual controllability. Especially the mean level of the r i of the gyroscope y-component are now approximately 0.1, which is clearly higher compared to Figure 4.
The idea of the following approach is to use multiple trajectory data, to determine the actual smartphone's orientation. If one thinks of scenarios in crowded environments, it could be that multiple users have already taken the same path as the actual user does. If this data from the users who have taken the same path is stored, it could be used in a multiple trajectory data approach to determine the actual yaw angle, which equals the situation outlined in Section 2.3 where several sub-systems are used to determine the overall-system. Hence, the Gauss-Helmert Kalman filter which incorporates (32) in its functional model (33) has to be used now. In the case of orientation determination, the set of equations which unambiguously determine the state vector (31) are equal to (1), (2) and (3) respectively (4) for the actual trajectory. Now, for every additionally used trajectory, (1) and (2) have to be added to the unambiguous set of equations, as the smartphone's orientation could be different (the only assumption is that there is the same path, e.g., the same yaw angle). Thus-if N tr is the number of used trajectories-N tr roll angles, N tr pitch angles and one yaw angle have to be estimated. If there is a turn detected in the actual trajectory, gyroscope measurements from multiple smartphones have to be processed. Hence, every additional trajectory contributes with a formula of type (4) to the system equation, which leads to N tr −1 condition Equations (32) in the system equation. The measurement equation consists of N tr triples of (12)- (14). filter as used above, gives the partial redundancies shown in Figure 5. The ri of the previously estimated parameters, the system noise as well as the x-components of the sensors are not affected by the rotated data, when comparing the results with Figure 4. The y-and z-components of the sensors are more balanced now, leading to a better mutual controllability. Especially the mean level of the ri of the gyroscope y-component are now approximately 0.1, which is clearly higher compared to Figure 4. The idea of the following approach is to use multiple trajectory data, to determine the actual smartphone's orientation. If one thinks of scenarios in crowded environments, it could be that multiple users have already taken the same path as the actual user does. If this data from the users who have taken the same path is stored, it could be used in a multiple trajectory data approach to determine the actual yaw angle, which equals the situation outlined in Section 2.3 where several sub-systems are used to determine the overall-system. Hence, the Gauss-Helmert Kalman filter which incorporates (32) in its functional model (33) has to be used now. In the case of orientation determination, the set of equations which unambiguously determine the state vector (31) are equal to (1), (2) and (3) respectively (4) for the actual trajectory. Now, for every additionally used trajectory, (1) and (2) have to be added to the unambiguous set of equations, as the smartphone's orientation could be different (the only assumption is that there is the same path, e.g., the same yaw angle). Thus-if Ntr is the number of used trajectories-Ntr roll angles, Ntr pitch angles and one yaw angle have to be estimated. If there is a turn detected in the actual trajectory, gyroscope In this article additional trajectories are simulated, which means that they are retrieved from the trajectory considered in this section by performing rotations in the same manner as done in (49). This is a simplification respectively a synthetical example whose aim is to retrieve more insights into how additional observations affect the partial redundancy. Before using additional rotated trajectories, the effect of using the same trajectory data two times will be analyzed. The reason is that no additional roll and pitch angles have to be estimated and therefore the results for the partial redundancy can be directly compared to the results from Section 3.1 respectively Figure 4. The results of the partial redundancy of the observations from the actual trajectory are shown in Figure 6. measurements from multiple smartphones have to be processed. Hence, every additional trajectory contributes with a formula of type (4) to the system equation, which leads to Ntr-1 condition Equations (32) in the system equation. The measurement equation consists of Ntr triples of (12)- (14).
In this article additional trajectories are simulated, which means that they are retrieved from the trajectory considered in this section by performing rotations in the same manner as done in (49). This is a simplification respectively a synthetical example whose aim is to retrieve more insights into how additional observations affect the partial redundancy. Before using additional rotated trajectories, the effect of using the same trajectory data two times will be analyzed. The reason is that no additional roll and pitch angles have to be estimated and therefore the results for the partial redundancy can be directly compared to the results from Section 3.1 respectively Figure 4. The results of the partial redundancy of the observations from the actual trajectory are shown in Figure 6.
The most obvious effect can be seen in the turn detection. The gyroscope is used less in the straight trajectory parts, which leads to slightly different appearance of the ri. Nevertheless, the height of the ri can be compared. The ri of the previously estimated roll and pitch angel has not changed. It can be seen, that the ri of the accelerometer, the system noise components and the previously estimated yaw angle are raised by using additional observations, which is especially important for the system noise of the yaw angle. The controllability of this quantity is now slightly improved. The components of the magnetometer and the gyroscope, which already had quite high ri are now also raised, whereas an effect on the low ri during turns is not visible. This is not a surprise, as trajectory data is used two times where the controllability of these quantities is suboptimal. Figure 7 shows the partial redundancy of the observations from the actual trajectory by using one additional trajectory, where the smartphone's orientation is different. This additional trajectory comes from rotating the trajectory data as mentioned above (49), which is a simplification respectively simulation. In a real-life application some sort of search-algorithm would have to be performed on the stored trajectories, to find the ones where users took the same path as in the actual trajectory. The only thing that has changed, are the ri of the previously estimated roll and pitch angles, as they are clearly reduced now. The reason could be that the overall redundancy has not changed from the scenario in Figure 6 to the scenario in Figure 7 but more parameters have to be estimated. The remaining ri have not changed. Especially rg-y is still close to zero, despite using an additional trajectory where the smartphone's orientation is different. The functional relation of the four gyroscope measurements-resulting from using the actual and the simulated trajectory (i.e., the The most obvious effect can be seen in the turn detection. The gyroscope is used less in the straight trajectory parts, which leads to slightly different appearance of the r i . Nevertheless, the height of the r i can be compared. The r i of the previously estimated roll and pitch angel has not changed. It can be seen, that the r i of the accelerometer, the system noise components and the previously estimated yaw angle are raised by using additional observations, which is especially important for the system noise of the yaw angle. The controllability of this quantity is now slightly improved. The components of the magnetometer and the gyroscope, which already had quite high r i are now also raised, whereas an effect on the low r i during turns is not visible. This is not a surprise, as trajectory data is used two times where the controllability of these quantities is suboptimal. Figure 7 shows the partial redundancy of the observations from the actual trajectory by using one additional trajectory, where the smartphone's orientation is different. This additional trajectory comes from rotating the trajectory data as mentioned above (49), which is a simplification respectively simulation. In a real-life application some sort of search-algorithm would have to be performed on the stored trajectories, to find the ones where users took the same path as in the actual trajectory. The only thing that has changed, are the r i of the previously estimated roll and pitch angles, as they are clearly reduced now. The reason could be that the overall redundancy has not changed from the scenario in Figure 6 to the scenario in Figure 7 but more parameters have to be estimated. The remaining r i have not changed. Especially r g-y is still close to zero, despite using an additional trajectory where the smartphone's orientation is different. The functional relation of the four gyroscope measurements-resulting from using the actual and the simulated trajectory (i.e., the two formulas of type (4))-doesn't lead to an improved mutual controllability. The same holds for the r i of the magnetometer measurements which are close to zero. Figure 8 shows the ground truth from total station (see Section 2.2), the raw result from the magnetometer and different variants of the estimated yaw angle. For better visibility, again a representative section of the trajectory is chosen. Estimation variant 1 clearly differs from the rest of the estimation variants as it is much smoother. In this variant the original standard deviations from Table 2 are used, whereas in the other variants the adapted ones are used. The differences between variant 2 and 3 are negligible. This is reasonable, as the additional trajectory data of variant 3 is just rotated in comparison to the original trajectory data. Thus, the additional trajectory data used in this article does not contribute to the state estimation process but to the improvement of the inner reliability.
In future experiments, real multiple trajectory data has to be collected from different smartphones and users to further evaluate the approach presented in this section. In this article, variant 1 performs slightly better with the drawback of worse inner reliability. In the beginning of the trajectory section shown in Figure 8, the raw result from magnetometer as well as the estimated yaw angles are shifted due to undetected systematic deviations. The aim of future research will be to detect such systematic deviations based on improved inner reliability, enabling better performance of a Kalman filter used for orientation determination.  Figure 8 shows the ground truth from total station (see Section 2.2), the raw result from the magnetometer and different variants of the estimated yaw angle. For better visibility, again a representative section of the trajectory is chosen. Estimation variant 1 clearly differs from the rest of the estimation variants as it is much smoother. In this variant the original standard deviations from Table 2 are used, whereas in the other variants the adapted ones are used. The differences between variant 2 and 3 are negligible. This is reasonable, as the additional trajectory data of variant 3 is just rotated in comparison to the original trajectory data. Thus, the additional trajectory data used in this smartphones and users to further evaluate the approach presented in this section. In this article, variant 1 performs slightly better with the drawback of worse inner reliability. In the beginning of the trajectory section shown in Figure 8, the raw result from magnetometer as well as the estimated yaw angles are shifted due to undetected systematic deviations. The aim of future research will be to detect such systematic deviations based on improved inner reliability, enabling better performance of a Kalman filter used for orientation determination.

Discussion
The main novelty of this article is the formulation of the Kalman filter and the redundancy matrix in the GHM. Depending on the system description in the system equation two different sets of update equations are derived, which are both applied to orientation determination as well as to partial redundancy calculation. The results of these derivations are used to analyze the inner reliability based on the partial redundancy. Analyzing the partial redundancy shows that in the Kalman filter used in Section 2.1 the system equation contribute disproportionately highly to the estimation of the orientation compared the measurement equation. This means that the observations of the system equation are nearly uncontrolled. Two general ways are considered to intervene into the inner reliability respectively partial redundancy.
First, effects of changes in the stochastic model are analyzed. By adapting the standard deviations, the group redundancies can be improved. Analyzing the partial redundancy of the individual observations shows that observations which crucially determine the orientation are still badly controlled. Systematic deviations in such observations can cause huge disturbances in the estimated quantities. By increasing and decreasing the standard deviations, their influence on the partial redundancy was analyzed. It appears that reducing the standard deviation of the magnetometer's y-component, could increase many partial redundancies but its controllability is bad. The y-component of the gyroscope as well as the system noise of the yaw angle cannot be controlled by observations of the actual trajectory. It has to be mentioned that the resulting insights are in a way limited to the considered trajectory. Such adaptions in the stochastic model have to be also tested in other trajectories and different devices.
Furthermore, effects of changes in the functional model on the partial redundancy are considered. In a first step the influences of the smartphone's orientation on the partial redundancy were analyzed. Rotating the trajectory data shows that if more than one sensor axis is sensing the quantity of interest, the controllability will be improved. Using multiple trajectory data should take advantage of this behavior. The formulation of the Kalman filter update equations in the GHM enables processing multiple trajectory data in a Kalman filter. Partial redundancy is improved through this approach but still there are critical observations, such as the y-components of the gyroscope and magnetometer. Just using more data does not mandatory lead to better controllability in the GHM. Additionally, improving inner reliability does not lead to better accuracy of the estimated quantities. These questions respectively challenges will be addressed in future studies.