# Axis-Exchanged Compensation and Gait Parameters Analysis for High Accuracy Indoor Pedestrian Dead Reckoning

Authors: Honghui Zhang; Jinyi Zhang; Duo Zhou; Wei Wang; Jianyu Li; Feng Ran; Yuan Ji
Journal: Journal of Sensors
 (2015)

---

## Abstract

Pedestrian dead reckoning (PDR) is an effective way for navigation coupled with GNSS (Global Navigation Satellite System) or weak GNSS signal environment like indoor scenario. However, indoor location with an accuracy of 1 to 2 meters determined by PDR based on MEMS-IMU is still very challenging. For one thing, heading estimation is an important problem in PDR because of the singularities. For another thing, walking distance estimation is also a critical problem for pedestrian walking with randomness. Based on the above two problems, this paper proposed axis-exchanged compensation and gait parameters analysis algorithm to improve the navigation accuracy. In detail, an axis-exchanged compensation factored quaternion algorithm is put forward first to overcome the singularities in heading estimation without increasing the amount of computation. Besides, real-time heading is updated by R-adaptive Kalman filter. Moreover, gait parameters analysis algorithm can be divided into two steps: cadence detection and step length estimation. Thus, a method of cadence classification and interval symmetry is proposed to detect the cadence accurately. Furthermore, a step length model adjusted by cadence is established for step length estimation. Compared to the traditional PDR navigation, experimental results showed that the error of navigation reduces 32.6%.


---

## Body

## 1. Introduction

With the increasing popularity of location based service (LBS), as a key factor in LBS, the importance of positioning is widely acknowledged. In practice, outdoor location technology is much more mature than indoor location technology. This imbalance leads to the fact that LBS can hardly be achieved in weak GNSS signal environment such as indoor location. Therefore, numerous scholars and groups are devoted to the research of indoor location, for example, indoor location technologies based on WIFI [1], RFID [2], Bluetooth [3–5], and wireless sensor networks [6]. However, the abovementioned technologies are susceptible to external environment.Differentiated from other technologies, MEMS-IMU is a technique that applied to positioning with advantages of autonomous measurement. And pedestrian dead reckoning (PDR), one of the most important methods to achieve navigation with MEMS-IMU, was first proposed by Judd and Levi in 1996 [7]. According to the view of Judd and Levi, PDR is simplified by heading detection, filtering, cadence detection, and step length estimation. For convenient analysis, we further simplify four steps to heading detection and walking distance estimation. Cadence and step length are the two gait parameters contained in walking distance estimation.As for heading estimation, the direction represented by three-parameter method leads to singularities, which have always confused us. To solve this problem, many methods have been put forward. In [8], improved predicted singularity robustness (PSR) is introduced to mitigate the influence of singularities. However, this improvement does not eliminate singularities completely. Thus, according to Lie group, Park and Chung presented the Lie group geometric method which is singularity-free [9]. While the two aforementioned methods focus on avoiding singularities, Yun et al. have chosen to overcome singularities by using “borrow angle” and “return angle” [10]. This method provides a high accuracy overall, but at the cost of an increased calculation workload. Although singularities have been eliminated to a certain extent in the above methods, they are all in static state and are either too deficient or too complex.As for walking distance estimation, starting with the gait parameters of cadence and step length, [11] calibrates the step length model for each person with two hybridization filters, while it has the inconvenience of offline calibration. To solve this problem, the authors proposed a real-time walking parameters estimation model in [12], where zero-approximation step detection algorithm and walking speed are integrated into the above model to improve the accuracy. Nevertheless, it is a complex calculation process. In application domain, Honeywell first proposed the relationship between cadence and step length in [13], which achieved navigation by accumulating step length obtained from IMU. Most of the step length models are the complex offline training required, and the cadence detection is not sufficiently accurate.With the problems of deficiency and complexity in heading estimation, offline training, and inaccuracy in walking distance, to deal with the above problems, this paper proposed axis-exchanged compensation and gait parameters analysis algorithm of PDR to achieve a relatively high accuracy indoor navigation by MEMS-IMU. At the beginning, heading singularities are fixed by axis-exchanged compensation factored quaternion algorithm in static state. Then we updated the quaternion by R-adaptive Kalman filter to obtain a real-time heading. Subsequently, walking distance, especially cadence and step length, is estimated according to the characteristic of walking pedestrian. To address cadence, method of cadence classification and interval symmetry is applied to detection; meanwhile, a step length model adjusted by cadence is built to estimate the step length. In addition, since the step length of pedestrian is influenced by walking speed, cadence, individual differences, and other reasons, we customized the step length model for every pedestrian to improve the accuracy of indoor PDR navigation. As the above algorithms and methods are applied to PDR navigation, experiments showed that the navigation error reduces 32.6% by axis-exchanged compensation and gait parameters analysis algorithm.The rest of this paper is organized as follows. Section2 describes the heading estimation with axis-exchanged compensation factored quaternion algorithm. To achieve real-time heading output, R-adaptive Kalman filter is proposed as well. Section 3 proposes the estimation method of walking distance in cadence by classification and interval symmetry and in step length by model which is adjusted by cadence. Then, Section 4 describes the entire PDR when it applies axis-exchanged compensation and gait parameters analysis algorithm, while experiments and performance are listed in Section 5. Finally Section 6 concludes this paper.


## 2. Heading Estimation

Heading direction is an important factor for PDR navigation. In order to obtain the direction, factored quaternion algorithm is used with the advantage of only one-step calculation. However, this method inevitably brings in singularities at some situation because it derived from 3D orientation Euler angles. To eliminate the singularities, axis-exchanged compensation algorithm is applied to factored quaternion without increasing the amount of computation. While the above algorithm is based on static state, for obtaining a real-time heading direction, Kalman filter is used to update the direction. In addition, R-adaptive mechanism is proposed to improve the Kalman estimation accuracy.


### 2.1. Axis-Exchanged Compensation and Factored Quaternion

#### 2.1.1. Factored Quaternion Algorithm

To describe the factored quaternion algorithm and orientation, we first introduce two coordinate systems including body coordinate and North-East-Down coordinate. The body coordinate represents the orientation of MEMS-IMU, and North-East-Down (NED) coordinate represents the orientation of earth. Initially, body coordinate coincides with the NED coordinate, and body coordinate rotates the yaw angle (heading direction)φ degree around z-axis. Then, it rotates pitch angle θ degree around y-axis as well. Subsequently, the coordinate rotates roll angle γ degree around x-axis. In this way, the above three Euler angles can represent any orientation. Moreover, we applied factored quaternion algorithm to Euler angles and computed quaternions along with Euler angles, respectively. And finally three direction quaternions are fused to one unit quaternion.(1) Quaternion of Pitch and Roll. Due to the rotation independence of horizontal plane and vertical plane, for convenience, pitch and roll are calculated in advance.The quaternions are derived in [10] and quaternion of pitch is(1)qθ=cos⁡θ21000+sinθ20010,where(2)sinθ2=signsinθ1-cos⁡θ2,cos⁡θ2=1+cos⁡θ2.Here,sign(a)=1 when a≥0; conversely, sign(a)=-1 when a<0.Similarly, quaternion of roll is given by(3)qγ=cos⁡γ21000+sinγ20100,where(4)sinγ=-a¯ycos⁡θ,cos⁡γ=-a¯zcos⁡θ.Here,a¯y and a¯z are the acceleration of y-axis and z-axis, respectively.(2) Quaternion of Yaw. For obtaining yaw φ, the magnetic flux density is assumed as mb=mbxmbymbzT and then converted to horizontal plane. The transformation formula is(5)mc=qθqγmbqθqγ*.In order to further simplify the problem, the declination exists in magnetic north and due north is ignored, and the geomagnetic field north is represented by symbolBN. At this point, relationship between magnetic flux density and geomagnetic field intensity in horizontal plane can be described as follows:(6)mcx·cos⁡φ-mcy·sinφ=BN,mcx·sinφ+mcy·cos⁡φ=0.Calculating the normalized magnetic flux densitiesm¯cx and m¯cy in horizontal plane, the sine and cosine value for yaw are(7)cos⁡φ=m-cx,sinφ=-m-cy.Finally quaternion of yaw can be represented as(8)qφ=cos⁡φ21000+sinφ20001.(3) Quaternion Data Fusion. To improve the accuracy, formulas (1), (3), and (8) are fused together as a unit quaternion qm, which can be expressed as(9)qm=qφqθqγ.The flow of fusion is illustrated in Figure1.Figure 1
Flow of the factored quaternion algorithm.So far, the factored quaternion algorithm utilizes gravity and geomagnetic field intensity as a reference. In contrast with the traditional static orientation estimation, factored quaternion algorithm eliminates the inexact matching by decomposing and fusing. For the most part, this inexact matching leads to estimation error in vertical direction, which will affect the horizontal direction (yaw) as well. While factored quaternion algorithm not only eliminates the inexact matching but also improves computational efficiency and avoids trigonometry operations by using half-angle formulas, the only imperfection is singularity in calculation. Thus axis-exchanged compensation algorithm is proposed.


#### 2.1.2. Axis-Exchanged Compensation Algorithm

