# Pedestrian Heading Estimation Methods Based on Multiple Phone Carrying Modes

Authors: Ying Guo; Hanshuo Liu; Jin Ye; Shengli Wang; Chenxi Duan
Journal: Mobile Information Systems
 (2021)

---

## Abstract

The development of smartphone Micro-Electro-Mechanical Systems (MEMS) inertial sensors has provided opportunities to improve indoor navigation and positioning for location-based services. One area of indoor navigation research uses pedestrian dead reckoning (PDR) technology, in which the mobile phone must typically be held to the pedestrian’s chest. In this paper, we consider navigation in three other mobile phone carrying modes: “calling,” “pocket,” and “swinging.” For the calling mode, in which the pedestrian holds the phone to their face, the rotation matrix method is used to convert the phone’s gyroscope data from the calling state to the holding state, allowing calculation of the stable pedestrian forward direction. For a phone carried in a pedestrian’s trouser pocket, a heading complementary equation is established based on principal component analysis and rotation approach methods. In this case, the pedestrian heading is calculated by determining a subset of data that avoid 180° directional ambiguity and improve the heading accuracy. For the swinging mode, a heading capture method is used to obtain the heading of the lowest point of the pedestrian’s arm swing as they hold the phone. The direction of travel is then determined by successively adding the heading offsets each time the arm droops. Experimental analysis shows that 95% of the heading errors of the above three methods are less than 5.81°, 10.73°, and 9.22°, respectively. These results present better heading accuracy and reliability.


---

## Body

## 1. Introduction

The prevalence of small- and high-precision sensors in mobile phones has been partly enabled by the rapid development of Micro-Electro-Mechanical Systems (MEMS) [1]. These sensors give smartphones capabilities that would not otherwise be available [2]. For example, smartphones can use internal sensors (inertial sensors, radio frequency signals, etc.) to improve indoor pedestrian navigation and positioning for location-based services [3]. Pedestrian dead reckoning (PDR) technology [4–6], which uses smartphone inertial sensors, has attracted the attention of researchers because of its strong anti-interference properties and ability to quickly determine precise pedestrian positions [7–9]. However, the technology still faces some indoor positioning challenges. For example, a change in the relative position between a smartphone and a pedestrian will lead to a decrease in positioning accuracy [10, 11], and pedestrian posture changes can also cause positioning errors [12, 13]. Therefore, to ensure reliable heading and positioning information, most mobile phone PDR technologies require the mobile phone to be stabilised against a pedestrian’s chest, impacting the phone’s portability [14].The challenges affecting PDR heading accuracy and stability can be resolved by establishing suitable heading estimation methods for different mobile phone carrying modes, such as “calling” (in which the phone is held against the user’s face), “pocket,” and “swinging.” By treating the motions of mobile phones carried in swinging hands or trouser pockets as regular oscillation states, Tian et al. [15] calculated pedestrian headings according to the mean oscillation values. Lee and Huang [16] proposed a magnetometer-based heading estimation method that allowed good positioning accuracy in the calling, swinging, and pocket carrying modes. By studying the body movements of pedestrians walking with mobile phones in their trouser pockets, Steinhoff and Schiele [17] proposed a rotation approach (RA) based on quaternion and principal component analysis (PCA). Deng et al. [18] used PCA to estimate the headings of mobile phones carried in the trouser pocket and swinging states, and they used a heading offset method to estimate pedestrian headings in the calling state. Wang et al. [19] argued that the previously existing PCA methods could not guarantee that the horizontal acceleration within a stride would be completely horizontal, which would affect the estimation of pedestrian headings. They therefore proposed a PCA-based method with global accelerations (PCA-GA), and they demonstrated experimentally that their method provided higher accuracy than existing PCA methods. The RA method was subsequently improved by Zheng et al. [20] and experimentally shown to be more effective in the pocket state.However, the above-referenced methods face some challenges. In the calling state, the selection of a fixed heading offset may be inaccurate and can incur further errors due to the instability of true heading offsets. In the pocket and swing states, the PCA-based methods used to estimate pedestrian headings have a 180° directional ambiguity limitation; the improved RA method avoids the 180° ambiguity, but calculations that use only gyroscope data offer limited accuracy. And, reliance on magnetometer data for heading estimation can be affected by magnetic interference in indoor environments.Based on these observations, we consider pedestrian heading estimation methods for three phone carrying modes (calling, pocket, and swinging). The rotation matrix method is used in the calling state, not only considering the problem of nonhorizontal head rotations, but also making improvements to the accuracy and stability of the heading estimates. The complementary PCA and RA methods are adopted for the pocket state, avoiding the 180° directional ambiguity and reducing the impacts of cumulative errors. The heading capture method is used in the swinging state because of the method’s calculation speed and accuracy. These methods reduce the heading errors caused by attitude transformations in the three states, hence improving the reliability of heading estimation.


## 2. Heading Estimation in Three Carrying Modes

Commonly used mobile phone carrying modes include holding, calling, pocket, and swinging. Due to its good stability and the more mature heading estimation method, the holding mode offers the most accurate and reliable pedestrian heading estimates. Therefore, we focus on pedestrian heading estimation methods for the other three mobile phone carrying modes.


### 2.1. Calling Mode Heading Estimation Based on a Rotation Matrix Method

