# S-PDR: SBAUPT-Based Pedestrian Dead Reckoning Algorithm for Free-Moving Handheld Devices
## 3 SBAUPT-Based Pedestrian Dead Reckoning (S-PDR)
### Heading Estimation  
Many methods assume that the pedestrian is using the smartphone in compassing mode--phone screen facing up and \(y\)-axis of the phone pointing in the direction of motion--while using navigation applications, hence the pedestrian and BF main axis of motion--forward motion--are aligned and both frames have the same azimuth. Under these assumptions, the pedestrian heading is considered to be the azimuth angle of the BF alignment to the LLF. This assumption fails to track the pedestrian heading when the smartphone is reoriented in any way so that the \(y\)-axis is no longer aligned with the user's motion direction. In this case, the PDR would mistakenly believe that the user changed direction while he did not.  
To overcome this problem the pedestrian heading should be estimated separately from the smartphone orientation. Once the orientation of the BF is known with respect to LLF, the accelerations are transformed to LLF and can be used to estimate the heading of the pedestrian. The heading is derived from the components of the linear acceleration vectors of the user in LLF based on Equation (1). The horizontal component of the user's linear acceleration vector \(A_{h}\) is decomposed into the horizontal plane of LLF over the north and east axis as shown in Figure 6.  
\[\theta=\arctan 2(A_{E},A_{N}) \tag{1}\]  
where, \(\theta\) is the heading angle computed from the north direction, \(A_{E}\) and \(A_{N}\) are the linear acceleration components in east and north directions, respectively. The formulation previously presented can estimate the heading of a single acceleration sample. During a step, a sequence of accelerations is recorded corresponding to the direction of motion. One would think that all the accelerations during the step would be in the same direction but that is not the case. During a step, the user undergoes an accelerating stage followed by a decelerating stage, with a fluctuating transition that ends up generating accelerations in a variety of directions that might not be descriptive of the direction of motion. In addition to that, the accelerations have a varying vertical component due to the inverse pendulum motion of the user and the navigation device instability. This behavior can be seen in Figure 7.  
Figure 6: Acceleration\(-\)based heading in LLF.  
The resulting headings from the horizontal components of the linear acceleration in the LLF navigation frame suffer from high fluctuations at low accelerations and reverse by approximately 180 degrees during the deceleration stage of the step. This is further illustrated in Figure 8. It is clear at that point that no single instance of the accelerations would be sufficient to determine the heading of the step. Common methods to address this issue is to use the average of the step accelerations to derive the heading or using PCA to find the dominant direction of motion. When using the accelerations average, the heading angle suffers from high errors due to the low linear acceleration average value that might approach zero. On the other hand, when using PCA the resulting direction suffers from inaccuracy due to the outlier accelerations with low magnitude and suffers from 180 degrees ambiguity, meaning that we can not distinguish forward from backward motion. Hence, an alternative solution to estimating the heading is needed.