According to (4), when the pitch angle θ turns to 90°/−90°, singularities will appear in roll calculation and finally lead to wrong attitude estimation. To overcome these singularities, [10] proposed a method of borrow angle compensation. The main idea is that the pitch angle rotates an additional α when cos⁡θ<ε (ε is a positive number which closes with 0); in this case, the equivalent pitch is θ-α. Based on the additional rotation, acceleration and magnetic flux density are transformed as well, and so is the factored quaternion algorithm. The above procedures are called borrow angle; on the contrary, the return angle is only one step that multiplies the calculated quaternion by additional rotation angle quaternion qα. Therefore the final quaternion returns to actual one, and singularities are avoided by the above steps at the same time. However, this method increases the amount of computation due to the complicated borrow angle and return angle.Through the above analysis and geometry application, axis-exchanged compensation algorithm is proposed. This algorithm estimates singularities without increasing the amount of computation and thereby saves hardware overhead and improves the overall algorithm in real-time performance.In the view of geometry, singularities are introduced in rotation orderz-y-x when pitch angle θ turns to 90°/−90° around the middle level y-axis. In this situation, x-axis coincides with z-axis, which means that it loses the freedom of third level shaft. In other words, this phenomenon is the so-called gimbal lock in classical orientation estimation. Based on the above analysis, it is not difficult to find out that singularities can be avoided by combining quaternion algorithm with solution of gimbal lock. In practice, when the gimbal lock occurs, it can be avoided by changing rotation as follows.Step 1.
Return to the original posture.Step 2.
Rotate the yaw angle 180° aroundz-axis.Step 3.
Rotate the roll angle 180° aroundx-axis.Step 4.
Rotate the pitch angle 90° aroundy-axis.In the same way, when the pitch angleθ closes with 90°/−90°, axis-exchanged compensation algorithm can be applied to avoid singularities. The steps are similar to the solution of gimbal lock when singularities appeared.Step 1.
Match the measured acceleration data and magnetic flux density to the reverse side.Step 2.
Regard the pitch angleθ as 0 degree and substitute it into formulas (3) and (8).Step 3.
Substitute the original pitch angleθ into formula (9) for obtaining the final unit quaternion.According to the above steps, axis-exchanged compensation algorithm is able to avoid singularities by data matching without increasing the amount of computation. Figure2 illustrates an example of data matching in axis-exchanged compensation algorithm. In Figure 2, gimbal lock occurs when the body changes position 1 to position 2 along with the pitch direction (y-axis). In this case, we match the data from position 2 to position 3 according to axis-exchanged compensation steps. Thus the x-axis data in position 3 and the z-axis data in position 2 are a pair of opposite numbers; meanwhile, the z-axis data in position 3 equals the x-axis data in position 2. So far, singularities are avoided by axis-exchanged compensation factored quaternion algorithm.Figure 2
Data matching by axis-exchanged compensation.In general, changing the rotation order means changing the shaft level relationship. As a matter of fact, the axis-exchanged compensation can never eliminate singularities indeed; it merely transfers them. In other words, when singularities occurred, the essence of axis-exchanged compensation algorithm is to change the rotation order fromz-y-x to z-x-y. But the calculation order has never been changed, which means that the shaft level relationship has never been changed neither, so there is nothing to worry about introducing other singularities.


### 2.2. R-Adaptive Kalman Filter

The above axis-exchanged compensation factored quaternion algorithm is based on static state; in order to obtain a real-time direction estimation, R-adaptive Kalman filter is presented in this paper. According to the quaternion differential equation and static unit quaternion provided in Section2.1, R-adaptive Kalman filter is designed for acquiring real-time orientation quaternion.


#### 2.2.1. Kalman Filter Based on Quaternion

A Kalman filter for quaternion is proposed in [14]; thus we briefly introduce the Kalman filter and put the emphasis on R-adaptive adjustment. In quaternion algorithm, the relationship of angular velocity ω is provided by gyro and quaternion q could be written as(10)q˙=12Rωb·q,where(11)Rωb=0-ωbωbω*,ω*=0ωbz-ωby-ωbz0ωbxωby-ωbx0.According to (10), a quaternion-based Kalman filter is constructed and shown in Figure 3.Figure 3
Flow of the quaternion-based Kalman filter.As shown in Figure3, the flow of quaternion-based Kalman filter can be described as follows.Step 1.
Calculate the state variableq^0 and error covariance P0 by factored quaternion algorithm as the initial value.Step 2.
Thea priori state estimate q^k- and thea priori estimate error covariance Pk- are computed by time update equations.Step 3.
Noise covariance matricesQ and R are used to calculate the Kalman gain Kk based on the Kalman gain equation.Step 4.
Substitute the measurement variablezk which is a static quaternion that derived from factored quaternion algorithm into the measurement update equation; meanwhile, adjust the weights between thea prior state estimate q^k- and innovation zk-q^k- for obtaining a relatively accurate real-time orientation quaternion.


#### 2.2.2. R-Adaptive Adjustment

Axis-exchanged compensation factored quaternion algorithm is used in the condition of static state or quasi-static state, while nonlinear acceleration will be introduced in the measurement when MEMS-IMU moves at high speed, thereby leading to large bias. So the measurement variablezk in Kalman filter not only loses its ability of calibration but also causes mistakes. To avoid this situation, R-adaptive adjustment mechanism is applied to Kalman filter. As a result, R-adaptive Kalman filter eliminates the influence caused by nonlinear acceleration via controlling the Kalman gain. In detail, for adjusting the noise covariance matrix R in real time, the mechanism sets the dynamic and static thresholds through the relationship between thresholds and 3-axis acceleration.If we define the 3-axis acceleration asδa=|ax2+ay2+az2-g| and set the static threshold as asta=σax2+σay2+σaz2, where σa denotes the noise standard deviation in static state and adyn denotes the dynamic threshold, the rules are designed as follows.Rule 1.
Whenδa≤asta, it means that the measured object is in static state and the measured data is reliable and accurate. So R need not be adjusted or need to be adjusted slightly. Thus(12)Rk=s·R,s∈10-1,1.Rule 2.
Whenasta≤δa≤adyn and |δak-δak-1|≤asta, it means that the measured object has the tendency to move; thus Rk=R. If the |δak-δak-1|>asta, it means that the measured object has the tendency to make nonlinear acceleration, while the measured data is still worth reference. Thus(13)Rk=δak-δak-1asta·R.Rule 3.
Whenδa>adyn, it means that the measured object is in high speed; at this time, the measured data loses value completely. Thus(14)Rk=I.The noise covariance matrixR is adjusted by the above rules in real time, and the adjusted Rk is substituted into Kalman gain formula to obtain Kk. In this manner, the weights of dynamic and static quaternion are modified by Kalman gain Kk in real time, thereby achieving a relatively accurate heading estimation. As heading (yaw) is the only required orientation for navigation in PDR, consequently, we just need to take yaw data out of the unit quaternion.


## 2.1. Axis-Exchanged Compensation and Factored Quaternion

### 2.1.1. Factored Quaternion Algorithm

To describe the factored quaternion algorithm and orientation, we first introduce two coordinate systems including body coordinate and North-East-Down coordinate. The body coordinate represents the orientation of MEMS-IMU, and North-East-Down (NED) coordinate represents the orientation of earth. Initially, body coordinate coincides with the NED coordinate, and body coordinate rotates the yaw angle (heading direction)φ degree around z-axis. Then, it rotates pitch angle θ degree around y-axis as well. Subsequently, the coordinate rotates roll angle γ degree around x-axis. In this way, the above three Euler angles can represent any orientation. Moreover, we applied factored quaternion algorithm to Euler angles and computed quaternions along with Euler angles, respectively. And finally three direction quaternions are fused to one unit quaternion.(1) Quaternion of Pitch and Roll. Due to the rotation independence of horizontal plane and vertical plane, for convenience, pitch and roll are calculated in advance.The quaternions are derived in [10] and quaternion of pitch is(1)qθ=cos⁡θ21000+sinθ20010,where(2)sinθ2=signsinθ1-cos⁡θ2,cos⁡θ2=1+cos⁡θ2.Here,sign(a)=1 when a≥0; conversely, sign(a)=-1 when a<0.Similarly, quaternion of roll is given by(3)qγ=cos⁡γ21000+sinγ20100,where(4)sinγ=-a¯ycos⁡θ,cos⁡γ=-a¯zcos⁡θ.Here,a¯y and a¯z are the acceleration of y-axis and z-axis, respectively.(2) Quaternion of Yaw. For obtaining yaw φ, the magnetic flux density is assumed as mb=mbxmbymbzT and then converted to horizontal plane. The transformation formula is(5)mc=qθqγmbqθqγ*.In order to further simplify the problem, the declination exists in magnetic north and due north is ignored, and the geomagnetic field north is represented by symbolBN. At this point, relationship between magnetic flux density and geomagnetic field intensity in horizontal plane can be described as follows:(6)mcx·cos⁡φ-mcy·sinφ=BN,mcx·sinφ+mcy·cos⁡φ=0.Calculating the normalized magnetic flux densitiesm¯cx and m¯cy in horizontal plane, the sine and cosine value for yaw are(7)cos⁡φ=m-cx,sinφ=-m-cy.Finally quaternion of yaw can be represented as(8)qφ=cos⁡φ21000+sinφ20001.(3) Quaternion Data Fusion. To improve the accuracy, formulas (1), (3), and (8) are fused together as a unit quaternion qm, which can be expressed as(9)qm=qφqθqγ.The flow of fusion is illustrated in Figure1.Figure 1
Flow of the factored quaternion algorithm.So far, the factored quaternion algorithm utilizes gravity and geomagnetic field intensity as a reference. In contrast with the traditional static orientation estimation, factored quaternion algorithm eliminates the inexact matching by decomposing and fusing. For the most part, this inexact matching leads to estimation error in vertical direction, which will affect the horizontal direction (yaw) as well. While factored quaternion algorithm not only eliminates the inexact matching but also improves computational efficiency and avoids trigonometry operations by using half-angle formulas, the only imperfection is singularity in calculation. Thus axis-exchanged compensation algorithm is proposed.


### 2.1.2. Axis-Exchanged Compensation Algorithm

