## 4 Discussion  
It is difficult to directly compare the positioning error results with those of other similar systems because the systematic performance depends on several factors, such as the system setup, ground surface, walking speed, and even the environment. With the same inertial/magnetic sensor and placement, a relative positioning error of 1.7-2.5% with a distance of 36-105 m for normal walks in indoor scenarios was obtained in [15]. With similar experimental environments and sensors, the error for a normal walk with a distance of approximately 85 m was 0.28-3.37% [59], and an error of 2.01% with a distance of 239.9 m was reported in [60]. Figure 16: TTDE CDF curves of the different frameworks on all indoor and outdoor loop datasets. Figure 15: Estimated trajectories of the different frameworks on the indoor–outdoor 2 km sub-dataset. Subfigures **A–G** show different environments in this experiment. The red arrows in all subfigures refer to moving directions. Compared with the indoor–outdoor 1.9 km sub-dataset, there were many irregular trajectories (e.g. subfigures **A–F**) in the 2 km sub-dataset, such as sharp and big turns. With similar systematic frameworks, the authors of [9] reported a QMD-based framework. In their experiment, four groups with a total walking distance of 1.4 km (350 m for each group) yielded a 0.22% mean positioning error in indoor and outdoor environments. The inertial/magnetic sensor that they utilized was the high-precision sensor STIM300 (manufactured by Sensonor Company). The authors of [48] reported an improved QMD (iQMD)-based framework with a start-end error of 0.15% in offices (total traveled distance was 342 m) and 0.3% in shopping malls (total traveled distance was 986 m). The iQMD introduced in their paper only worked in a straight-line walk. Since human motion is complex, the iQMD may easily become invalid. In addition, the variations in the magnetic field, the gyro heading differences between two adjacent steps, and the compass heading differences between two adjacent steps were used as the detected features. However, when a user walks along a straight line in a disturbed area, the detector will probably fail to detect the static magnetic disturbance. The authors of [39] reported a classic ZUPT-ZARU-HDR-EC-KF-aided framework named IEZ+. The positioning error was 0.3-1.5% with a 125 m total walking distance. In their system, ZARU was utilized in the stance phase to estimate the gyro bias error, which was employed as an error measurement of the KF. Therefore, a trade-off could be made between the predicted gyro bias error and the measured gyro bias. Since the foot may rotate slightly in the stance phase, the estimated gyro bias may be inaccurate. When a tester walks along a straight line, the HDR and EC algorithms in their framework may be triggered simultaneously. The researchers did not introduce a conflict-handling method in their paper. In addition, there was not a magnetic disturbance detector integrated in their framework. Since magnetic disturbances are common indoors, the estimated compass heading may be incorrect, which will influence the heading and positioning accuracy of the system. Since the heading error is unobservable for the ZUPT, heading drift easily occurs during the still phase. Therefore, we introduced a state lock to freeze the current position and heading in this phase. Simultaneously, ZARU was triggered to estimate the gyro bias. The advantages of locking states in the still phase are avoiding drift and saving the energy of the system. However, to the best of our knowledge, in most existing works, the state lock was missing. To better recognize different foot states to construct some constraints, a multi-class foot-state classifier was introduced in our framework. However, in existing works, a binary classifier was commonly employed to detect the stance and swing phases. To mitigate heading drift and improve the positioning accuracy, we designed the HMC-MED-aided AFM to achieve the adaptive complementary fusion of the inertial and magnetic data.