Some authors have treated the calling state as a stable state, assuming a fixed horizontal rotation angleΔβ [18] between the holding state and the calling state. Under this assumption, a pedestrian’s heading can be obtained by subtracting the angle from the heading angle of the mobile phone attitude in the calling state. The heading error of this method is largely derived from uncertainty in the choice of the angle. Furthermore, when calling, a pedestrian’s head will inevitably shake, adding to the potential that use of a fixed angle will cause unnecessary errors. To avoid errors caused by uncertainty and variation of the relative angle, a rotation matrix method is used here. Equation (1), as follows, is used to calculate the rotation matrix in the calling state [21], and equation (2) is used to convert the gyroscope data from the calling state to the holding state.(1)Cbn=cosφ−sinφ0sinφcosφ00011000cosψsinψ0−sinψcosψcosθ0−sinθ010sinθ0cosθ,(2)gyr′=Cbngyr,gyr is a vector containing the gyroscope’s three components of angular velocity, and gyr′ is the gyroscope data after translation to the holding state. As defined below, φ is termed the adaptive heading offset, and ψ and θ are the pitch and roll angles of the phone in the calling state, respectively.(3)φ=Δβ+Δφ,ψ=arcsin−axg,θ=arctanayaz.Among them,a is the phone’s three-axis accelerometer data, Δβ is a fixed horizontal rotation angle, calculated from the heading before and after the carrying mode change, Δφ is the relative heading change caused by the nonhorizontal rotation of the head in the state of making a call, which is detected by the changes in the pitch and roll angles, and g is the local acceleration due to gravity. The corrected gyroscope data are obtained through the rotation matrix method, which effectively avoids the errors caused by the nonhorizontal shaking of the mobile phone in the calling state.To calculate the quaternion and pedestrian heading, we used the corrected gyroscope [22]:(4)φcalling=−arctan2q1q2−q0q3q02−q12+q22−q32.To verify the reliability of the rotation matrix method, an experimental comparative analysis was conducted. As thez-axis of the gyroscope undergoes the largest changes when turning in the holding state, the z-axis data of the gyroscope were selected for comparison (Figure 1).Figure 1
Comparison of gyroscopez-axis data in holding mode, in calling mode, and in calling mode after correction using the rotation matrix method.As shown in Figure1, when a pedestrian followed a sequence of instructions (“go straight,” “turn right,” and “turn left”), the gyroscope z-axis data obtained by the rotation matrix method in the calling state were approximately the same as the data obtained from the holding state; however, in the calling state, the unprocessed data did not respond significantly during the turns and hence did not capture the pedestrian’s heading changes.


### 2.2. Pocket Mode Heading Estimation Based on a RA-PCA Method

#### 2.2.1. Existing Heading Estimation Methods and Analysis

When a pedestrian walks with a mobile phone in their trouser pocket, the phone not only moves with the pedestrian’s legs, but also may change its relative position within the pocket. Therefore, the directly calculated mobile phone attitude is difficult to accurately represent the pedestrian’s heading in this state. Some authors have used PCA methods based on acceleration data for pedestrian heading estimation [18]; others have calculated quaternions based on gyroscope data and used RA methods to calculate the rotation axes for pedestrian heading estimation [20].However, the PCA approach is affected by 180° ambiguity between the forward and backward swings of the mobile phone, and by unstable horizontal accelerations. The RA method generates errors due to the cumulative drift of the gyroscope, and the method is limited by the rotational instability of the phone’s orientation relative to the pedestrian’s pocket. Therefore, independent use of the accelerometer-based PCA method or the gyroscope-based RA method can produce limited results.To improve the accuracy of the pedestrian heading estimation in the pocket state, we propose an RA-PCA algorithm that leverages the complementary characteristics of the RA and PCA methods. In this approach, gravity accelerometer data are used to avoid the 180° ambiguity, and the RA and PCA heading methods are combined to reduce overall heading errors.


#### 2.2.2. Heading Estimation Based on RA-PCA