According to (4), when the pitch angle θ turns to 90°/−90°, singularities will appear in roll calculation and finally lead to wrong attitude estimation. To overcome these singularities, [10] proposed a method of borrow angle compensation. The main idea is that the pitch angle rotates an additional α when cos⁡θ<ε (ε is a positive number which closes with 0); in this case, the equivalent pitch is θ-α. Based on the additional rotation, acceleration and magnetic flux density are transformed as well, and so is the factored quaternion algorithm. The above procedures are called borrow angle; on the contrary, the return angle is only one step that multiplies the calculated quaternion by additional rotation angle quaternion qα. Therefore the final quaternion returns to actual one, and singularities are avoided by the above steps at the same time. However, this method increases the amount of computation due to the complicated borrow angle and return angle.Through the above analysis and geometry application, axis-exchanged compensation algorithm is proposed. This algorithm estimates singularities without increasing the amount of computation and thereby saves hardware overhead and improves the overall algorithm in real-time performance.In the view of geometry, singularities are introduced in rotation orderz-y-x when pitch angle θ turns to 90°/−90° around the middle level y-axis. In this situation, x-axis coincides with z-axis, which means that it loses the freedom of third level shaft. In other words, this phenomenon is the so-called gimbal lock in classical orientation estimation. Based on the above analysis, it is not difficult to find out that singularities can be avoided by combining quaternion algorithm with solution of gimbal lock. In practice, when the gimbal lock occurs, it can be avoided by changing rotation as follows.Step 1.
Return to the original posture.Step 2.
Rotate the yaw angle 180° aroundz-axis.Step 3.
Rotate the roll angle 180° aroundx-axis.Step 4.
Rotate the pitch angle 90° aroundy-axis.In the same way, when the pitch angleθ closes with 90°/−90°, axis-exchanged compensation algorithm can be applied to avoid singularities. The steps are similar to the solution of gimbal lock when singularities appeared.Step 1.
Match the measured acceleration data and magnetic flux density to the reverse side.Step 2.
Regard the pitch angleθ as 0 degree and substitute it into formulas (3) and (8).Step 3.
Substitute the original pitch angleθ into formula (9) for obtaining the final unit quaternion.According to the above steps, axis-exchanged compensation algorithm is able to avoid singularities by data matching without increasing the amount of computation. Figure2 illustrates an example of data matching in axis-exchanged compensation algorithm. In Figure 2, gimbal lock occurs when the body changes position 1 to position 2 along with the pitch direction (y-axis). In this case, we match the data from position 2 to position 3 according to axis-exchanged compensation steps. Thus the x-axis data in position 3 and the z-axis data in position 2 are a pair of opposite numbers; meanwhile, the z-axis data in position 3 equals the x-axis data in position 2. So far, singularities are avoided by axis-exchanged compensation factored quaternion algorithm.Figure 2
Data matching by axis-exchanged compensation.In general, changing the rotation order means changing the shaft level relationship. As a matter of fact, the axis-exchanged compensation can never eliminate singularities indeed; it merely transfers them. In other words, when singularities occurred, the essence of axis-exchanged compensation algorithm is to change the rotation order fromz-y-x to z-x-y. But the calculation order has never been changed, which means that the shaft level relationship has never been changed neither, so there is nothing to worry about introducing other singularities.


## 2.1.1. Factored Quaternion Algorithm

To describe the factored quaternion algorithm and orientation, we first introduce two coordinate systems including body coordinate and North-East-Down coordinate. The body coordinate represents the orientation of MEMS-IMU, and North-East-Down (NED) coordinate represents the orientation of earth. Initially, body coordinate coincides with the NED coordinate, and body coordinate rotates the yaw angle (heading direction)φ degree around z-axis. Then, it rotates pitch angle θ degree around y-axis as well. Subsequently, the coordinate rotates roll angle γ degree around x-axis. In this way, the above three Euler angles can represent any orientation. Moreover, we applied factored quaternion algorithm to Euler angles and computed quaternions along with Euler angles, respectively. And finally three direction quaternions are fused to one unit quaternion.(1) Quaternion of Pitch and Roll. Due to the rotation independence of horizontal plane and vertical plane, for convenience, pitch and roll are calculated in advance.The quaternions are derived in [10] and quaternion of pitch is(1)qθ=cos⁡θ21000+sinθ20010,where(2)sinθ2=signsinθ1-cos⁡θ2,cos⁡θ2=1+cos⁡θ2.Here,sign(a)=1 when a≥0; conversely, sign(a)=-1 when a<0.Similarly, quaternion of roll is given by(3)qγ=cos⁡γ21000+sinγ20100,where(4)sinγ=-a¯ycos⁡θ,cos⁡γ=-a¯zcos⁡θ.Here,a¯y and a¯z are the acceleration of y-axis and z-axis, respectively.(2) Quaternion of Yaw. For obtaining yaw φ, the magnetic flux density is assumed as mb=mbxmbymbzT and then converted to horizontal plane. The transformation formula is(5)mc=qθqγmbqθqγ*.In order to further simplify the problem, the declination exists in magnetic north and due north is ignored, and the geomagnetic field north is represented by symbolBN. At this point, relationship between magnetic flux density and geomagnetic field intensity in horizontal plane can be described as follows:(6)mcx·cos⁡φ-mcy·sinφ=BN,mcx·sinφ+mcy·cos⁡φ=0.Calculating the normalized magnetic flux densitiesm¯cx and m¯cy in horizontal plane, the sine and cosine value for yaw are(7)cos⁡φ=m-cx,sinφ=-m-cy.Finally quaternion of yaw can be represented as(8)qφ=cos⁡φ21000+sinφ20001.(3) Quaternion Data Fusion. To improve the accuracy, formulas (1), (3), and (8) are fused together as a unit quaternion qm, which can be expressed as(9)qm=qφqθqγ.The flow of fusion is illustrated in Figure1.Figure 1
Flow of the factored quaternion algorithm.So far, the factored quaternion algorithm utilizes gravity and geomagnetic field intensity as a reference. In contrast with the traditional static orientation estimation, factored quaternion algorithm eliminates the inexact matching by decomposing and fusing. For the most part, this inexact matching leads to estimation error in vertical direction, which will affect the horizontal direction (yaw) as well. While factored quaternion algorithm not only eliminates the inexact matching but also improves computational efficiency and avoids trigonometry operations by using half-angle formulas, the only imperfection is singularity in calculation. Thus axis-exchanged compensation algorithm is proposed.


## 2.1.2. Axis-Exchanged Compensation Algorithm

According to (4), when the pitch angle θ turns to 90°/−90°, singularities will appear in roll calculation and finally lead to wrong attitude estimation. To overcome these singularities, [10] proposed a method of borrow angle compensation. The main idea is that the pitch angle rotates an additional α when cos⁡θ<ε (ε is a positive number which closes with 0); in this case, the equivalent pitch is θ-α. Based on the additional rotation, acceleration and magnetic flux density are transformed as well, and so is the factored quaternion algorithm. The above procedures are called borrow angle; on the contrary, the return angle is only one step that multiplies the calculated quaternion by additional rotation angle quaternion qα. Therefore the final quaternion returns to actual one, and singularities are avoided by the above steps at the same time. However, this method increases the amount of computation due to the complicated borrow angle and return angle.Through the above analysis and geometry application, axis-exchanged compensation algorithm is proposed. This algorithm estimates singularities without increasing the amount of computation and thereby saves hardware overhead and improves the overall algorithm in real-time performance.In the view of geometry, singularities are introduced in rotation orderz-y-x when pitch angle θ turns to 90°/−90° around the middle level y-axis. In this situation, x-axis coincides with z-axis, which means that it loses the freedom of third level shaft. In other words, this phenomenon is the so-called gimbal lock in classical orientation estimation. Based on the above analysis, it is not difficult to find out that singularities can be avoided by combining quaternion algorithm with solution of gimbal lock. In practice, when the gimbal lock occurs, it can be avoided by changing rotation as follows.Step 1.
Return to the original posture.Step 2.
Rotate the yaw angle 180° aroundz-axis.Step 3.
Rotate the roll angle 180° aroundx-axis.Step 4.
Rotate the pitch angle 90° aroundy-axis.In the same way, when the pitch angleθ closes with 90°/−90°, axis-exchanged compensation algorithm can be applied to avoid singularities. The steps are similar to the solution of gimbal lock when singularities appeared.Step 1.
Match the measured acceleration data and magnetic flux density to the reverse side.Step 2.
Regard the pitch angleθ as 0 degree and substitute it into formulas (3) and (8).Step 3.
Substitute the original pitch angleθ into formula (9) for obtaining the final unit quaternion.According to the above steps, axis-exchanged compensation algorithm is able to avoid singularities by data matching without increasing the amount of computation. Figure2 illustrates an example of data matching in axis-exchanged compensation algorithm. In Figure 2, gimbal lock occurs when the body changes position 1 to position 2 along with the pitch direction (y-axis). In this case, we match the data from position 2 to position 3 according to axis-exchanged compensation steps. Thus the x-axis data in position 3 and the z-axis data in position 2 are a pair of opposite numbers; meanwhile, the z-axis data in position 3 equals the x-axis data in position 2. So far, singularities are avoided by axis-exchanged compensation factored quaternion algorithm.Figure 2
Data matching by axis-exchanged compensation.In general, changing the rotation order means changing the shaft level relationship. As a matter of fact, the axis-exchanged compensation can never eliminate singularities indeed; it merely transfers them. In other words, when singularities occurred, the essence of axis-exchanged compensation algorithm is to change the rotation order fromz-y-x to z-x-y. But the calculation order has never been changed, which means that the shaft level relationship has never been changed neither, so there is nothing to worry about introducing other singularities.


## 2.2. R-Adaptive Kalman Filter

The above axis-exchanged compensation factored quaternion algorithm is based on static state; in order to obtain a real-time direction estimation, R-adaptive Kalman filter is presented in this paper. According to the quaternion differential equation and static unit quaternion provided in Section2.1, R-adaptive Kalman filter is designed for acquiring real-time orientation quaternion.


### 2.2.1. Kalman Filter Based on Quaternion

A Kalman filter for quaternion is proposed in [14]; thus we briefly introduce the Kalman filter and put the emphasis on R-adaptive adjustment. In quaternion algorithm, the relationship of angular velocity ω is provided by gyro and quaternion q could be written as(10)q˙=12Rωb·q,where(11)Rωb=0-ωbωbω*,ω*=0ωbz-ωby-ωbz0ωbxωby-ωbx0.According to (10), a quaternion-based Kalman filter is constructed and shown in Figure 3.Figure 3
Flow of the quaternion-based Kalman filter.As shown in Figure3, the flow of quaternion-based Kalman filter can be described as follows.Step 1.
Calculate the state variableq^0 and error covariance P0 by factored quaternion algorithm as the initial value.Step 2.
Thea priori state estimate q^k- and thea priori estimate error covariance Pk- are computed by time update equations.Step 3.
Noise covariance matricesQ and R are used to calculate the Kalman gain Kk based on the Kalman gain equation.Step 4.
Substitute the measurement variablezk which is a static quaternion that derived from factored quaternion algorithm into the measurement update equation; meanwhile, adjust the weights between thea prior state estimate q^k- and innovation zk-q^k- for obtaining a relatively accurate real-time orientation quaternion.


### 2.2.2. R-Adaptive Adjustment

