###### Abstract  
Pedestrian navigation systems could serve as a good supplement for other navigation methods or for extending navigation into areas where other navigation systems are invalid. Due to the accumulation of inertial sensing errors, foot-mounted inertial-sensor-based pedestrian navigation systems (PNSs) suffer from drift, especially heading drift. To mitigate heading drift, considering the complexity of human motion and the environment, we introduce a novel hybrid framework that integrates a foot-state classifier that triggers the zero-velocity update (ZUPT) algorithm, zero-angular-rate update (ZARU) algorithm, and a state lock, a magnetic disturbance detector, a human-motion-classifier-aided adaptive fusion module (AFM) that outputs an adaptive heading error measurement by fusing heuristic and magnetic algorithms rather than simply switching them, and an error-state Kalman filter (ESKF) that estimates the optimal systematic error. The validation datasets include a Vicon loop dataset that spans 324.3 m in a single room for approximately 300 s and challenging walking datasets that cover large indoor and outdoor environments with a total distance of 12.98 km. A total of five different frameworks with different heading drift correction methods, including the proposed framework, were validated on these datasets, which demonstrated that our proposed ZUPT-ZARU-AFM-ESKF-aided PNS outperforms other frameworks and clearly mitigates heading drift.  
PNSs, owing to the accumulation of inertial sensing errors, the systems suffer from drift, especially heading drift. To address this issue, Kalman filters (KFs) are commonly applied to constrain these errors [6; 18]. In the common KF-based frameworks, integrating human activity tracking and dead reckoning systems can lead to a better choice for adaptive systematic parameters to improve the performance of the navigation system [19; 20; 21; 22]. Generally, accelerometers and gyroscopes are used individually or through sensor fusion to track a wide range of human activities. For instance, three-axis accelerometers are the most widely used sensors [23; 24], followed by gyroscopes and magnetometers. Wearable devices may also contain environmental sensors that measure parameters such as temperature, light, or atmospheric pressure in context detection. For instance, barometers have traditionally been leveraged to measure ambient pressure, and they are also used to track multiple human motions, especially vertical movements [24]. In addition, external assistance information, such as that obtained from pressure sensors [13], radio-frequency identification (RFID) [25], and magnetic beacons [26], is adopted to enhance the performance of PNSs.  
In human walking, the gait can be roughly divided into two separate phases [27]: the swing phase and the stance phase. During the stance phase, the foot fully touches the ground and the velocity of the foot is approximately zero. Hence, the small values of velocity in the stance phase can be utilized as the observations of a KF in order to reduce the velocity errors of PNSs; this algorithm is the well-known zero-velocity update (ZUPT) algorithm [14; 28]. Since the position is an integration of the velocity that can be regulated by the ZUPT algorithm, the position error can also be reduced. Since positions are calculated by accruing the {distance, heading} vectors, the accuracy of the headings has a great impact on the performance of the overall PNS. For example, a pedestrian walks along a straight line for 10 m. If the average heading error is 10\({}^{\circ}\), the final position error may exceed 2 m. However, regarding the heading error, it is unobservable for ZUPT-aided PNSs [29; 30; 31], which means that the ZUPT is not capable of limiting the heading error. To constrain the heading error, numerous approaches have been proposed.