As a mobile phone in a trouser pocket swings back and forth with a pedestrian’s legs, the accelerations obtained by the PCA method will swing back and forth to produce a 180° ambiguity in the direction of travel. The RA method can also incur a 180° change in forward direction if the phone’s rotation axis changes. To avoid the influence of 180° ambiguity on heading estimation, it is necessary to select a suitable subset of data for use in the heading calculation.(1) Selection of Data for the Heading Calculation. In the process of walking, with each step, one leg will be the centre of gravity, and the other leg will move forward. The 180° heading ambiguity can be resolved by estimating the pedestrian’s heading using only the data where the leg carrying the phone is moving forward (Figure 2).Figure 2
Selection of a data subset for use in heading direction estimation.The measured parameter shown in the figure is calculated from thex and y axes of the gravity accelerometer (equation (5)). The subset of data for use in heading estimation are obtained between the peak and successive trough of the value.(5)gxy=gx2+gy2.(2) Pedestrian Heading Estimation. From the selected subset of accelerometer data, PCA can be used to obtain the principal vectors, and equation (6) can be applied to convert the principal vectors from the mobile phone coordinate system to the navigation coordinate system. (6)vin1vin2vin3=Cbnvi1vi2vi3.By projectingvi∗ onto the horizontal plane, the principal vector, vin1vin2, can be calculated for the pedestrian’s direction of travel. i is a sample point; the PCA heading at the corresponding sample point can then be obtained.(7)headingiPCA=arctanvin2vin1.The RA method determines the axis of rotation according to the change of the quaternion as a pedestrian walks [22]. Here, the rotation axis in a data subset is calculated according to its quaternion transformation. As the rotation axis is perpendicular to the direction of movement of the phone, the axis is projected onto the horizontal plane, and the relative heading of the pedestrian is then calculated according to the direction of the horizontal plane axis. Taking one step as an example, the number of sampling points in the data subset is t, and the change of the quaternion is calculated by(8)qtmt10qtmt11qtmt12qtmt13=qt10qt11qt12qt13⊗qtm0qtm1qtm2qtm3,t1 and tm are, respectively, represented as the first sampling point and the mth sampling point in the data subset, qtmt1∗ is the quaternion change from t1 to tm, and qt1∗ is the quaternion of the t1 sampling point.A quaternion can be understood as a process of rotation from one point to another along a certain axis [23]. Similarly, the rotation axis, uq, of this process can be roughly estimated based on the quaternions before and after the rotation. Here, u is the average value of the rotation axis within the subset of data selected for heading estimation. This rotation axis is converted to the navigation coordinate system to obtain un, then un is projected onto the horizontal plane, and the rotation axis vector is normalised to obtain the direction of the rotation axis in the navigation coordinate system.(9)qtmt1=cosϕ,sinϕ⋅uq,uq=q1sinϕ,q2sinϕ,q3sinϕ,un=Cbnu,headingiRA=arctanuin2uin1.The above RA and PCA methods use the same data subsets for each calculation.φiPCA and φiRA are the PCA and RA relative heading, respectively. Using a complementary coefficient K, the trust degree of the PCA method is adaptively restricted, such that the trust degree of the PCA heading is reduced when the PCA method is unstable. Use of this coefficient establishes the complementary RA-PCA pedestrian heading, φiRA−PCA, in the pocket mode.(10)φiRA−PCA=KφiPCA+1−KφiRA.The coefficientK is obtained by the following equation:(11)K=1φ′,Δφ>2,12,Δφ≤2.When the phone’s screen is facing towards the pedestrian’s right (the phone is usually in the left leg pocket at this time),K=−K, and when the phone’s screen is facing towards the pedestrian’s left (the phone is in the right leg pocket), K=K. φ′ is obtained by(12)φ′=φiPCA−φiRA.The RA method using the gyroscope is stable, but it is affected by cumulative error from the gyroscope readings, whereas the PCA method based on the accelerometer data is less stable, but it can partially compensate for the cumulative error of the RA method. A comparison of PCA, RA, and RA-PCA headings obtained using the above methods is shown in Figure3. The PCA headings progressively deviated from the reference headings as the test progressed. Although the RA heading was stable, there were still some systematic errors observed. The RA-PCA method leveraged complementary information from the PCA method, but it retained the stability of the RA method and improved the overall heading accuracy.Figure 3
Comparison of pocket mode heading estimation methods.


### 2.3. Swinging Mode Heading Estimation Based on a Heading Capture Method

The swinging mode is similar to the pocket mode, so the pedestrian heading can be obtained using the RA-PCA method. However, compared to the pocket state, the swinging state has stronger regularity [24], so we can quickly capture more reliable pedestrian heading by use of it. Therefore, a swinging mode heading capture method is established based on the regular swing of a pedestrian’s arm. This method captures the specific point where the arm passes by the pedestrian’s body each time the arm swings. The heading angle of the mobile phone is obtained at this lowest point in the motion of the pedestrian’s hand. The heading offset is then removed from the captured heading angle of the mobile phone to obtain the walking direction of the pedestrian.In this method, when the pitch angle in the attitude of the phone is close to 0°, it is considered that the arm is close to the lowest point in its swing, so the heading angle of the mobile phone is captured each time the pitch angle crosses 0° (Figure4).Figure 4
Arm droop point capture method. As a pedestrian’s arm swings, the heading angle is captured each time the phone’s pitch angle crosses 0° (red boxes).As the mobile phone is not necessarily facing the pedestrian’s forward direction during the swing process, it is necessary to determine the offset angle,Δβswing, between the heading angle of the mobile phone and the forward direction of the pedestrian when the arm is at its lowest point. After switching to the swing arm state, the phone’s headings at the two drooping points in the first swing cycle can be used to calculate the heading offset.(13)Δβswing=12∑i=12φiswing−φlast,where φlast is the pedestrian’s heading before the swing and φiswing is the mobile phone’s heading captured by this method. These headings are all calculated using equation (4). The pedestrian’s heading at each subsequent step is obtained by subtracting the heading offset from the phone’s heading at that swing’s lowest point.


### 2.4. Pedestrian Heading Estimation Flowchart

The main procedures for obtaining the direction of a pedestrian’s travel in the above three mobile phone carrying modes are as follows: mobile phone accelerometer data and gyroscope data are extracted to determine the mobile phone carrying mode. When the mobile phone is in a holding state, the quaternion method is used to estimate the heading angle of the mobile phone, which is used as the pedestrian’s heading. When the phone is in a calling state, the rotation matrix method is used to calculate the pedestrian’s heading. When the phone is in a pocket state, a subset of forward motion data is extracted, and the RA-PCA method is used to calculate the pedestrian’s heading. When in a swinging mode, the heading capture method is used to obtain the pedestrian’s heading.A flowchart representing the carrying modes and their respective heading estimation methods is shown in Figure5.Figure 5
Flowchart of pedestrian heading estimation methods for multiple mobile phone carrying modes.


## 2.1. Calling Mode Heading Estimation Based on a Rotation Matrix Method