Axis-exchanged compensation factored quaternion algorithm is used in the condition of static state or quasi-static state, while nonlinear acceleration will be introduced in the measurement when MEMS-IMU moves at high speed, thereby leading to large bias. So the measurement variablezk in Kalman filter not only loses its ability of calibration but also causes mistakes. To avoid this situation, R-adaptive adjustment mechanism is applied to Kalman filter. As a result, R-adaptive Kalman filter eliminates the influence caused by nonlinear acceleration via controlling the Kalman gain. In detail, for adjusting the noise covariance matrix R in real time, the mechanism sets the dynamic and static thresholds through the relationship between thresholds and 3-axis acceleration.If we define the 3-axis acceleration asδa=|ax2+ay2+az2-g| and set the static threshold as asta=σax2+σay2+σaz2, where σa denotes the noise standard deviation in static state and adyn denotes the dynamic threshold, the rules are designed as follows.Rule 1.
Whenδa≤asta, it means that the measured object is in static state and the measured data is reliable and accurate. So R need not be adjusted or need to be adjusted slightly. Thus(12)Rk=s·R,s∈10-1,1.Rule 2.
Whenasta≤δa≤adyn and |δak-δak-1|≤asta, it means that the measured object has the tendency to move; thus Rk=R. If the |δak-δak-1|>asta, it means that the measured object has the tendency to make nonlinear acceleration, while the measured data is still worth reference. Thus(13)Rk=δak-δak-1asta·R.Rule 3.
Whenδa>adyn, it means that the measured object is in high speed; at this time, the measured data loses value completely. Thus(14)Rk=I.The noise covariance matrixR is adjusted by the above rules in real time, and the adjusted Rk is substituted into Kalman gain formula to obtain Kk. In this manner, the weights of dynamic and static quaternion are modified by Kalman gain Kk in real time, thereby achieving a relatively accurate heading estimation. As heading (yaw) is the only required orientation for navigation in PDR, consequently, we just need to take yaw data out of the unit quaternion.


## 2.2.1. Kalman Filter Based on Quaternion

A Kalman filter for quaternion is proposed in [14]; thus we briefly introduce the Kalman filter and put the emphasis on R-adaptive adjustment. In quaternion algorithm, the relationship of angular velocity ω is provided by gyro and quaternion q could be written as(10)q˙=12Rωb·q,where(11)Rωb=0-ωbωbω*,ω*=0ωbz-ωby-ωbz0ωbxωby-ωbx0.According to (10), a quaternion-based Kalman filter is constructed and shown in Figure 3.Figure 3
Flow of the quaternion-based Kalman filter.As shown in Figure3, the flow of quaternion-based Kalman filter can be described as follows.Step 1.
Calculate the state variableq^0 and error covariance P0 by factored quaternion algorithm as the initial value.Step 2.
Thea priori state estimate q^k- and thea priori estimate error covariance Pk- are computed by time update equations.Step 3.
Noise covariance matricesQ and R are used to calculate the Kalman gain Kk based on the Kalman gain equation.Step 4.
Substitute the measurement variablezk which is a static quaternion that derived from factored quaternion algorithm into the measurement update equation; meanwhile, adjust the weights between thea prior state estimate q^k- and innovation zk-q^k- for obtaining a relatively accurate real-time orientation quaternion.


## 2.2.2. R-Adaptive Adjustment

Axis-exchanged compensation factored quaternion algorithm is used in the condition of static state or quasi-static state, while nonlinear acceleration will be introduced in the measurement when MEMS-IMU moves at high speed, thereby leading to large bias. So the measurement variablezk in Kalman filter not only loses its ability of calibration but also causes mistakes. To avoid this situation, R-adaptive adjustment mechanism is applied to Kalman filter. As a result, R-adaptive Kalman filter eliminates the influence caused by nonlinear acceleration via controlling the Kalman gain. In detail, for adjusting the noise covariance matrix R in real time, the mechanism sets the dynamic and static thresholds through the relationship between thresholds and 3-axis acceleration.If we define the 3-axis acceleration asδa=|ax2+ay2+az2-g| and set the static threshold as asta=σax2+σay2+σaz2, where σa denotes the noise standard deviation in static state and adyn denotes the dynamic threshold, the rules are designed as follows.Rule 1.
Whenδa≤asta, it means that the measured object is in static state and the measured data is reliable and accurate. So R need not be adjusted or need to be adjusted slightly. Thus(12)Rk=s·R,s∈10-1,1.Rule 2.
Whenasta≤δa≤adyn and |δak-δak-1|≤asta, it means that the measured object has the tendency to move; thus Rk=R. If the |δak-δak-1|>asta, it means that the measured object has the tendency to make nonlinear acceleration, while the measured data is still worth reference. Thus(13)Rk=δak-δak-1asta·R.Rule 3.
Whenδa>adyn, it means that the measured object is in high speed; at this time, the measured data loses value completely. Thus(14)Rk=I.The noise covariance matrixR is adjusted by the above rules in real time, and the adjusted Rk is substituted into Kalman gain formula to obtain Kk. In this manner, the weights of dynamic and static quaternion are modified by Kalman gain Kk in real time, thereby achieving a relatively accurate heading estimation. As heading (yaw) is the only required orientation for navigation in PDR, consequently, we just need to take yaw data out of the unit quaternion.


## 3. Walking Distance Estimation

Walking distance estimation is another important link in PDR navigation, where cadence and step length are two gait parameters on which we focused the most.


### 3.1. Classification and Interval Symmetry Detection of Cadence

In cadence detection, method of peak detection is usually used with fixed time window and fixed threshold. However, the detection accuracy decreases with the varying cadence of pedestrian. So in order to improve the detection accuracy, in this subsection, peak detection is developed according to the various intervals. In this manner, the sensor data is collected and the characteristics of 3-axis total acceleration are analyzed for designing method of cadence classification and interval symmetry.The collected 3-axis total acceleration is depicted in Figure4 when pedestrian walks with a single cadence. In this figure, as mixing with noise, waveforms of raw data are described with periodicity and complexity. Taking into account the indoor environment, walking cadence of normal pedestrian is usually falling in the frequency of 1~3 Hz; therefore a FIR low-pass filter of 3 Hz cut-off [15] is applied to raw data. And the output result is shown in Figure 5. As can be seen from Figure 5, noise has been nearly filtered and the regularity of acceleration is obvious.Figure 4
Raw acceleration of single cadence.Figure 5
Filtered acceleration of single cadence.Based on Figure5, we can get that the tendency of total acceleration in a stride rose first and dropped later. Moreover, the rising interval and dropping interval are well symmetrical and appear alternatively with the maximum and minimum values.Back to the question of walking with random cadence, for example, the walking cadence changes from slow to fast. As a result, the filtered 3-axis total acceleration is illustrated in Figure6.Figure 6
Filtered acceleration of changing cadence.Figure6 shows the waveforms changing from being sparse to dense with the increasing acceleration amplitude. Thus the result is that not only the cadence but also acceleration amplitude is changed with varying walking. From the above analysis, we can get that different detection threshold needs to be used in different walking cadence. In contrast with Figures 5 and 6, characteristics of walking cadence and acceleration amplitude can be described as follows.Characteristic 1. Divide the normal pedestrian walking cadence range 1~3 Hz into three conditions: slow (1~1.6 Hz), normal (1.6~2 Hz), and fast (2~3 Hz). As a matter of fact, rising interval time is half of the whole stride. Thus the rising interval time corresponds to three conditions: slow (0.3~0.5 s), normal (0.25~0.3 s), and fast (0.16~0.25 s). Likewise, when the sampling frequency is 50 Hz, sampling points of rising interval correspond to three conditions: slow (15~20), normal (12~15), and fast (8~12).Characteristic 2. The maximum and minimum values of acceleration appeared alternatively. In addition, the amplitude changes with cadence too. Meanwhile, the static state acceleration amplitude changes from −0.04 to 0.04. Hence, we divided the threshold range into three conditions as well: slow [0.04, 0.12], normal (0.12, 0.25], and fast (0.25, 0.5]. In this condition, acceleration changes under different experiments should meet different maximum and minimum values.Based on the above two characteristics, a method of cadence classification and interval symmetry is designed for detecting cadence; the exact flow is shown in Figure7. As the acquired acceleration, motion conditions (slow, normal, and fast) are firstly determined by the rising interval. Then the preset thresholds are selected based on the motion conditions; in the meantime, maximum value of rising interval is judged whether it falls in the threshold condition. Due to the symmetry of gait, minimum value of drop interval needs to be judged as well. When the above conditions are satisfied, cadence can be calculated with sampling frequency and sampling points.Figure 7
Method of cadence classification and interval symmetry.


### 3.2. Frequency Adjustment Step Length Estimation Model

Another important gait parameter is step length. As we all know, the pedestrian step length is variable; it changes with walking speed, cadence, individual difference, and so forth. However, traditional nonlinear step length estimation models generally lack adaptability. And neural networks models have good adaptability while usually requiring lots of training to ensure the accuracy [16, 17]. On this basis, this paper designed a step length model adjusted by cadence. The model not only increases the adaptability and improves the accuracy but also reduces the computational complexity for most parts.Human biology shows the relationship between pedestrian cadence and walking speed. In [18], great deals of experiments are tested for recording the relationship of cadence and speed under different walking environment. The relationship is:(15)v=af2+cf+b,where v is walking speed (m/s), f is cadence (Hz), and a, b, and c are constants.On the basis of (15) and the relationship between step length, cadence, and walking speed, the adjusted step length model is derived out. Assuming l is the step length, f is cadence, v is walking speed, and the relationship is(16)v=l×f.Combining (15) and (16), we can get(17)l=vf=af+bf+c.So far, (17) is the step length model which is adjusted by cadence, where a, b, and c are the model parameters and cadence f is detected by method of cadence classification and interval symmetry. Since the normal pedestrian walking cadence is in range of 1~3 Hz, the cadence f refers to 1~3 Hz in this paper either.The model parametersa, b, and c are obtained by brief calibration. The calibration experiment is in a 40-meter long corridor in this paper, and experimental subjects walk with slow (1~1.6 Hz), normal (1.6~2 Hz), and fast (2~3 Hz) three speeds, respectively. In order to calibrate the parameters, five groups of data are collected to fit the least squares curve. Due to the individual differences, parameters a, b, and c will change a lot with different people even having the same height. Therefore, for guaranteeing the performance of step length estimation, the model parameters a, b, and c are personalized for each user through the brief calibration before navigation.


## 3.1. Classification and Interval Symmetry Detection of Cadence

