# Multi-Condition Constrained Pedestrian Localization Algorithm Based on IMU
## 2 Methods
### Zero-Velocity Detection and Interval Constraint Correction  
Figure 2 illustrates the movement state of the pedestrian's foot during a gait cycle. It can be seen that the pedestrian is generally in motion while walking. In each gait cycle, when the foot is in the stance phase, it remains relatively stationary with respect to the ground. During this phase, it maintains a relatively constant location and attitude. This observation provides an ideal zero-velocity interval. However, in actual data collection, due to high-frequency vibrations of the foot and the limitations of sensor precision, the stance phase does not completely reach a zero-velocity state. Based on this characteristic, the ZUPT algorithm is developed for pedestrian foot motion correction. It first detects the ideal zero-velocity intervals during pedestrian walking process, then corrects the raw IMU-derived results for this interval. Each step taken allows for real-time calibration, effectively reducing the accumulation of inertial sensor drift errors. Figure 2: Pedestrian Gait Cycle Analysis. The GLRT algorithm is first used for detecting zero-velocity intervals. The formula for calculating its test statistics is:  
\[\mathrm{T(i)}=\frac{1}{\mathrm{W}}\sum_{\mathrm{k}\in\Omega_{\mathrm{i}}}\left( \frac{1}{\sigma_{\mathrm{a}}^{2}}\left\|\mathrm{y}_{\mathrm{k}}^{\mathrm{a}}- \mathrm{g}\cdot\frac{\overline{\mathrm{y}_{\mathrm{i}}^{\mathrm{a}}}}{\left\| \overline{\mathrm{y}_{\mathrm{i}}^{\mathrm{a}}}\right\|}\right\|^{2}+\frac{1}{ \sigma_{\mathrm{a}}^{2}}\left\|\mathrm{y}_{\mathrm{k}}^{\mathrm{\omega}} \right\|^{2}\right), \tag{4}\]  
where W represents the window size. When performing zero-velocity detection at the i-th moment, a window consisting of W values starting from the i-th moment is selected for examination. \(\Omega_{\mathrm{i}}\) represents the set of values within this window, i.e., \(\Omega_{\mathrm{i}}=\mathrm{i},\mathrm{i}+1,\mathrm{i}+2\cdots\mathrm{i}+W-1\). Additionally, \(\sigma_{\mathrm{a}}\) and \(\sigma_{\mathrm{\omega}}\) represent the standard noise variances of the accelerometer and gyroscope, respectively; \(\mathrm{y}_{\mathrm{k}}^{\mathrm{a}}\) and \(\mathrm{y}_{\mathrm{k}}^{\mathrm{\omega}}\) represent the raw three-axis accelerometer and gyroscope data collected by the IMU at the k-th moment within the window; g denotes the local gravitational acceleration; and \(\overline{\mathrm{y}_{\mathrm{i}}^{\mathrm{a}}}=\sum\limits_{\mathrm{k}\in \Omega_{\mathrm{i}}}\mathrm{y}_{\mathrm{k}}^{\mathrm{a}}/\mathrm{W}\) represents the average value of the W three-axis acceleration values within the window at the i-th moment to be tested. By comparing the test statistic values calculated at each moment with an appropriately set threshold, the ideal zero-velocity intervals during the walking process can be determined. \[Z(\mathrm{i})= \begin{cases}1,&\mathrm{T(i)}<\mathrm{T_{y}}\\ 0,&\mathrm{others}\end{cases} , \tag{5}\]  
where \(\mathrm{T_{y}}\) represents the threshold used to determine the zero-velocity intervals. This threshold can be determined through repeated experiments and statistical analysis of data from multiple walking trials. After applying the above zero-velocity interval detection method to a set of field-collected data, the resulting outcomes are shown in Figure 3.  
As shown in Figure 3, there are obvious irregular and very small zero-velocity intervals in the detection results by the traditional method. According to the periodicity principle of pedestrian gait and an examination of the reasonable size of the zero-velocity intervals, it can be concluded that the ideal zero-velocity interval size for a healthy adult during normal walking should fall within the range of 200-400 milliseconds. Therefore, the four abnormal zero-velocity intervals in the figure can be identified as misclassification intervals. Figure 3: Traditional GLRT Zero-Velocity Interval Algorithm.