Some authors have treated the calling state as a stable state, assuming a fixed horizontal rotation angleΔβ [18] between the holding state and the calling state. Under this assumption, a pedestrian’s heading can be obtained by subtracting the angle from the heading angle of the mobile phone attitude in the calling state. The heading error of this method is largely derived from uncertainty in the choice of the angle. Furthermore, when calling, a pedestrian’s head will inevitably shake, adding to the potential that use of a fixed angle will cause unnecessary errors. To avoid errors caused by uncertainty and variation of the relative angle, a rotation matrix method is used here. Equation (1), as follows, is used to calculate the rotation matrix in the calling state [21], and equation (2) is used to convert the gyroscope data from the calling state to the holding state.(1)Cbn=cosφ−sinφ0sinφcosφ00011000cosψsinψ0−sinψcosψcosθ0−sinθ010sinθ0cosθ,(2)gyr′=Cbngyr,gyr is a vector containing the gyroscope’s three components of angular velocity, and gyr′ is the gyroscope data after translation to the holding state. As defined below, φ is termed the adaptive heading offset, and ψ and θ are the pitch and roll angles of the phone in the calling state, respectively.(3)φ=Δβ+Δφ,ψ=arcsin−axg,θ=arctanayaz.Among them,a is the phone’s three-axis accelerometer data, Δβ is a fixed horizontal rotation angle, calculated from the heading before and after the carrying mode change, Δφ is the relative heading change caused by the nonhorizontal rotation of the head in the state of making a call, which is detected by the changes in the pitch and roll angles, and g is the local acceleration due to gravity. The corrected gyroscope data are obtained through the rotation matrix method, which effectively avoids the errors caused by the nonhorizontal shaking of the mobile phone in the calling state.To calculate the quaternion and pedestrian heading, we used the corrected gyroscope [22]:(4)φcalling=−arctan2q1q2−q0q3q02−q12+q22−q32.To verify the reliability of the rotation matrix method, an experimental comparative analysis was conducted. As thez-axis of the gyroscope undergoes the largest changes when turning in the holding state, the z-axis data of the gyroscope were selected for comparison (Figure 1).Figure 1
Comparison of gyroscopez-axis data in holding mode, in calling mode, and in calling mode after correction using the rotation matrix method.As shown in Figure1, when a pedestrian followed a sequence of instructions (“go straight,” “turn right,” and “turn left”), the gyroscope z-axis data obtained by the rotation matrix method in the calling state were approximately the same as the data obtained from the holding state; however, in the calling state, the unprocessed data did not respond significantly during the turns and hence did not capture the pedestrian’s heading changes.


## 2.2. Pocket Mode Heading Estimation Based on a RA-PCA Method

### 2.2.1. Existing Heading Estimation Methods and Analysis

When a pedestrian walks with a mobile phone in their trouser pocket, the phone not only moves with the pedestrian’s legs, but also may change its relative position within the pocket. Therefore, the directly calculated mobile phone attitude is difficult to accurately represent the pedestrian’s heading in this state. Some authors have used PCA methods based on acceleration data for pedestrian heading estimation [18]; others have calculated quaternions based on gyroscope data and used RA methods to calculate the rotation axes for pedestrian heading estimation [20].However, the PCA approach is affected by 180° ambiguity between the forward and backward swings of the mobile phone, and by unstable horizontal accelerations. The RA method generates errors due to the cumulative drift of the gyroscope, and the method is limited by the rotational instability of the phone’s orientation relative to the pedestrian’s pocket. Therefore, independent use of the accelerometer-based PCA method or the gyroscope-based RA method can produce limited results.To improve the accuracy of the pedestrian heading estimation in the pocket state, we propose an RA-PCA algorithm that leverages the complementary characteristics of the RA and PCA methods. In this approach, gravity accelerometer data are used to avoid the 180° ambiguity, and the RA and PCA heading methods are combined to reduce overall heading errors.


### 2.2.2. Heading Estimation Based on RA-PCA