In cadence detection, method of peak detection is usually used with fixed time window and fixed threshold. However, the detection accuracy decreases with the varying cadence of pedestrian. So in order to improve the detection accuracy, in this subsection, peak detection is developed according to the various intervals. In this manner, the sensor data is collected and the characteristics of 3-axis total acceleration are analyzed for designing method of cadence classification and interval symmetry.The collected 3-axis total acceleration is depicted in Figure4 when pedestrian walks with a single cadence. In this figure, as mixing with noise, waveforms of raw data are described with periodicity and complexity. Taking into account the indoor environment, walking cadence of normal pedestrian is usually falling in the frequency of 1~3 Hz; therefore a FIR low-pass filter of 3 Hz cut-off [15] is applied to raw data. And the output result is shown in Figure 5. As can be seen from Figure 5, noise has been nearly filtered and the regularity of acceleration is obvious.Figure 4
Raw acceleration of single cadence.Figure 5
Filtered acceleration of single cadence.Based on Figure5, we can get that the tendency of total acceleration in a stride rose first and dropped later. Moreover, the rising interval and dropping interval are well symmetrical and appear alternatively with the maximum and minimum values.Back to the question of walking with random cadence, for example, the walking cadence changes from slow to fast. As a result, the filtered 3-axis total acceleration is illustrated in Figure6.Figure 6
Filtered acceleration of changing cadence.Figure6 shows the waveforms changing from being sparse to dense with the increasing acceleration amplitude. Thus the result is that not only the cadence but also acceleration amplitude is changed with varying walking. From the above analysis, we can get that different detection threshold needs to be used in different walking cadence. In contrast with Figures 5 and 6, characteristics of walking cadence and acceleration amplitude can be described as follows.Characteristic 1. Divide the normal pedestrian walking cadence range 1~3 Hz into three conditions: slow (1~1.6 Hz), normal (1.6~2 Hz), and fast (2~3 Hz). As a matter of fact, rising interval time is half of the whole stride. Thus the rising interval time corresponds to three conditions: slow (0.3~0.5 s), normal (0.25~0.3 s), and fast (0.16~0.25 s). Likewise, when the sampling frequency is 50 Hz, sampling points of rising interval correspond to three conditions: slow (15~20), normal (12~15), and fast (8~12).Characteristic 2. The maximum and minimum values of acceleration appeared alternatively. In addition, the amplitude changes with cadence too. Meanwhile, the static state acceleration amplitude changes from −0.04 to 0.04. Hence, we divided the threshold range into three conditions as well: slow [0.04, 0.12], normal (0.12, 0.25], and fast (0.25, 0.5]. In this condition, acceleration changes under different experiments should meet different maximum and minimum values.Based on the above two characteristics, a method of cadence classification and interval symmetry is designed for detecting cadence; the exact flow is shown in Figure7. As the acquired acceleration, motion conditions (slow, normal, and fast) are firstly determined by the rising interval. Then the preset thresholds are selected based on the motion conditions; in the meantime, maximum value of rising interval is judged whether it falls in the threshold condition. Due to the symmetry of gait, minimum value of drop interval needs to be judged as well. When the above conditions are satisfied, cadence can be calculated with sampling frequency and sampling points.Figure 7
Method of cadence classification and interval symmetry.


## 3.2. Frequency Adjustment Step Length Estimation Model

Another important gait parameter is step length. As we all know, the pedestrian step length is variable; it changes with walking speed, cadence, individual difference, and so forth. However, traditional nonlinear step length estimation models generally lack adaptability. And neural networks models have good adaptability while usually requiring lots of training to ensure the accuracy [16, 17]. On this basis, this paper designed a step length model adjusted by cadence. The model not only increases the adaptability and improves the accuracy but also reduces the computational complexity for most parts.Human biology shows the relationship between pedestrian cadence and walking speed. In [18], great deals of experiments are tested for recording the relationship of cadence and speed under different walking environment. The relationship is:(15)v=af2+cf+b,where v is walking speed (m/s), f is cadence (Hz), and a, b, and c are constants.On the basis of (15) and the relationship between step length, cadence, and walking speed, the adjusted step length model is derived out. Assuming l is the step length, f is cadence, v is walking speed, and the relationship is(16)v=l×f.Combining (15) and (16), we can get(17)l=vf=af+bf+c.So far, (17) is the step length model which is adjusted by cadence, where a, b, and c are the model parameters and cadence f is detected by method of cadence classification and interval symmetry. Since the normal pedestrian walking cadence is in range of 1~3 Hz, the cadence f refers to 1~3 Hz in this paper either.The model parametersa, b, and c are obtained by brief calibration. The calibration experiment is in a 40-meter long corridor in this paper, and experimental subjects walk with slow (1~1.6 Hz), normal (1.6~2 Hz), and fast (2~3 Hz) three speeds, respectively. In order to calibrate the parameters, five groups of data are collected to fit the least squares curve. Due to the individual differences, parameters a, b, and c will change a lot with different people even having the same height. Therefore, for guaranteeing the performance of step length estimation, the model parameters a, b, and c are personalized for each user through the brief calibration before navigation.


## 4. Axis-Exchanged Compensation and Gait Parameters Analysis Algorithm Applied to PDR with MEMS-IMU

Sections2 and 3 present the axis-exchanged compensation and gait parameters analysis algorithm separately, while the algorithms are applied to PDR for indoor navigation.The basic schematic of pedestrian dead reckoning is shown in Figure8, where the horizontal axis represents east and the vertical axis represents north. Assuming the initial position is p(t0), pedestrian walks from position p(t0) to position p(tk) during time t0~tk. The position p(tk) is obtained by (18), where (E(tk-1),N(tk-1)) and ψ are the position and heading direction in time tk-1 and S(tk-1) is the step length during time tk-1~tk:(18)Etk=Etk-1+Stk-1×sinψ,Ntk=Ntk-1+Stk-1×cos⁡ψ.Figure 8
Schematic of pedestrian dead reckoning.From the schematic of PDR, we can see that the factors that influence navigation most are as follows: initial position, heading, and walking distance. In practice, the initial position can be preset or obtained by GPS. The heading direction (yaw) can be taken out from unit quaternion equation (9) and be updated by R-adaptive Kalman filter for real-time estimation. The walking distance is obtained by the following procedures. Firstly, the measured 3-axis total acceleration of MEMS-IMU is used to detect the cadence with method of cadence classification and interval symmetry. Then, the step length is obtained by (17) and the walking distance can be computed by accumulating.Therefore, indoor PDR navigation is achieved by estimated initial position, heading, and walking distance with (18). And the aforementioned flows are axis-exchanged compensation and gait parameters analysis algorithm of PDR.


## 5. Experiments and Analysis

### 5.1. A Verification System Construction

The verification hardware system consists of PC and 9-axis MEMS-IMU; the whole experimental hardware is shown in Figure9. And 9-axis MEMS-IMU is made up of 3-axis accelerometers, 3-axis gyroscopes, and 3-axis magnetometers; the performance of each sensor is shown in Table 1. In PDR navigation, MEMS-IMU is attached on the rear waist of pedestrian, which is shown in Figure 10. The serial communication baud rate of MEMS-IMU is 115200 bit/s, and the sampling frequency is 50 Hz.Table 1
Specifications of MEMS-IMU.
Sensor
Range
Sensitivity
Output noise
3-axis accelerometer MMA8453Q
±8 g
3.9 mg/LSB
126μg/Hz
3-axis gyroscope ITG3200
±2000 dps
14.375 LSB/(dps)
0.38 dps
3-axis magnetometer MAG3110
±1000μT
0.1μT/bit
0.4μT rmsFigure 9
Hardware system.Figure 10
Coordinate of body.In walking experiment, a 12 m long and 8 m wide indoor room is selected, and the total walking route is 40 meters long, which is depicted in Figure11. In Figure 11, the horizontal axis represents south and the vertical axis represents east. During the experiment, pedestrian starts from position A, walking along with the direction of arrow, and finally back to position A. In this process, the data collecting device MEMS-IMU is attached on the rear waist of pedestrian, as in Figure 10; axes X, Y, and Z point to the right of forward direction, the vertical direction, and forward direction, respectively.Figure 11
Walking routes.In addition, for better analysis of singularities in heading estimation, 9-axis MEMS-IMU is fixed on the cloud platform, which is shown in Figure12. In this situation, the rotation of yaw (heading) and roll can be achieved from –π to π, and the pitch can rotate from 0 to π/2. In experiments, this cloud platform basically meets the requirements.Figure 12
Rotation cloud platform.


### 5.2. Experimental Result and Analysis

#### 5.2.1. Singularities Compensation

Equation (3) in Section 2.1.1 shows that singularities occur in factored quaternion algorithm when the pitch angle reaches 90°/−90°. Figure 13 describes a process that MEMS-IMU rotates along with the pitch angle from 0° to 90°, making a brief stop in 90° and then returning to the start. The vertical axis and horizontal axis represent the degree and sampling points, respectively, and pitch angle makes a brief stop in 90° during 150 to 300 sampling points. When the pitch angle reaches 90°, yaw and roll show a large fluctuation that completely deviated from the actual degree. This phenomenon indicates that singularity cannot be estimated by factor quaternion algorithm. Thus, axis-exchanged compensation factored quaternion is proposed for avoiding singularity. As shown in Figure 14, the fluctuation in Figure 13 is basically eliminated. Based on the above result, R-adaptive Kalman filter is used to further obtain a real-time heading direction, as shown in Figure 15. From the experiment, when pitch angle reaches 90°, flag flipped from 0 to 1 that means the opening of axis-exchanged compensation. Conversely, the flag flipped from 1 to 0 when the pitch leaves 90°. The above tests show that real-time heading direction can be estimated accurately by axis-exchanged compensation factored quaternion algorithm and R-adaptive Kalman filter without increasing the amount of computation. In addition, the calculated attitude is equivalent to the reverse side of actual attitude when axis-exchanged compensation algorithm is enabled. Thus, for obtaining the actual attitude, yaw and roll angle should be minus 180° and plus 180°, respectively.Figure 13
Rotation without compensation.Figure 14
Rotation with compensation.Figure 15
Rotation with compensation after R-adaptive Kalman filter.As the singularity is eliminated, axis-exchanged compensation factored quaternion algorithm is taken out for further comparison with standard attitude estimation algorithm like borrow angle compensation factored quaternion algorithm [10]. The above experiments illustrate that singularity happens in 150 to 300 sampling points. Also, based on the above experiment data, the computing time of two singularity compensation algorithms is contrasted in Figure 16. In this figure, the vertical axis and horizontal axis represent time and sampling points, respectively; similarly, the dotted line and solid line represent borrow angle compensation factored quaternion algorithm and axis-exchanged compensation factored quaternion algorithm. As the axis-exchanged compensation factored quaternion algorithm is enabled in 150 to 300 sampling points, we can see that the computing time of proposed axis-exchanged compensation factored quaternion algorithm is far below the borrow angle compensation factored quaternion algorithm in this range, only about 50% of the borrow angle compensation. In addition, the computing time of axis-exchanged compensation factored quaternion algorithm is more stable, while borrow angle compensation algorithm has a surge point at the beginning, which will consume large amount of hardware overhead in practice. The reason of low computing time is that axis-exchanged compensation eliminates singularity only by changing the rotation order instead of borrowing and returning angle, which will increase additional calculations. Therefore axis-exchanged compensation factored quaternion algorithm has higher operation efficiency at the point of singularity eliminating.Figure 16
Computing time comparison.So far, the attitude experiments are still rotated on cloud platform. For obtaining the heading direction in PDR navigation, we further verified the attitude estimation ability of axis-exchanged compensation factored quaternion algorithm in walking status. The MEMS-IMU is attached on the back. As axis-exchanged compensation factored quaternion algorithm is applied to MEMS-IMU, the yaw and pitch angle are shown in Figure17 when walking straight. The vertical axis and horizontal axis represent degree and sampling points, respectively; likewise, the dotted line and solid line represent pitch and yaw. We can see that the yaw keeps stability even when the pitch angle sometimes equals 90° during walking. Thus the yaw can be regarded as heading direction in PDR application. And since the stable heading direction is obtained, in the following step, we would like to estimate the walking distance.Figure 17
Walking without axis-exchanged compensation factored quaternion algorithm.


