# Multi-Condition Constrained Pedestrian Localization Algorithm Based on IMU
## 2 Methods
### Dual-Feet Constraint Model  
After further analysis of the pedestrian walking process, it can be easily seen that the alternating movement of the two feet is also periodic and regular. The motion and zero-velocity states of both feet alternate, and regardless of the direction of movement. There is always a maximum limit on the distance between the two feet. Based on this characteristic, it can be considered that the zero-velocity moment location of one foot lies at the midpoint of the stride length of the other foot. Therefore, the formula for calculating the ideal maximum distance between the two feet during pedestrian walking can be written as:  
Figure 5: Single-Foot Constraint Principle.  
\[\gamma_{\rm dual}=\sqrt{\left(\frac{\gamma_{\rm single}}{2}\right)^{2}+{\rm d}^{2}}, \tag{10}\]  
where \({\rm d}\) is the parallel distance during pedestrian walking, which is also the shortest distance between the two feet while walking. In practical estimation, it can be considered as a fixed value.  
Therefore, the centroid method is used to constrain the IMU-calculated locations of the two feet. Figure 6 is a schematic diagram of the principle of this method. Its advantage lies in the ability to simultaneously correct the locations of both feet, making the location results more reasonable and accurate.  
In Figure 6, \(\hat{p}_{\rm L}({\rm i})\) and \(\hat{p}_{\rm R}({\rm i})\) represent the location projection of the left foot and right foot at the \({\rm i}\)-th moment, respectively. Based on this, the centroid of the dual-feet location can be calculated using the following formula:  
\[P_{0}({\rm i})=\frac{\hat{p}_{\rm L}({\rm i})+\hat{p}_{\rm R}({\rm i})}{2}. \tag{11}\]  
The obtained \(P_{0}({\rm i})\) is the center of the circle, and the value \(\gamma_{\rm dual}\) calculated from Equation (9) is taken as the diameter. This can then be used to create an ideal dual-feet motion range constraint model. This constraint model can be used to determine whether the distance between the two feet at the current moment is within the constraint threshold. If the calculated location exceeds the threshold, the locations of the two feet need to be corrected to ensure the rationality of the location data.  
Specifically, the IMU-calculated location of the two feet at any moment must satisfy the following constraint:  
\[\|\hat{p}_{\rm R}({\rm i})-\hat{p}_{\rm L}({\rm i})\|_{2}^{2}\leq\gamma_{\rm dual }^{2}. \tag{12}\]  
To obtain the corrected location that satisfies the above constraint, the final effective dual-feet location update formula is as follows:  
\[\begin{array}{l}P_{\rm R}({\rm i})=\frac{\gamma_{\rm dual}\hat{p}_{\rm R}( {\rm i})-\gamma_{\rm dual}\hat{p}_{\rm L}({\rm i})+2\hat{p}_{\rm R}({\rm i})} {2\hat{\rm h}}\\ P_{\rm L}({\rm i})=\frac{\gamma_{\rm dual}\hat{p}_{\rm L}({\rm i})-\gamma_{ \rm dual}\hat{p}_{\rm R}({\rm i})+2\hat{p}_{\rm R}({\rm i})}{2\hat{\rm h}}, \end{array} \tag{13}\]  
where \(\hat{\rm h}\) is the distance between the projections of the dual-feet location on the ground at the \({\rm i}\)-th moment, calculated by the IMU.  
Figure 6: Dual-Feet Constraint Principle.