As a mobile phone in a trouser pocket swings back and forth with a pedestrian’s legs, the accelerations obtained by the PCA method will swing back and forth to produce a 180° ambiguity in the direction of travel. The RA method can also incur a 180° change in forward direction if the phone’s rotation axis changes. To avoid the influence of 180° ambiguity on heading estimation, it is necessary to select a suitable subset of data for use in the heading calculation.(1) Selection of Data for the Heading Calculation. In the process of walking, with each step, one leg will be the centre of gravity, and the other leg will move forward. The 180° heading ambiguity can be resolved by estimating the pedestrian’s heading using only the data where the leg carrying the phone is moving forward (Figure 2).Figure 2
Selection of a data subset for use in heading direction estimation.The measured parameter shown in the figure is calculated from thex and y axes of the gravity accelerometer (equation (5)). The subset of data for use in heading estimation are obtained between the peak and successive trough of the value.(5)gxy=gx2+gy2.(2) Pedestrian Heading Estimation. From the selected subset of accelerometer data, PCA can be used to obtain the principal vectors, and equation (6) can be applied to convert the principal vectors from the mobile phone coordinate system to the navigation coordinate system. (6)vin1vin2vin3=Cbnvi1vi2vi3.By projectingvi∗ onto the horizontal plane, the principal vector, vin1vin2, can be calculated for the pedestrian’s direction of travel. i is a sample point; the PCA heading at the corresponding sample point can then be obtained.(7)headingiPCA=arctanvin2vin1.The RA method determines the axis of rotation according to the change of the quaternion as a pedestrian walks [22]. Here, the rotation axis in a data subset is calculated according to its quaternion transformation. As the rotation axis is perpendicular to the direction of movement of the phone, the axis is projected onto the horizontal plane, and the relative heading of the pedestrian is then calculated according to the direction of the horizontal plane axis. Taking one step as an example, the number of sampling points in the data subset is t, and the change of the quaternion is calculated by(8)qtmt10qtmt11qtmt12qtmt13=qt10qt11qt12qt13⊗qtm0qtm1qtm2qtm3,t1 and tm are, respectively, represented as the first sampling point and the mth sampling point in the data subset, qtmt1∗ is the quaternion change from t1 to tm, and qt1∗ is the quaternion of the t1 sampling point.A quaternion can be understood as a process of rotation from one point to another along a certain axis [23]. Similarly, the rotation axis, uq, of this process can be roughly estimated based on the quaternions before and after the rotation. Here, u is the average value of the rotation axis within the subset of data selected for heading estimation. This rotation axis is converted to the navigation coordinate system to obtain un, then un is projected onto the horizontal plane, and the rotation axis vector is normalised to obtain the direction of the rotation axis in the navigation coordinate system.(9)qtmt1=cosϕ,sinϕ⋅uq,uq=q1sinϕ,q2sinϕ,q3sinϕ,un=Cbnu,headingiRA=arctanuin2uin1.The above RA and PCA methods use the same data subsets for each calculation.φiPCA and φiRA are the PCA and RA relative heading, respectively. Using a complementary coefficient K, the trust degree of the PCA method is adaptively restricted, such that the trust degree of the PCA heading is reduced when the PCA method is unstable. Use of this coefficient establishes the complementary RA-PCA pedestrian heading, φiRA−PCA, in the pocket mode.(10)φiRA−PCA=KφiPCA+1−KφiRA.The coefficientK is obtained by the following equation:(11)K=1φ′,Δφ>2,12,Δφ≤2.When the phone’s screen is facing towards the pedestrian’s right (the phone is usually in the left leg pocket at this time),K=−K, and when the phone’s screen is facing towards the pedestrian’s left (the phone is in the right leg pocket), K=K. φ′ is obtained by(12)φ′=φiPCA−φiRA.The RA method using the gyroscope is stable, but it is affected by cumulative error from the gyroscope readings, whereas the PCA method based on the accelerometer data is less stable, but it can partially compensate for the cumulative error of the RA method. A comparison of PCA, RA, and RA-PCA headings obtained using the above methods is shown in Figure3. The PCA headings progressively deviated from the reference headings as the test progressed. Although the RA heading was stable, there were still some systematic errors observed. The RA-PCA method leveraged complementary information from the PCA method, but it retained the stability of the RA method and improved the overall heading accuracy.Figure 3
Comparison of pocket mode heading estimation methods.


## 2.2.1. Existing Heading Estimation Methods and Analysis

When a pedestrian walks with a mobile phone in their trouser pocket, the phone not only moves with the pedestrian’s legs, but also may change its relative position within the pocket. Therefore, the directly calculated mobile phone attitude is difficult to accurately represent the pedestrian’s heading in this state. Some authors have used PCA methods based on acceleration data for pedestrian heading estimation [18]; others have calculated quaternions based on gyroscope data and used RA methods to calculate the rotation axes for pedestrian heading estimation [20].However, the PCA approach is affected by 180° ambiguity between the forward and backward swings of the mobile phone, and by unstable horizontal accelerations. The RA method generates errors due to the cumulative drift of the gyroscope, and the method is limited by the rotational instability of the phone’s orientation relative to the pedestrian’s pocket. Therefore, independent use of the accelerometer-based PCA method or the gyroscope-based RA method can produce limited results.To improve the accuracy of the pedestrian heading estimation in the pocket state, we propose an RA-PCA algorithm that leverages the complementary characteristics of the RA and PCA methods. In this approach, gravity accelerometer data are used to avoid the 180° ambiguity, and the RA and PCA heading methods are combined to reduce overall heading errors.


## 2.2.2. Heading Estimation Based on RA-PCA