#### 5.2.2. Walking Distance Estimation

As for walking distance estimation, the first step is to detect the cadence. In order to observe the effects of cadence classification and interval symmetry, a pedestrian is randomly selected to walk from slow to fast. As a result, the collected 3-axis total acceleration by MEMS-IMU is depicted in Figure18. During the walking, acceleration waveform changes from sparse to dense; at the same time, amplitude grows from low to high. Based on the above analysis, we can see that the waveform in Figure 18 meets the actual walking process, and particularly the cadence detection is without missed detection point or false alarm.Figure 18
Cadence detection.Then the step length needs to be estimated according to the above cadence. Before estimation, parametersa, b, and c of step length model should be calibrated by training. Therefore, 10 pedestrians are selected for training, and each pedestrian walked through a 40-meter long corridor for 5 times. In training, parameters a, b, and c for each pedestrian are personalized by least squares curve fitting. Then, based on the cadence detected above and the calibrated parameters, step length is estimated with step length model equation (17). Table 2 reveals the performance of gait parameters analysis method, the average cadence detection accuracy of 40-meter walking is 99.4%, and the walking distance estimation error is 0.42%, which means an excellent performance in walking distance estimation.Table 2
Result of walking distance.
Number
Sex
Cadence detection/%
Walking distance/m
Estimation error/%
1
Female
100
40
0.34
2
Female
99
40
0.58
3
Female
99
40
0.48
4
Female
100
40
0.37
5
Female
100
40
0.34
6
Male
99
40
0.46
7
Male
100
40
0.29
8
Male
99
40
0.39
9
Male
98
40
0.62
10
Male
100
40
0.35
Mean value
—
99.4
40
0.42Since the estimation is based on acceleration, so, in considerable acceleration senor measurement accuracy, we contrast the proposed method of gait parameters analysis and nonlinear peak detection described in Table3. Table 3 shows that the average walking distance error reduces 34.6% by method of gait parameters analysis; the result reveals an obvious advantage in walking distance estimation. Two points contribute to the estimation.Table 3
Comparison of walking distance estimation error.
Nonlinear peak detection
Method of gait parameters analysis
Actual walking distance/m
36.6
40
Average walking distance error/m
0.26
0.17
Average walking distance error/%
0.71
0.42
Average walking distance error reduction/%
—
34.6Point 1. The method of gait parameters analysis uses cadence classification and interval symmetry for cadence detection. It improves the cadence detection accuracy and robustness.Point 2. The method of gait parameters analysis uses a step length model adjusted by cadence for step length estimation. The parameters in step length model are calibrated by easy training, which improves the accuracy. In addition, cadence is used in estimating the step length that improves the adaptability compared to the nonlinear peak detection.


#### 5.2.3. Indoor PDR Navigation

The method of gait parameters analysis applied to walking distance estimation performs well, while in this subsection the whole method of axis-exchanged compensation and gait parameters analysis algorithm of PDR is applied to indoor PDR navigation with the acquired heading direction and walking distance. In experiment, pedestrian 1 is selected for walking in a 12 m long and 8 m wide room, which is depicted in Figure11. Similar to the walking route in Section 5.1, pedestrian 1 starts from position A, walking along with the direction of arrow, and finally back to position A. The walking result is shown in Figure 19. The line with asterisks represents the axis-exchanged compensation and gait parameters analysis algorithm of PDR indoor navigation when using MEMS-IMU. In this figure, we can see that the PDR navigation route basically meets the preset route. Furthermore, in order to obtain a more general navigation, pedestrian 1 is requested for walking with the preset route by 10 times. Calculating the maximum error between the PDR route and the preset route in 10 experiments separately, the errors are shown in Figure 20. According to the measured results in Figure 20, the maximum error is 1.1230 m, which also performs well in indoor PDR navigation.Figure 19
PDR walking route.Figure 20
Navigation error.Similarly, to contrast the proposed algorithm and nonlinear peak navigation in [19], Table 4 shows that the navigation error reduces 32.6% by axis-exchanged compensation and gait parameters analysis algorithm; the result reveals an obvious advantage in PDR navigation. Three points contribute to the navigation.Table 4
Comparison of navigation error.
Nonlinear peak navigation
Axis-exchanged compensation and gait parameters analysis PDR
Actual walking distance/m
36.6
40
Navigation error RMS/m
1.44
0.97
Navigation error RMS/%
3.93
2.42
Navigation error reduction/%
—
32.6Point 1. In heading estimation, the heading singularities are eliminated by axis-exchanged compensation factored quaternion algorithm. In the meantime, real-time heading direction is obtained by R-adaptive Kalman filter. They improve the accuracy and obtain a real-time heading without increasing the amount of computation.Point 2. In cadence detection, algorithm of axis-exchanged compensation and gait parameters analysis improves the detection accuracy and robustness.Point 3. In step length estimation, algorithm of axis-exchanged compensation and gait parameters analysis improves the estimation adaptability and accuracy.In addition, in order to verify the application scope of axis-exchanged compensation and gait parameters analysis algorithm, different walking distances and time are tested; the results are shown in Table5. According to Table 5, navigation error is accumulated with the increasing walking distance and time. When walking time approximately approaches 12 minutes or walking distance is about 500 meters, the navigation error RMS (root mean square) still remains less than 15 meters and the walking distance error is about 1%. However, when time or walking distance exceeded this range, single PDR navigation is needed to be considered before application. Therefore, axis-exchanged compensation and gait parameters analysis algorithm of PDR is more suitable for short-distance indoor navigation.Table 5
Error of different navigation.
Number
Walking times/s
Walking distance/m
Walking distance error/%
Navigation error RMS/m
Navigation error RMS/%
Maximum navigation error/m
Maximum navigation error/%
1
74.4
80
0.46
1.95
2.44
2.08
2.60
2
152.0
160
0.55
4.03
2.52
5.66
3.54
3
259.2
240
0.68
6.46
2.69
9.17
3.82
4
368.0
320
0.82
8.99
2.81
13.76
4.30
5
479.0
400
0.89
11.60
2.90
19.00
4.75
6
604.8
480
1.04
14.06
2.93
23.86
4.97
7
716.8
560
1.36
16.63
2.97
28.22
5.04
8
838.4
640
3.91
28.86
4.51
59.65
9.32
9
988.2
720
5.55
35.21
4.89
68.04
9.45
10
1124.0
800
7.88
45.76
5.72
79.60
9.95


## 5.1. A Verification System Construction

The verification hardware system consists of PC and 9-axis MEMS-IMU; the whole experimental hardware is shown in Figure9. And 9-axis MEMS-IMU is made up of 3-axis accelerometers, 3-axis gyroscopes, and 3-axis magnetometers; the performance of each sensor is shown in Table 1. In PDR navigation, MEMS-IMU is attached on the rear waist of pedestrian, which is shown in Figure 10. The serial communication baud rate of MEMS-IMU is 115200 bit/s, and the sampling frequency is 50 Hz.Table 1
Specifications of MEMS-IMU.
Sensor
Range
Sensitivity
Output noise
3-axis accelerometer MMA8453Q
±8 g
3.9 mg/LSB
126μg/Hz
3-axis gyroscope ITG3200
±2000 dps
14.375 LSB/(dps)
0.38 dps
3-axis magnetometer MAG3110
±1000μT
0.1μT/bit
0.4μT rmsFigure 9
Hardware system.Figure 10
Coordinate of body.In walking experiment, a 12 m long and 8 m wide indoor room is selected, and the total walking route is 40 meters long, which is depicted in Figure11. In Figure 11, the horizontal axis represents south and the vertical axis represents east. During the experiment, pedestrian starts from position A, walking along with the direction of arrow, and finally back to position A. In this process, the data collecting device MEMS-IMU is attached on the rear waist of pedestrian, as in Figure 10; axes X, Y, and Z point to the right of forward direction, the vertical direction, and forward direction, respectively.Figure 11
Walking routes.In addition, for better analysis of singularities in heading estimation, 9-axis MEMS-IMU is fixed on the cloud platform, which is shown in Figure12. In this situation, the rotation of yaw (heading) and roll can be achieved from –π to π, and the pitch can rotate from 0 to π/2. In experiments, this cloud platform basically meets the requirements.Figure 12
Rotation cloud platform.


## 5.2. Experimental Result and Analysis

### 5.2.1. Singularities Compensation

