## 3 A Prototype System for Pedestrian Positioning
### Tilt Estimation  
Tilt estimation, _i.e._, estimation of the direction of the gravity axis, is important for two reasons:  
1. Calculation of the relative change in the heading direction. When the sensor is not levelled, the gyroscope's axis does not coincide with the pivotal axis of the pedestrian. When the user turns, the relative change in the heading direction is underestimated. For example, when the gyroscope axis is tilted by \(25^{\circ}\) from the pivotal axis, the angular velocity is underestimated by \(\approx 10\%\). Consequently, the relative direction change might be \(81^{\circ}\) instead of \(90^{\circ}\)--_c.f._ Figure 5.
2. Estimation of the camera orientation with respect to the ground. The stereo camera is used to measure distance to nearest objects like buildings. When the camera is not levelled the measured distance will be overestimated. A human rotates along the gravity axis when changing the walking direction. Thus, the task of estimating the correct change in direction comes down to finding the gravity axis. The problem is known in aeronautics as Inertial Navigation Systems. The estimation of six coordinates of an aeroplane (three for orientation and three for position) is not a trivial task. A standard approach based on off-the-shelf  
Figure 4: The algorithm for estimating the number of steps and their lengths. sensors and cosine direction matrices is very inaccurate after few dozens of seconds [12]. However, humans move with much smaller accelerations. The dominant acceleration comes from the gravity. When a person moves, the body is usually aligned vertically. The pitch and roll are limited to \(\approx\pm 30^{\circ}\). These assumptions help greatly to design an algorithm estimating the gravity axis. The algorithm uses Kalman filter to integrate the readouts from the gyroscopes and accelerometers. The angles between the sensor's axes and the gravity axis (see Figure 5) can be calculated from Equations (14) and (15), given the sensor is not moving. \[\alpha_{x} =\arccos(\frac{a_{x}}{g});\ \beta_{x}=\frac{\pi}{2}-\alpha_{x} \tag{14}\] \[\alpha_{y} =\arccos(\frac{a_{y}}{g});\ \beta_{y}=\frac{\pi}{2}-\alpha_{y}\] (15) \[\alpha_{z} =\arccos(\frac{a_{z}}{g}) \tag{16}\]  
where \(a_{x}\), \(a_{y}\) and \(a_{z}\) are accelerations measured by the 3-axial accelerometer, \(g\) is the gravity constant, 9.81 \(\mathrm{m/s}^{2}\). When a user walks, the accelerations will fluctuate by \(\pm\)0.25 g, depending on the walking style. The acceleration vector due to walking is treated here as measurement noise. Hence, calculating the direction of the gravity axis from Equation (16) would result in an error of \(15^{\circ}\). The accelerations need to meet the constraint Equation (17). \[\sqrt{a_{x}^{2}+a_{y}^{2}+a_{z}^{2}}=g \tag{17}\]  
Figure 5: The local coordinate system of the 6 DOF sensor. \(g\) denotes the gravity acceleration. \(\omega_{x}\), \(\omega_{y}\) and \(\omega_{z}\) are angular velocities which are clock-wise oriented with their rotation axes. \(\alpha_{x}\), \(\alpha_{y}\) and \(\alpha_{z}\) are angles between the sensor’s axes and the gravity. This reduces the number of degrees of freedom by one. Gyroscopes can be used to improve the estimation of the sensor orientation. The transition equation of the Extended Kalman Filter (EKF) is given by Equations (18) and (19). Appearance of angular velocity \(\omega_{y}\) causes the \(X\) axis of the sensor changing its orientation with respect to the gravity. This change also depends on the orientation of the \(Y\) axis and is expressed by the \(\sin\alpha_{y}\) term. \[\mathbf{x}(k) =\left[ \begin{array}{c}\alpha_{x}(k-1)\\ \alpha_{y}(k-1)\end{array} \right]=\mathbf{f}(\mathbf{x}(k-1),\mathbf{u}(k-1), \mathbf{w}(k-1))= \tag{18}\] \[=\left[ \begin{array}{c}\alpha_{x}(k-1)+(\omega_{y}(k-1)+w_{y}(k -1))dT\sin\alpha_{y}(k-1)\\ \alpha_{y}(k-1)-(\omega_{x}(k-1)+w_{x}(k-1))dT\sin\alpha_{x}(k-1)\end{array} \right] \tag{19}\]  
\(k\) denotes time instant, where \(t=k\cdot dT\) and \(1/dT\) = 205 Hz.