As a mobile phone in a trouser pocket swings back and forth with a pedestrian’s legs, the accelerations obtained by the PCA method will swing back and forth to produce a 180° ambiguity in the direction of travel. The RA method can also incur a 180° change in forward direction if the phone’s rotation axis changes. To avoid the influence of 180° ambiguity on heading estimation, it is necessary to select a suitable subset of data for use in the heading calculation.(1) Selection of Data for the Heading Calculation. In the process of walking, with each step, one leg will be the centre of gravity, and the other leg will move forward. The 180° heading ambiguity can be resolved by estimating the pedestrian’s heading using only the data where the leg carrying the phone is moving forward (Figure 2).Figure 2
Selection of a data subset for use in heading direction estimation.The measured parameter shown in the figure is calculated from thex and y axes of the gravity accelerometer (equation (5)). The subset of data for use in heading estimation are obtained between the peak and successive trough of the value.(5)gxy=gx2+gy2.(2) Pedestrian Heading Estimation. From the selected subset of accelerometer data, PCA can be used to obtain the principal vectors, and equation (6) can be applied to convert the principal vectors from the mobile phone coordinate system to the navigation coordinate system. (6)vin1vin2vin3=Cbnvi1vi2vi3.By projectingvi∗ onto the horizontal plane, the principal vector, vin1vin2, can be calculated for the pedestrian’s direction of travel. i is a sample point; the PCA heading at the corresponding sample point can then be obtained.(7)headingiPCA=arctanvin2vin1.The RA method determines the axis of rotation according to the change of the quaternion as a pedestrian walks [22]. Here, the rotation axis in a data subset is calculated according to its quaternion transformation. As the rotation axis is perpendicular to the direction of movement of the phone, the axis is projected onto the horizontal plane, and the relative heading of the pedestrian is then calculated according to the direction of the horizontal plane axis. Taking one step as an example, the number of sampling points in the data subset is t, and the change of the quaternion is calculated by(8)qtmt10qtmt11qtmt12qtmt13=qt10qt11qt12qt13⊗qtm0qtm1qtm2qtm3,t1 and tm are, respectively, represented as the first sampling point and the mth sampling point in the data subset, qtmt1∗ is the quaternion change from t1 to tm, and qt1∗ is the quaternion of the t1 sampling point.A quaternion can be understood as a process of rotation from one point to another along a certain axis [23]. Similarly, the rotation axis, uq, of this process can be roughly estimated based on the quaternions before and after the rotation. Here, u is the average value of the rotation axis within the subset of data selected for heading estimation. This rotation axis is converted to the navigation coordinate system to obtain un, then un is projected onto the horizontal plane, and the rotation axis vector is normalised to obtain the direction of the rotation axis in the navigation coordinate system.(9)qtmt1=cosϕ,sinϕ⋅uq,uq=q1sinϕ,q2sinϕ,q3sinϕ,un=Cbnu,headingiRA=arctanuin2uin1.The above RA and PCA methods use the same data subsets for each calculation.φiPCA and φiRA are the PCA and RA relative heading, respectively. Using a complementary coefficient K, the trust degree of the PCA method is adaptively restricted, such that the trust degree of the PCA heading is reduced when the PCA method is unstable. Use of this coefficient establishes the complementary RA-PCA pedestrian heading, φiRA−PCA, in the pocket mode.(10)φiRA−PCA=KφiPCA+1−KφiRA.The coefficientK is obtained by the following equation:(11)K=1φ′,Δφ>2,12,Δφ≤2.When the phone’s screen is facing towards the pedestrian’s right (the phone is usually in the left leg pocket at this time),K=−K, and when the phone’s screen is facing towards the pedestrian’s left (the phone is in the right leg pocket), K=K. φ′ is obtained by(12)φ′=φiPCA−φiRA.The RA method using the gyroscope is stable, but it is affected by cumulative error from the gyroscope readings, whereas the PCA method based on the accelerometer data is less stable, but it can partially compensate for the cumulative error of the RA method. A comparison of PCA, RA, and RA-PCA headings obtained using the above methods is shown in Figure3. The PCA headings progressively deviated from the reference headings as the test progressed. Although the RA heading was stable, there were still some systematic errors observed. The RA-PCA method leveraged complementary information from the PCA method, but it retained the stability of the RA method and improved the overall heading accuracy.Figure 3
Comparison of pocket mode heading estimation methods.


## 2.3. Swinging Mode Heading Estimation Based on a Heading Capture Method

The swinging mode is similar to the pocket mode, so the pedestrian heading can be obtained using the RA-PCA method. However, compared to the pocket state, the swinging state has stronger regularity [24], so we can quickly capture more reliable pedestrian heading by use of it. Therefore, a swinging mode heading capture method is established based on the regular swing of a pedestrian’s arm. This method captures the specific point where the arm passes by the pedestrian’s body each time the arm swings. The heading angle of the mobile phone is obtained at this lowest point in the motion of the pedestrian’s hand. The heading offset is then removed from the captured heading angle of the mobile phone to obtain the walking direction of the pedestrian.In this method, when the pitch angle in the attitude of the phone is close to 0°, it is considered that the arm is close to the lowest point in its swing, so the heading angle of the mobile phone is captured each time the pitch angle crosses 0° (Figure4).Figure 4
Arm droop point capture method. As a pedestrian’s arm swings, the heading angle is captured each time the phone’s pitch angle crosses 0° (red boxes).As the mobile phone is not necessarily facing the pedestrian’s forward direction during the swing process, it is necessary to determine the offset angle,Δβswing, between the heading angle of the mobile phone and the forward direction of the pedestrian when the arm is at its lowest point. After switching to the swing arm state, the phone’s headings at the two drooping points in the first swing cycle can be used to calculate the heading offset.(13)Δβswing=12∑i=12φiswing−φlast,where φlast is the pedestrian’s heading before the swing and φiswing is the mobile phone’s heading captured by this method. These headings are all calculated using equation (4). The pedestrian’s heading at each subsequent step is obtained by subtracting the heading offset from the phone’s heading at that swing’s lowest point.


## 2.4. Pedestrian Heading Estimation Flowchart

The main procedures for obtaining the direction of a pedestrian’s travel in the above three mobile phone carrying modes are as follows: mobile phone accelerometer data and gyroscope data are extracted to determine the mobile phone carrying mode. When the mobile phone is in a holding state, the quaternion method is used to estimate the heading angle of the mobile phone, which is used as the pedestrian’s heading. When the phone is in a calling state, the rotation matrix method is used to calculate the pedestrian’s heading. When the phone is in a pocket state, a subset of forward motion data is extracted, and the RA-PCA method is used to calculate the pedestrian’s heading. When in a swinging mode, the heading capture method is used to obtain the pedestrian’s heading.A flowchart representing the carrying modes and their respective heading estimation methods is shown in Figure5.Figure 5
Flowchart of pedestrian heading estimation methods for multiple mobile phone carrying modes.


## 3. Experiment

An OPPO R9s smartphone was used to experimentally test our pedestrian heading estimation methods, and to collect data at a sampling frequency of 50 Hz. Some parameters of this smartphone’s inertial sensors are shown in Table1.Table 1
Specifications of the OPPO R9s smartphone’s inertial sensors.
ACCGYRFull scale±2 g±2000°/sNonlinearity0.5% FS0.1% FSBias stability—15°/hNoise density180μg/Hz0.008°/s/HzThe walking route for our testing of the three carrying modes was rectangular, with a total length of approximately 100 metres. When pedestrians use a phone with their left or right hands (or carry a phone in their left or right trouser pockets), the posture and rotation processes of their phones are different. To verify the effectiveness of our methods in left- and right-side use, each set of tests included comparative experiments on both sides.