Equation (3) in Section 2.1.1 shows that singularities occur in factored quaternion algorithm when the pitch angle reaches 90°/−90°. Figure 13 describes a process that MEMS-IMU rotates along with the pitch angle from 0° to 90°, making a brief stop in 90° and then returning to the start. The vertical axis and horizontal axis represent the degree and sampling points, respectively, and pitch angle makes a brief stop in 90° during 150 to 300 sampling points. When the pitch angle reaches 90°, yaw and roll show a large fluctuation that completely deviated from the actual degree. This phenomenon indicates that singularity cannot be estimated by factor quaternion algorithm. Thus, axis-exchanged compensation factored quaternion is proposed for avoiding singularity. As shown in Figure 14, the fluctuation in Figure 13 is basically eliminated. Based on the above result, R-adaptive Kalman filter is used to further obtain a real-time heading direction, as shown in Figure 15. From the experiment, when pitch angle reaches 90°, flag flipped from 0 to 1 that means the opening of axis-exchanged compensation. Conversely, the flag flipped from 1 to 0 when the pitch leaves 90°. The above tests show that real-time heading direction can be estimated accurately by axis-exchanged compensation factored quaternion algorithm and R-adaptive Kalman filter without increasing the amount of computation. In addition, the calculated attitude is equivalent to the reverse side of actual attitude when axis-exchanged compensation algorithm is enabled. Thus, for obtaining the actual attitude, yaw and roll angle should be minus 180° and plus 180°, respectively.Figure 13
Rotation without compensation.Figure 14
Rotation with compensation.Figure 15
Rotation with compensation after R-adaptive Kalman filter.As the singularity is eliminated, axis-exchanged compensation factored quaternion algorithm is taken out for further comparison with standard attitude estimation algorithm like borrow angle compensation factored quaternion algorithm [10]. The above experiments illustrate that singularity happens in 150 to 300 sampling points. Also, based on the above experiment data, the computing time of two singularity compensation algorithms is contrasted in Figure 16. In this figure, the vertical axis and horizontal axis represent time and sampling points, respectively; similarly, the dotted line and solid line represent borrow angle compensation factored quaternion algorithm and axis-exchanged compensation factored quaternion algorithm. As the axis-exchanged compensation factored quaternion algorithm is enabled in 150 to 300 sampling points, we can see that the computing time of proposed axis-exchanged compensation factored quaternion algorithm is far below the borrow angle compensation factored quaternion algorithm in this range, only about 50% of the borrow angle compensation. In addition, the computing time of axis-exchanged compensation factored quaternion algorithm is more stable, while borrow angle compensation algorithm has a surge point at the beginning, which will consume large amount of hardware overhead in practice. The reason of low computing time is that axis-exchanged compensation eliminates singularity only by changing the rotation order instead of borrowing and returning angle, which will increase additional calculations. Therefore axis-exchanged compensation factored quaternion algorithm has higher operation efficiency at the point of singularity eliminating.Figure 16
Computing time comparison.So far, the attitude experiments are still rotated on cloud platform. For obtaining the heading direction in PDR navigation, we further verified the attitude estimation ability of axis-exchanged compensation factored quaternion algorithm in walking status. The MEMS-IMU is attached on the back. As axis-exchanged compensation factored quaternion algorithm is applied to MEMS-IMU, the yaw and pitch angle are shown in Figure17 when walking straight. The vertical axis and horizontal axis represent degree and sampling points, respectively; likewise, the dotted line and solid line represent pitch and yaw. We can see that the yaw keeps stability even when the pitch angle sometimes equals 90° during walking. Thus the yaw can be regarded as heading direction in PDR application. And since the stable heading direction is obtained, in the following step, we would like to estimate the walking distance.Figure 17
Walking without axis-exchanged compensation factored quaternion algorithm.


### 5.2.2. Walking Distance Estimation

As for walking distance estimation, the first step is to detect the cadence. In order to observe the effects of cadence classification and interval symmetry, a pedestrian is randomly selected to walk from slow to fast. As a result, the collected 3-axis total acceleration by MEMS-IMU is depicted in Figure18. During the walking, acceleration waveform changes from sparse to dense; at the same time, amplitude grows from low to high. Based on the above analysis, we can see that the waveform in Figure 18 meets the actual walking process, and particularly the cadence detection is without missed detection point or false alarm.Figure 18
Cadence detection.Then the step length needs to be estimated according to the above cadence. Before estimation, parametersa, b, and c of step length model should be calibrated by training. Therefore, 10 pedestrians are selected for training, and each pedestrian walked through a 40-meter long corridor for 5 times. In training, parameters a, b, and c for each pedestrian are personalized by least squares curve fitting. Then, based on the cadence detected above and the calibrated parameters, step length is estimated with step length model equation (17). Table 2 reveals the performance of gait parameters analysis method, the average cadence detection accuracy of 40-meter walking is 99.4%, and the walking distance estimation error is 0.42%, which means an excellent performance in walking distance estimation.Table 2
Result of walking distance.
Number
Sex
Cadence detection/%
Walking distance/m
Estimation error/%
1
Female
100
40
0.34
2
Female
99
40
0.58
3
Female
99
40
0.48
4
Female
100
40
0.37
5
Female
100
40
0.34
6
Male
99
40
0.46
7
Male
100
40
0.29
8
Male
99
40
0.39
9
Male
98
40
0.62
10
Male
100
40
0.35
Mean value
—
99.4
40
0.42Since the estimation is based on acceleration, so, in considerable acceleration senor measurement accuracy, we contrast the proposed method of gait parameters analysis and nonlinear peak detection described in Table3. Table 3 shows that the average walking distance error reduces 34.6% by method of gait parameters analysis; the result reveals an obvious advantage in walking distance estimation. Two points contribute to the estimation.Table 3
Comparison of walking distance estimation error.
Nonlinear peak detection
Method of gait parameters analysis
Actual walking distance/m
36.6
40
Average walking distance error/m
0.26
0.17
Average walking distance error/%
0.71
0.42
Average walking distance error reduction/%
—
34.6Point 1. The method of gait parameters analysis uses cadence classification and interval symmetry for cadence detection. It improves the cadence detection accuracy and robustness.Point 2. The method of gait parameters analysis uses a step length model adjusted by cadence for step length estimation. The parameters in step length model are calibrated by easy training, which improves the accuracy. In addition, cadence is used in estimating the step length that improves the adaptability compared to the nonlinear peak detection.


### 5.2.3. Indoor PDR Navigation

The method of gait parameters analysis applied to walking distance estimation performs well, while in this subsection the whole method of axis-exchanged compensation and gait parameters analysis algorithm of PDR is applied to indoor PDR navigation with the acquired heading direction and walking distance. In experiment, pedestrian 1 is selected for walking in a 12 m long and 8 m wide room, which is depicted in Figure11. Similar to the walking route in Section 5.1, pedestrian 1 starts from position A, walking along with the direction of arrow, and finally back to position A. The walking result is shown in Figure 19. The line with asterisks represents the axis-exchanged compensation and gait parameters analysis algorithm of PDR indoor navigation when using MEMS-IMU. In this figure, we can see that the PDR navigation route basically meets the preset route. Furthermore, in order to obtain a more general navigation, pedestrian 1 is requested for walking with the preset route by 10 times. Calculating the maximum error between the PDR route and the preset route in 10 experiments separately, the errors are shown in Figure 20. According to the measured results in Figure 20, the maximum error is 1.1230 m, which also performs well in indoor PDR navigation.Figure 19
PDR walking route.Figure 20
Navigation error.Similarly, to contrast the proposed algorithm and nonlinear peak navigation in [19], Table 4 shows that the navigation error reduces 32.6% by axis-exchanged compensation and gait parameters analysis algorithm; the result reveals an obvious advantage in PDR navigation. Three points contribute to the navigation.Table 4
Comparison of navigation error.
Nonlinear peak navigation
Axis-exchanged compensation and gait parameters analysis PDR
Actual walking distance/m
36.6
40
Navigation error RMS/m
1.44
0.97
Navigation error RMS/%
3.93
2.42
Navigation error reduction/%
—
32.6Point 1. In heading estimation, the heading singularities are eliminated by axis-exchanged compensation factored quaternion algorithm. In the meantime, real-time heading direction is obtained by R-adaptive Kalman filter. They improve the accuracy and obtain a real-time heading without increasing the amount of computation.Point 2. In cadence detection, algorithm of axis-exchanged compensation and gait parameters analysis improves the detection accuracy and robustness.Point 3. In step length estimation, algorithm of axis-exchanged compensation and gait parameters analysis improves the estimation adaptability and accuracy.In addition, in order to verify the application scope of axis-exchanged compensation and gait parameters analysis algorithm, different walking distances and time are tested; the results are shown in Table5. According to Table 5, navigation error is accumulated with the increasing walking distance and time. When walking time approximately approaches 12 minutes or walking distance is about 500 meters, the navigation error RMS (root mean square) still remains less than 15 meters and the walking distance error is about 1%. However, when time or walking distance exceeded this range, single PDR navigation is needed to be considered before application. Therefore, axis-exchanged compensation and gait parameters analysis algorithm of PDR is more suitable for short-distance indoor navigation.Table 5
Error of different navigation.
Number
Walking times/s
Walking distance/m
Walking distance error/%
Navigation error RMS/m
Navigation error RMS/%
Maximum navigation error/m
Maximum navigation error/%
1
74.4
80
0.46
1.95
2.44
2.08
2.60
2
152.0
160
0.55
4.03
2.52
5.66
3.54
3
259.2
240
0.68
6.46
2.69
9.17
3.82
4
368.0
320
0.82
8.99
2.81
13.76
4.30
5
479.0
400
0.89
11.60
2.90
19.00
4.75
6
604.8
480
1.04
14.06
2.93
23.86
4.97
7
716.8
560
1.36
16.63
2.97
28.22
5.04
8
838.4
640
3.91
28.86
4.51
59.65
9.32
9
988.2
720
5.55
35.21
4.89
68.04
9.45
10
1124.0
800
7.88
45.76
5.72
79.60
9.95


## 5.2.1. Singularities Compensation