### 3.1. Calling State Experiment

For the calling state testing, pedestrians first walked a certain distance with their mobile phones in a holding state, then switched to a calling state to walk the next part of the route, and finally returned to a holding state to reach the end destination. As shown in Figure6, this part of the experiment compared the actual (reference) walking route to the headings estimated using the heading offset method and this paper’s proposed rotation matrix method. The comparative heading errors are plotted in Figure 7 and summarised in Table 2.Figure 6
Reference and estimated paths of the walking route used in the calling mode experiments. (a) Phone carried in the left hand. (b) Phone carried in the right hand.
(a)(b)Figure 7
Comparison of pedestrian heading estimation errors of the calling mode experiments. (a) Phone carried in the left hand. (b) Phone carried in the right hand.
(a)(b)Table 2
Calling state heading error comparisons (in degrees).
Heading estimation methodPhone in the left handPhone in the right hand50% error95% error50% error95% errorHeading offset3.786.983.336.48Rotation matrix2.785.242.775.81Figures6 and 7 and Table 2 demonstrate that the rotation matrix method captured the pedestrian walking route more accurately. In the calling state, 95% of the heading errors using our method were within 5.24° in the left-sided experiment and 5.81° in the right-sided experiment; 50% of the heading errors were within 2.78° and 2.77°, respectively. These results were more accurate than the heading offset method estimates.


### 3.2. Pocket State Experiment

The pocket mode experiments started with a pedestrian carrying the mobile phone in a holding state, then putting the mobile phone in their left or right leg trouser pocket for the next section of the route (the phone’s screen is facing towards the pedestrian’s right or left), and then returning the phone to the holding state for the final section. This experiment used the RA, PCA, and RA-PCA methods to estimate pedestrian headings from the collected data. Figure8 compares the actual walking route to the results from each of the pocket mode heading estimation methods. The comparative heading errors are plotted in Figure 9 and summarised in Table 3.Figure 8
Reference and estimated paths of the walking route used in the pocket mode experiments. (a) Phone carried in the left pocket. (b) Phone carried in the right pocket.
(a)(b)Figure 9
Comparison of pedestrian heading estimation errors of the pocket mode experiments. (a) Phone carried in the left pocket. (b) Phone carried in the right pocket.
(a)(b)Table 3
Pocket state heading error comparisons (in degrees).
Heading estimation methodThe left pocketThe right pocket50% error95% error50% error95% errorPCA17.6142.699.6733.74RA4.7113.035.8412.03RA-PCA3.5910.732.256.99Figures8 and 9 and Table 3 show that whether the mobile phone was carried in a left or right leg trouser pocket, the RA-PCA method produced lower heading estimation errors than the PCA or RA methods alone. 95% of the RA-PCA heading errors in the left and right pocket tests were within 8.02° and 6.99°, respectively, and 50% of the heading errors were within 3.59° and 2.25°, respectively. An earlier study obtained a root mean square error of 4.17° using the improved RA method [20]. Our root mean square error was approximately 3.9° using the RA method, which is similar to that study’s findings. In our experiments, the RA-PCA method achieved higher heading accuracy (2.89°) than the RA method.


### 3.3. Swinging State Experiment

The swinging state experiment was similar to the previous experiments, but tested the original heading method and our heading capture method. Figure10 compares the actual and estimated walking routes from the swinging state experiment. Figure 11 shows the comparative heading errors, and the overall errors are summarised in Table 4.Figure 10
Reference and estimated paths of the walking route used in the swinging mode experiments. (a) Phone carried in the left hand. (b) Phone carried in the right hand.
(a)(b)Figure 11
Comparison of pedestrian heading estimation errors of the swinging mode experiments. (a) Phone carried in the left hand. (b) Phone carried in the right hand.
(a)(b)Table 4
Swinging state heading error comparison (in degrees).
Heading estimation methodThe left handThe right hand50% error95% error50% error95% errorHeading capture3.056.702.069.22Raw heading5.5123.518.2420.82Figures10 and 11 and Table 4 demonstrate that the raw heading method was unstable in the swinging mode, whereas the heading calculated using the heading capture method was relatively stable. In the left-handed experiment, the route from the original heading method deviated significantly from the reference route (Figure 10(a)). In the right-handed experiment (Figure 10(b)), the raw heading method’s route deviation was less pronounced. In raw heading, a part of step frequency points is close to the arm drooping point, and the average heading of the other part of the points is consistent with the forward direction. 95% of the heading errors from the heading capture method were within 6.70° and 9.22° for the left and right hands, respectively, and 50% of the heading errors were within 3.05° and 2.06°, respectively. These errors were much lower than those from the raw heading method.


## 3.1. Calling State Experiment

For the calling state testing, pedestrians first walked a certain distance with their mobile phones in a holding state, then switched to a calling state to walk the next part of the route, and finally returned to a holding state to reach the end destination. As shown in Figure6, this part of the experiment compared the actual (reference) walking route to the headings estimated using the heading offset method and this paper’s proposed rotation matrix method. The comparative heading errors are plotted in Figure 7 and summarised in Table 2.Figure 6
Reference and estimated paths of the walking route used in the calling mode experiments. (a) Phone carried in the left hand. (b) Phone carried in the right hand.
(a)(b)Figure 7
Comparison of pedestrian heading estimation errors of the calling mode experiments. (a) Phone carried in the left hand. (b) Phone carried in the right hand.
(a)(b)Table 2
Calling state heading error comparisons (in degrees).
Heading estimation methodPhone in the left handPhone in the right hand50% error95% error50% error95% errorHeading offset3.786.983.336.48Rotation matrix2.785.242.775.81Figures6 and 7 and Table 2 demonstrate that the rotation matrix method captured the pedestrian walking route more accurately. In the calling state, 95% of the heading errors using our method were within 5.24° in the left-sided experiment and 5.81° in the right-sided experiment; 50% of the heading errors were within 2.78° and 2.77°, respectively. These results were more accurate than the heading offset method estimates.