Equation (3) in Section 2.1.1 shows that singularities occur in factored quaternion algorithm when the pitch angle reaches 90°/−90°. Figure 13 describes a process that MEMS-IMU rotates along with the pitch angle from 0° to 90°, making a brief stop in 90° and then returning to the start. The vertical axis and horizontal axis represent the degree and sampling points, respectively, and pitch angle makes a brief stop in 90° during 150 to 300 sampling points. When the pitch angle reaches 90°, yaw and roll show a large fluctuation that completely deviated from the actual degree. This phenomenon indicates that singularity cannot be estimated by factor quaternion algorithm. Thus, axis-exchanged compensation factored quaternion is proposed for avoiding singularity. As shown in Figure 14, the fluctuation in Figure 13 is basically eliminated. Based on the above result, R-adaptive Kalman filter is used to further obtain a real-time heading direction, as shown in Figure 15. From the experiment, when pitch angle reaches 90°, flag flipped from 0 to 1 that means the opening of axis-exchanged compensation. Conversely, the flag flipped from 1 to 0 when the pitch leaves 90°. The above tests show that real-time heading direction can be estimated accurately by axis-exchanged compensation factored quaternion algorithm and R-adaptive Kalman filter without increasing the amount of computation. In addition, the calculated attitude is equivalent to the reverse side of actual attitude when axis-exchanged compensation algorithm is enabled. Thus, for obtaining the actual attitude, yaw and roll angle should be minus 180° and plus 180°, respectively.Figure 13
Rotation without compensation.Figure 14
Rotation with compensation.Figure 15
Rotation with compensation after R-adaptive Kalman filter.As the singularity is eliminated, axis-exchanged compensation factored quaternion algorithm is taken out for further comparison with standard attitude estimation algorithm like borrow angle compensation factored quaternion algorithm [10]. The above experiments illustrate that singularity happens in 150 to 300 sampling points. Also, based on the above experiment data, the computing time of two singularity compensation algorithms is contrasted in Figure 16. In this figure, the vertical axis and horizontal axis represent time and sampling points, respectively; similarly, the dotted line and solid line represent borrow angle compensation factored quaternion algorithm and axis-exchanged compensation factored quaternion algorithm. As the axis-exchanged compensation factored quaternion algorithm is enabled in 150 to 300 sampling points, we can see that the computing time of proposed axis-exchanged compensation factored quaternion algorithm is far below the borrow angle compensation factored quaternion algorithm in this range, only about 50% of the borrow angle compensation. In addition, the computing time of axis-exchanged compensation factored quaternion algorithm is more stable, while borrow angle compensation algorithm has a surge point at the beginning, which will consume large amount of hardware overhead in practice. The reason of low computing time is that axis-exchanged compensation eliminates singularity only by changing the rotation order instead of borrowing and returning angle, which will increase additional calculations. Therefore axis-exchanged compensation factored quaternion algorithm has higher operation efficiency at the point of singularity eliminating.Figure 16
Computing time comparison.So far, the attitude experiments are still rotated on cloud platform. For obtaining the heading direction in PDR navigation, we further verified the attitude estimation ability of axis-exchanged compensation factored quaternion algorithm in walking status. The MEMS-IMU is attached on the back. As axis-exchanged compensation factored quaternion algorithm is applied to MEMS-IMU, the yaw and pitch angle are shown in Figure17 when walking straight. The vertical axis and horizontal axis represent degree and sampling points, respectively; likewise, the dotted line and solid line represent pitch and yaw. We can see that the yaw keeps stability even when the pitch angle sometimes equals 90° during walking. Thus the yaw can be regarded as heading direction in PDR application. And since the stable heading direction is obtained, in the following step, we would like to estimate the walking distance.Figure 17
Walking without axis-exchanged compensation factored quaternion algorithm.


## 5.2.2. Walking Distance Estimation

As for walking distance estimation, the first step is to detect the cadence. In order to observe the effects of cadence classification and interval symmetry, a pedestrian is randomly selected to walk from slow to fast. As a result, the collected 3-axis total acceleration by MEMS-IMU is depicted in Figure18. During the walking, acceleration waveform changes from sparse to dense; at the same time, amplitude grows from low to high. Based on the above analysis, we can see that the waveform in Figure 18 meets the actual walking process, and particularly the cadence detection is without missed detection point or false alarm.Figure 18
Cadence detection.Then the step length needs to be estimated according to the above cadence. Before estimation, parametersa, b, and c of step length model should be calibrated by training. Therefore, 10 pedestrians are selected for training, and each pedestrian walked through a 40-meter long corridor for 5 times. In training, parameters a, b, and c for each pedestrian are personalized by least squares curve fitting. Then, based on the cadence detected above and the calibrated parameters, step length is estimated with step length model equation (17). Table 2 reveals the performance of gait parameters analysis method, the average cadence detection accuracy of 40-meter walking is 99.4%, and the walking distance estimation error is 0.42%, which means an excellent performance in walking distance estimation.Table 2
Result of walking distance.
Number
Sex
Cadence detection/%
Walking distance/m
Estimation error/%
1
Female
100
40
0.34
2
Female
99
40
0.58
3
Female
99
40
0.48
4
Female
100
40
0.37
5
Female
100
40
0.34
6
Male
99
40
0.46
7
Male
100
40
0.29
8
Male
99
40
0.39
9
Male
98
40
0.62
10
Male
100
40
0.35
Mean value
—
99.4
40
0.42Since the estimation is based on acceleration, so, in considerable acceleration senor measurement accuracy, we contrast the proposed method of gait parameters analysis and nonlinear peak detection described in Table3. Table 3 shows that the average walking distance error reduces 34.6% by method of gait parameters analysis; the result reveals an obvious advantage in walking distance estimation. Two points contribute to the estimation.Table 3
Comparison of walking distance estimation error.
Nonlinear peak detection
Method of gait parameters analysis
Actual walking distance/m
36.6
40
Average walking distance error/m
0.26
0.17
Average walking distance error/%
0.71
0.42
Average walking distance error reduction/%
—
34.6Point 1. The method of gait parameters analysis uses cadence classification and interval symmetry for cadence detection. It improves the cadence detection accuracy and robustness.Point 2. The method of gait parameters analysis uses a step length model adjusted by cadence for step length estimation. The parameters in step length model are calibrated by easy training, which improves the accuracy. In addition, cadence is used in estimating the step length that improves the adaptability compared to the nonlinear peak detection.


## 5.2.3. Indoor PDR Navigation

The method of gait parameters analysis applied to walking distance estimation performs well, while in this subsection the whole method of axis-exchanged compensation and gait parameters analysis algorithm of PDR is applied to indoor PDR navigation with the acquired heading direction and walking distance. In experiment, pedestrian 1 is selected for walking in a 12 m long and 8 m wide room, which is depicted in Figure11. Similar to the walking route in Section 5.1, pedestrian 1 starts from position A, walking along with the direction of arrow, and finally back to position A. The walking result is shown in Figure 19. The line with asterisks represents the axis-exchanged compensation and gait parameters analysis algorithm of PDR indoor navigation when using MEMS-IMU. In this figure, we can see that the PDR navigation route basically meets the preset route. Furthermore, in order to obtain a more general navigation, pedestrian 1 is requested for walking with the preset route by 10 times. Calculating the maximum error between the PDR route and the preset route in 10 experiments separately, the errors are shown in Figure 20. According to the measured results in Figure 20, the maximum error is 1.1230 m, which also performs well in indoor PDR navigation.Figure 19
PDR walking route.Figure 20
Navigation error.Similarly, to contrast the proposed algorithm and nonlinear peak navigation in [19], Table 4 shows that the navigation error reduces 32.6% by axis-exchanged compensation and gait parameters analysis algorithm; the result reveals an obvious advantage in PDR navigation. Three points contribute to the navigation.Table 4
Comparison of navigation error.
Nonlinear peak navigation
Axis-exchanged compensation and gait parameters analysis PDR
Actual walking distance/m
36.6
40
Navigation error RMS/m
1.44
0.97
Navigation error RMS/%
3.93
2.42
Navigation error reduction/%
—
32.6Point 1. In heading estimation, the heading singularities are eliminated by axis-exchanged compensation factored quaternion algorithm. In the meantime, real-time heading direction is obtained by R-adaptive Kalman filter. They improve the accuracy and obtain a real-time heading without increasing the amount of computation.Point 2. In cadence detection, algorithm of axis-exchanged compensation and gait parameters analysis improves the detection accuracy and robustness.Point 3. In step length estimation, algorithm of axis-exchanged compensation and gait parameters analysis improves the estimation adaptability and accuracy.In addition, in order to verify the application scope of axis-exchanged compensation and gait parameters analysis algorithm, different walking distances and time are tested; the results are shown in Table5. According to Table 5, navigation error is accumulated with the increasing walking distance and time. When walking time approximately approaches 12 minutes or walking distance is about 500 meters, the navigation error RMS (root mean square) still remains less than 15 meters and the walking distance error is about 1%. However, when time or walking distance exceeded this range, single PDR navigation is needed to be considered before application. Therefore, axis-exchanged compensation and gait parameters analysis algorithm of PDR is more suitable for short-distance indoor navigation.Table 5
Error of different navigation.
Number
Walking times/s
Walking distance/m
Walking distance error/%
Navigation error RMS/m
Navigation error RMS/%
Maximum navigation error/m
Maximum navigation error/%
1
74.4
80
0.46
1.95
2.44
2.08
2.60
2
152.0
160
0.55
4.03
2.52
5.66
3.54
3
259.2
240
0.68
6.46
2.69
9.17
3.82
4
368.0
320
0.82
8.99
2.81
13.76
4.30
5
479.0
400
0.89
11.60
2.90
19.00
4.75
6
604.8
480
1.04
14.06
2.93
23.86
4.97
7
716.8
560
1.36
16.63
2.97
28.22
5.04
8
838.4
640
3.91
28.86
4.51
59.65
9.32
9
988.2
720
5.55
35.21
4.89
68.04
9.45
10
1124.0
800
7.88
45.76
5.72
79.60
9.95


## 6. Conclusion

Based on the problem of accuracy in indoor PDR navigation, this paper proposed axis-exchanged compensation and gait parameters analysis algorithm of PDR in aspects of heading and walking distance. In heading estimation, axis-exchanged compensation factored quaternion algorithm is used to overcome the singularities; in performance, the heading fluctuation is eliminated without increasing the amount of computation. Subsequently, real-time heading is achieved by R-adaptive Kalman filter. In walking distance estimation, gait parameters analysis algorithm is used to improve the estimation accuracy in two steps: cadence and step length. In cadence detection, method of cadence classification and interval symmetry is presented. This method classifies cadence according to the walking speed; in the meantime, different detection thresholds are selected by classification. It improves the detection accuracy and robustness. Besides, in step length estimation, a step length model adjusted by cadence is established, which improves the estimation adaptability. And for further improving the accuracy among different people, parametersa, b, and c are personalized by brief calibration. And different parameters related to different step length for different people. Thus the axis-exchanged compensation and gait parameters analysis algorithm of PDR can suit the variation of people. Based on all the mentioned above, axis-exchanged compensation and gait parameters analysis algorithm of PDR achieves high accuracy indoor navigation with MEMS-IMU, especially in short-distance navigation.



---

*Source: 915837-2015-07-27.xml*