## 3.2. Pocket State Experiment

The pocket mode experiments started with a pedestrian carrying the mobile phone in a holding state, then putting the mobile phone in their left or right leg trouser pocket for the next section of the route (the phone’s screen is facing towards the pedestrian’s right or left), and then returning the phone to the holding state for the final section. This experiment used the RA, PCA, and RA-PCA methods to estimate pedestrian headings from the collected data. Figure8 compares the actual walking route to the results from each of the pocket mode heading estimation methods. The comparative heading errors are plotted in Figure 9 and summarised in Table 3.Figure 8
Reference and estimated paths of the walking route used in the pocket mode experiments. (a) Phone carried in the left pocket. (b) Phone carried in the right pocket.
(a)(b)Figure 9
Comparison of pedestrian heading estimation errors of the pocket mode experiments. (a) Phone carried in the left pocket. (b) Phone carried in the right pocket.
(a)(b)Table 3
Pocket state heading error comparisons (in degrees).
Heading estimation methodThe left pocketThe right pocket50% error95% error50% error95% errorPCA17.6142.699.6733.74RA4.7113.035.8412.03RA-PCA3.5910.732.256.99Figures8 and 9 and Table 3 show that whether the mobile phone was carried in a left or right leg trouser pocket, the RA-PCA method produced lower heading estimation errors than the PCA or RA methods alone. 95% of the RA-PCA heading errors in the left and right pocket tests were within 8.02° and 6.99°, respectively, and 50% of the heading errors were within 3.59° and 2.25°, respectively. An earlier study obtained a root mean square error of 4.17° using the improved RA method [20]. Our root mean square error was approximately 3.9° using the RA method, which is similar to that study’s findings. In our experiments, the RA-PCA method achieved higher heading accuracy (2.89°) than the RA method.


## 3.3. Swinging State Experiment

The swinging state experiment was similar to the previous experiments, but tested the original heading method and our heading capture method. Figure10 compares the actual and estimated walking routes from the swinging state experiment. Figure 11 shows the comparative heading errors, and the overall errors are summarised in Table 4.Figure 10
Reference and estimated paths of the walking route used in the swinging mode experiments. (a) Phone carried in the left hand. (b) Phone carried in the right hand.
(a)(b)Figure 11
Comparison of pedestrian heading estimation errors of the swinging mode experiments. (a) Phone carried in the left hand. (b) Phone carried in the right hand.
(a)(b)Table 4
Swinging state heading error comparison (in degrees).
Heading estimation methodThe left handThe right hand50% error95% error50% error95% errorHeading capture3.056.702.069.22Raw heading5.5123.518.2420.82Figures10 and 11 and Table 4 demonstrate that the raw heading method was unstable in the swinging mode, whereas the heading calculated using the heading capture method was relatively stable. In the left-handed experiment, the route from the original heading method deviated significantly from the reference route (Figure 10(a)). In the right-handed experiment (Figure 10(b)), the raw heading method’s route deviation was less pronounced. In raw heading, a part of step frequency points is close to the arm drooping point, and the average heading of the other part of the points is consistent with the forward direction. 95% of the heading errors from the heading capture method were within 6.70° and 9.22° for the left and right hands, respectively, and 50% of the heading errors were within 3.05° and 2.06°, respectively. These errors were much lower than those from the raw heading method.


## 4. Conclusion

In this paper, based on the three carrying modes of smart phones, calling, pocket, and swinging, we study the methods for determining the direction of pedestrians in the above modes. The results are as follows:(1)
In the calling state, a rotation matrix was established according to the change of the pedestrian’s posture and was used to adjust the phone’s sensor data from the calling state to the accurate pedestrian heading. In experimental comparison with the traditional heading offset method over a 100 m rectangular walking route, the rotation matrix method reduced the 95% heading error by approximately 25% when the phone was held in the left hand and 10% when the phone was held in the right hand.(2)
In the pocket state, a subset of the data was selected where the phone would be moving forward steadily during walking. Complementary advantages of the PCA and RA methods were leveraged to establish a combined RA-PCA heading equation. In experimental results from a 100 m rectangular route, the RA-PCA method reduced the 95% pedestrian heading errors in the left and right leg pocket tests by approximately 74% and 79%, respectively, relative to those from the PCA method. The corresponding improvements when the RA-PCA method was compared with the RA method were approximately 18% and 42%, respectively.(3)
In the swinging state, the drooping points of the pedestrian’s arm were captured during each arm swing, and the heading offset between the phone and the direction of travel was captured in the first swing cycle of the pedestrian’s arm. The forward direction of the pedestrian was determined by correcting the heading of the mobile phone using this heading offset. In experimental tests similar to those already described, the 95% heading errors using this method were greatly improved (by approximately 56%–72%) compared to those of the raw heading method.The methods presented in the paper achieved good results in three conventional carrying modes. However, heading accuracy will be affected when more complicated carrying modes are considered.



---

*Source: 1193268-2021-08-31.xml*