A Context-Aware Smartphone-Based 3D Indoor Positioning Using Pedestrian Dead Reckoning

The rise in location-based service (LBS) applications has increased the need for indoor positioning. Various methods are available for indoor positioning, among which pedestrian dead reckoning (PDR) requires no infrastructure. However, with this method, cumulative error increases over time. Moreover, the robustness of the PDR positioning depends on different pedestrian activities, walking speeds and pedestrian characteristics. This paper proposes the adaptive PDR method to overcome these problems by recognizing various phone-carrying modes, including texting, calling and swinging, as well as different pedestrian activities, including ascending and descending stairs and walking. Different walking speeds are also distinguished. By detecting changes in speed during walking, PDR positioning remains accurate and robust despite speed variations. Each motion state is also studied separately based on gender. Using the proposed classification approach consisting of SVM and DTree algorithms, different motion states and walking speeds are identified with an overall accuracy of 97.03% for women and 97.67% for men. The step detection and step length estimation model parameters are also adjusted based on each walking speed, gender and motion state. The relative error values of distance estimation of the proposed method for texting, calling and swinging are 0.87%, 0.66% and 0.92% for women and 1.14%, 0.92% and 0.76% for men, respectively. Accelerometer, gyroscope and magnetometer data are integrated with a GDA filter for heading estimation. Furthermore, pressure sensor measurements are used to detect surface transmission between different floors of a building. Finally, for three phone-carrying modes, including texting, calling and swinging, the mean absolute positioning errors of the proposed method on a trajectory of 159.2 m in a multi-story building are, respectively, 1.28 m, 0.98 m and 1.29 m for women and 1.26 m, 1.17 m and 1.25 m for men.


Introduction
Indoor positioning systems have been studied as a means of guiding pedestrians around buildings, particularly in emergencies [1]. A variety of indoor positioning systems are currently available, including WLAN-based [2], Bluetooth low energy (BLE) [3,4], ultra-wideband (UWB) [5,6], Ultrasonic Based [7] and infrared [8,9]. In these methods, position errors do not accumulate over time. However, they require the development of a positioning infrastructure before navigation; hence in an unknown environment, they would be impossible to be used and would require a significant cost [10]. PDR is, rather, an infrastructure-free, effective method that utilizes the estimated pedestrians' steps, step length and heading angle to determine the position [11]. Using PDR for positioning has several advantages; its main benefit is that it does not require additional infrastructure and uses body-mounted or smartphone-embedded inertial sensors such as a magnetometer, • PDR positioning is more adaptable when considering various phone-carrying modes, including texting, calling and swinging, as well as different pedestrian activities, including ascending and descending stairs and walking. This is because sensor data differ for different phone-carrying modes and pedestrian activities. The acceleration data also differ across walking speeds as walking can be classified as fast, medium and slow; thus, positioning accuracy is improved and adapted to changes in walking speed. This paper uses the DTree and SVM to identify various motion states and walking speeds. Using the proposed classification strategy, 15 combinations of five pedestrian activities and three phone-carrying modes are accurately distinguished.

•
In addition to detecting different motion states and walking speeds, considering height and gender as effective parameters in estimating step length promotes distance estimation accuracy. By analyzing each motion state separately for women and men, PDR positioning is further adapted to diverse heights and genders, so the overall accuracy of positioning improves. • After state detection, parameters of step counting and methods for step length estimation are separately adjusted for each pedestrian activity, phone-carrying mode, walking speed and gender to enhance the robustness and accuracy of PDR positioning.
consider only the texting smartphone carrying mode. Wang and Ye [42] proposed a smartphone mode recognition algorithm using a stacking regression model to effectively determine various smartphone carrying modes (calling, handheld, pocket, armband and swing), with an average recognition accuracy of 98.82%. The proposed method results in an error of 3.30% for step length estimation and 2.62% for walking distance estimation. Lu and Wu [43] designed a fuzzy controller based on the fuzzy logic algorithm to adaptively adjust the constant coefficient k in Weinberg's nonlinear step length estimation (SLE) model at each detected step, which is measured based on each user's different speed of walking. Ye and Li [38] designed and trained deep learning models via LSTM and CNN networks based on the tensor flow framework for pedestrian motion mode, smartphone posture and real-time comprehensive pedestrian activity recognition. Xia and Huang [39] introduced a combination of LSTM and CNN architecture for human activity recognition, with an accuracy of 95.78%, 95.85% and 92.63%, respectively, which was validated using three public datasets, i.e., UCI, WISDM and Opportunity. Several researchers also adopted map-matching algorithms to improve indoor positioning accuracy. Ren and Guo [44] employed a 2D map-matching algorithm using CRF based on inertial data which improved positioning accuracy. Geng and Xia [14] proposed a robust adaptive cubature Kalman filter algorithm for heading estimation. The heading and step length of each step was optimized by a Kalman filter to decrease positioning error. A calculation strategy for the heading angle of the 16-wind rose map based on the indoor map vector information was proposed, which improved pedestrian positioning accuracy and decreased the accumulation error. The robust adaptive Kalman filter algorithm was also used to fuse differential barometric altimetry and step frequency detection methods to estimate the optimum altitude. To improve the accuracy of positioning, Park and Lee [45] integrated the Integration approach (IA) and Parametric approach (PA) in PDR systems. When the direction of the person's movement differed from the direction of the phone, they used PCA to estimate the direction and PA to estimate the step length. Wu and Ma [1] exploited human activity recognition and PDR components' parameter adjustment according to each recognition activity. They defined two types of human activities: (a) steady-heading, i.e., ascending/descending stairs, stationary, normal walking, stationary stepping and lateral walking, and (b) nonsteady-heading activities, i.e., door opening and turning. They employed SVM and DTree machine learning algorithms to recognize steady-heading activities. They also used an auto encoder-based deep neural network and a heading range-based method to detect non-steady-heading activities. The overall classification accuracy of their method was 98.44% and its average positioning error in a multi-story building was 1.79 m. However, their system was developed and tested by only two people and they considered only texting as phone-carrying mode.
The reviewed studies attempted to adjust the methods of step detection, step length estimation and heading determination based on motion states to improve the accuracy of the PDR. Few investigations, however, have adjusted the PDR components based on movement habits, walking speeds and user characteristics. Because the user moves at different speeds along a complex indoor path, using the PDR method without adjusting the parameters of its components based on various walking speeds causes errors in positioning. Moreover, according to the literature, detecting steps and estimating step length without considering users' characteristics including gender, height and age led to significant positioning errors. In this paper, we improve the accuracy and robustness of the proposed method by adjusting PDR component parameters based on walking speeds, motion states and pedestrian characteristics, including gender and height.

The Proposed Method
The proposed PDR system ( Figure 1) includes data collection, data calibration, motion detection, step detection, step length estimation, heading determination and height estimation. Initially, the data are collected by volunteers of different heights and ages as they walked at different speeds and modes. Several errors occurred in the measurement data; thus, calibration was required and the appropriate features were extracted from the calibrated data and used in the classification algorithm. Different motion modes were distinguished with the combination of DTree and SVM algorithms. DTree was used for recognizing different phone-carrying modes, while the SVM was employed to detect different pedestrian activities. The parameters of step detection and step length estimation were adjusted based on gender, walking speed, pedestrian activity and phone-carrying mode. A gradient descent algorithm (GDA) was utilized to estimate the heading from the accelerometer, gyroscope and magnetometer data. Finally, movement altitude was estimated with pressure data and the 3D position was calculated by using the PDR equation.

The Proposed Method
The proposed PDR system ( Figure 1) includes data collection, data calibration, motion detection, step detection, step length estimation, heading determination and height estimation. Initially, the data are collected by volunteers of different heights and ages as they walked at different speeds and modes. Several errors occurred in the measurement data; thus, calibration was required and the appropriate features were extracted from the calibrated data and used in the classification algorithm. Different motion modes were distinguished with the combination of DTree and SVM algorithms. DTree was used for recognizing different phone-carrying modes, while the SVM was employed to detect different pedestrian activities. The parameters of step detection and step length estimation were adjusted based on gender, walking speed, pedestrian activity and phone-carrying mode. A gradient descent algorithm (GDA) was utilized to estimate the heading from the accelerometer, gyroscope and magnetometer data. Finally, movement altitude was estimated with pressure data and the 3D position was calculated by using the PDR equation.

PDR
According to (1), the PDR approach calculates the user's location at each step based on his/her length, direction and location in the previous step [46].
where and represent the user's estimated position in Step i and and are the length and direction of the user's movement in Step i, respectively. The initial location is assumed to be known and can be determined by default or by QR codes in the building.

Components of the PDR Positioning System
Positioning using the PDR method includes various components, such as movement state recognition, step detection, step length estimation and movement altitude estimation. Each of these components will be discussed as follows.

Preprocessing
Since smartphone-embedded inertial sensors are not very accurate, the raw sensor data are noisy. Before step detection and motion state recognition, a preprocessing process

PDR
According to (1), the PDR approach calculates the user's location at each step based on his/her length, direction and location in the previous step [46].
where X i and Y i represent the user's estimated position in Step i and L i and Ψ i are the length and direction of the user's movement in Step i, respectively. The initial location is assumed to be known and can be determined by default or by QR codes in the building.

Components of the PDR Positioning System
Positioning using the PDR method includes various components, such as movement state recognition, step detection, step length estimation and movement altitude estimation. Each of these components will be discussed as follows.

Preprocessing
Since smartphone-embedded inertial sensors are not very accurate, the raw sensor data are noisy. Before step detection and motion state recognition, a preprocessing process must be applied to eliminate the noise and errors. The low-pass filter, which uses a cut-off frequency of 5 Hz, softens and eliminates some high-frequency noises from the acceleration signals, allowing more accurate detection of pedestrian movements and reducing false step detection. In Figure 2, acceleration data are filtered using a low-pass filter with a cut-off frequency of 5 Hz. must be applied to eliminate the noise and errors. The low-pass filter, which uses a cutoff frequency of 5 Hz, softens and eliminates some high-frequency noises from the acceleration signals, allowing more accurate detection of pedestrian movements and reducing false step detection. In Figure 2, acceleration data are filtered using a low-pass filter with a cut-off frequency of 5 Hz.

Figure 2.
A low-pass filter for the acceleration signals with a cut-off frequency of 5 Hz to remove high-frequency noise.
Smartphone magnetometers are easily affected by the magnetic fields of the local environment. There are two kinds of disturbances in the magnetometer data, hard iron disturbance and soft iron disturbance. Permanent magnet materials cause a hard iron disturbance, which affects the magnetometer's values, similar to constant bias. Unlike hardiron disturbances, soft-iron disturbances are caused by materials that influence or disturb but do not generate magnetic fields [47]. The magnetometer signals were calibrated using the least squares fitting ellipsoid method [48]. Ellipsoid fitting models from raw and calibrated magnetometer data are displayed in Figure 3a and Figure 3b, respectively.   Smartphone magnetometers are easily affected by the magnetic fields of the local environment. There are two kinds of disturbances in the magnetometer data, hard iron disturbance and soft iron disturbance. Permanent magnet materials cause a hard iron disturbance, which affects the magnetometer's values, similar to constant bias. Unlike hard-iron disturbances, soft-iron disturbances are caused by materials that influence or disturb but do not generate magnetic fields [47]. The magnetometer signals were calibrated using the least squares fitting ellipsoid method [48]. Ellipsoid fitting models from raw and calibrated magnetometer data are displayed in Figures 3a and 3b, respectively. must be applied to eliminate the noise and errors. The low-pass filter, which uses a cutoff frequency of 5 Hz, softens and eliminates some high-frequency noises from the acceleration signals, allowing more accurate detection of pedestrian movements and reducing false step detection. In Figure 2, acceleration data are filtered using a low-pass filter with a cut-off frequency of 5 Hz.

Figure 2.
A low-pass filter for the acceleration signals with a cut-off frequency of 5 Hz to remove high-frequency noise.
Smartphone magnetometers are easily affected by the magnetic fields of the local environment. There are two kinds of disturbances in the magnetometer data, hard iron disturbance and soft iron disturbance. Permanent magnet materials cause a hard iron disturbance, which affects the magnetometer's values, similar to constant bias. Unlike hardiron disturbances, soft-iron disturbances are caused by materials that influence or disturb but do not generate magnetic fields [47]. The magnetometer signals were calibrated using the least squares fitting ellipsoid method [48]. Ellipsoid fitting models from raw and calibrated magnetometer data are displayed in Figure 3a and Figure 3b, respectively.

Classification of Different Motion States
Various activities were considered in the proposed method to enhance the robustness of PDR positioning, such as walking, ascending and descending stairs. Further, walking was classified as fast, normal, or slow, based on speed. Moreover, three phone-carrying modes, texting, calling and swinging, were considered. Based on Figure 4, when using a smartphone in texting mode, users hold it horizontally in front of their bodies and in calling mode they hold it vertically near their ears. In the swinging mode, users hold the smartphone in their hands and swing it. This study analyzed each movement state separately for women and men. Figure 5 compares the acceleration data values in different phone-carrying modes and walking speeds. Based on Figure 5b, as the speed increased, the range of acceleration during the steps rose. To recognize different motion states, three sensors, an accelerometer, gyroscope and barometer, were employed. The barometer had the lowest sampling rate, i.e., 10 Hz, whereas the sampling rates of the other two sensors were 100 Hz.

Classification of Different Motion States
Various activities were considered in the proposed method to enhance the robustness of PDR positioning, such as walking, ascending and descending stairs. Further, walking was classified as fast, normal, or slow, based on speed. Moreover, three phone-carrying modes, texting, calling and swinging, were considered. Based on Figure 4, when using a smartphone in texting mode, users hold it horizontally in front of their bodies and in calling mode they hold it vertically near their ears. In the swinging mode, users hold the smartphone in their hands and swing it. This study analyzed each movement state separately for women and men. Figure 5 compares the acceleration data values in different phone-carrying modes and walking speeds. Based on Figure 5b, as the speed increased, the range of acceleration during the steps rose. To recognize different motion states, three sensors, an accelerometer, gyroscope and barometer, were employed. The barometer had the lowest sampling rate, i.e., 10 Hz, whereas the sampling rates of the other two sensors were 100 Hz. To recognize different motion states, 15 features were extracted from the accelerometer, gyroscope and barometer data. The features were the average (except for the barometer), standard deviation (STD), the difference between the maximum and the minimum,

Classification of Different Motion States
Various activities were considered in the proposed method to enhance the robustness of PDR positioning, such as walking, ascending and descending stairs. Further, walking was classified as fast, normal, or slow, based on speed. Moreover, three phone-carrying modes, texting, calling and swinging, were considered. Based on Figure 4, when using a smartphone in texting mode, users hold it horizontally in front of their bodies and in calling mode they hold it vertically near their ears. In the swinging mode, users hold the smartphone in their hands and swing it. This study analyzed each movement state separately for women and men. Figure 5 compares the acceleration data values in different phone-carrying modes and walking speeds. Based on Figure 5b, as the speed increased, the range of acceleration during the steps rose. To recognize different motion states, three sensors, an accelerometer, gyroscope and barometer, were employed. The barometer had the lowest sampling rate, i.e., 10 Hz, whereas the sampling rates of the other two sensors were 100 Hz. To recognize different motion states, 15 features were extracted from the accelerometer, gyroscope and barometer data. The features were the average (except for the barometer), standard deviation (STD), the difference between the maximum and the minimum, To recognize different motion states, 15 features were extracted from the accelerometer, gyroscope and barometer data. The features were the average (except for the barometer), standard deviation (STD), the difference between the maximum and the minimum, skewness and zero crossing rate. To evaluate the performance of the classification, 43 experimenters of different ages and heights participated in the data collection, including 24 women and 19 men. The mean age and height of the men were, respectively, 27.5 ± 5.1 years and 171.1 ± 5.5 cm, while those of the women were, respectively, 27.54 ± 5.6 years and 159.6 ± 6.7 cm. More details about the experimenters' height and age are shown in Figure 6. skewness and zero crossing rate. To evaluate the performance of the classification, 43 experimenters of different ages and heights participated in the data collection, including 24 women and 19 men. The mean age and height of the men were, respectively, 27.5 ± 5.1 years and 171.1 ± 5.5 cm, while those of the women were, respectively, 27.54 ± 5.6 years and 159.6 ± 6.7 cm. More details about the experimenters' height and age are shown in Figure 6. The combination of 15 motion states including three phone-carrying modes (texting, calling, swinging) and five pedestrian activities (descending stairs, ascending stairs, fast walking, normal walking and slow walking) were considered as different motion states and the experimenters collected data in each state. After data collection, data segmentation was performed using a two-second sliding window with a 50% overlap and the sensor sampling frequency was 100 Hz. Each two-second sliding window is called an instance. Women and men had 6112 and 5336 instances in total, respectively. The instance number of each class is reported in Table 1. A combination of DTree and SVM algorithms was adopted to detect the motion states, including different phone-carrying modes and pedestrian activities. Based on 5fold cross-validation [49], Figure 7 illustrates the recognition performance of women and men for DTree, KNN, SVM, a combination of DTree and SVM and a combination of DTree and KNN algorithms. According to Figure 7, a combination of DTree and SVM algorithms outperformed the mentioned algorithms in women and men with 97% and 98% accuracy, respectively.  The combination of 15 motion states including three phone-carrying modes (texting, calling, swinging) and five pedestrian activities (descending stairs, ascending stairs, fast walking, normal walking and slow walking) were considered as different motion states and the experimenters collected data in each state. After data collection, data segmentation was performed using a two-second sliding window with a 50% overlap and the sensor sampling frequency was 100 Hz. Each two-second sliding window is called an instance. Women and men had 6112 and 5336 instances in total, respectively. The instance number of each class is reported in Table 1. A combination of DTree and SVM algorithms was adopted to detect the motion states, including different phone-carrying modes and pedestrian activities. Based on 5-fold cross-validation [49], Figure 7 illustrates the recognition performance of women and men for DTree, KNN, SVM, a combination of DTree and SVM and a combination of DTree and KNN algorithms. According to Figure 7, a combination of DTree and SVM algorithms outperformed the mentioned algorithms in women and men with 97% and 98% accuracy, respectively. Using DTree and SVM algorithms, 15 combinations of phone-carrying modes an pedestrian activities were recognized. As shown in Figure 8b, DTree was used to detec phone-carrying modes, while SVM was utilized to detect pedestrian activities based o the identified phone-carrying mode. A DTree is a supervised learning algorithm and non parametric classifier in the form of a tree and is composed of nodes, branches and leave that are predicted classes. To predict class labels, DTree uses training data to infer decisio rules [50]. DTree was used to detect the phone-carrying modes in this paper, where th average acceleration values of the X, Y and Z axes were used as the inputs. Accordingly three rules were designed based on training data. The tree view of this DTree is presente in Figure 8a. L1 and L2 are the parameters of the DTree model and are estimated accordin to the pedestrian's gender. L1 and L2 are (0.95,0.22) and (0.82,0.055) for females and males respectively. According to the output of DTree, the SVM algorithm is used to determin pedestrian activities and walking speed. SVM is a supervised machine learning algorithm used for both classification and regression. The objective of this algorithm is to identif hyperplanes to separate data points into different classes, which is improved by mappin input feature data into a higher-dimensional feature space [51]. Accordingly, Kernel func tions are utilized to map input feature data from a lower-dimensional space into a higher dimensional space [52]. The radial basis function kernel is selected as the kernel functio in this article. Input vectors of the SVM include average (except for barometer), STD, th difference between the maximum and minimum values, skewness and zero crossing rat of different sensors' data, while the output is the motion state. The recognition accuracy of the DTree algorithm based on 5-fold cross-validation i  Using DTree and SVM algorithms, 15 combinations of phone-carrying modes and pedestrian activities were recognized. As shown in Figure 8b, DTree was used to detect phone-carrying modes, while SVM was utilized to detect pedestrian activities based on the identified phone-carrying mode. A DTree is a supervised learning algorithm and nonparametric classifier in the form of a tree and is composed of nodes, branches and leaves that are predicted classes. To predict class labels, DTree uses training data to infer decision rules [50]. DTree was used to detect the phone-carrying modes in this paper, where the average acceleration values of the X, Y and Z axes were used as the inputs. Accordingly, three rules were designed based on training data. The tree view of this DTree is presented in Figure 8a. L1 and L2 are the parameters of the DTree model and are estimated according to the pedestrian's gender. L1 and L2 are (0.95,0.22) and (0.82,0.055) for females and males, respectively. According to the output of DTree, the SVM algorithm is used to determine pedestrian activities and walking speed. SVM is a supervised machine learning algorithm used for both classification and regression. The objective of this algorithm is to identify hyperplanes to separate data points into different classes, which is improved by mapping input feature data into a higher-dimensional feature space [51]. Accordingly, Kernel functions are utilized to map input feature data from a lower-dimensional space into a higher-dimensional space [52]. The radial basis function kernel is selected as the kernel function in this article. Input vectors of the SVM include average (except for barometer), STD, the difference between the maximum and minimum values, skewness and zero crossing rate of different sensors' data, while the output is the motion state. Using DTree and SVM algorithms, 15 combinations of phone-carrying modes and pedestrian activities were recognized. As shown in Figure 8b, DTree was used to detect phone-carrying modes, while SVM was utilized to detect pedestrian activities based on the identified phone-carrying mode. A DTree is a supervised learning algorithm and nonparametric classifier in the form of a tree and is composed of nodes, branches and leaves that are predicted classes. To predict class labels, DTree uses training data to infer decision rules [50]. DTree was used to detect the phone-carrying modes in this paper, where the average acceleration values of the X, Y and Z axes were used as the inputs. Accordingly, three rules were designed based on training data. The tree view of this DTree is presented in Figure 8a. L1 and L2 are the parameters of the DTree model and are estimated according to the pedestrian's gender. L1 and L2 are (0.95,0.22) and (0.82,0.055) for females and males, respectively. According to the output of DTree, the SVM algorithm is used to determine pedestrian activities and walking speed. SVM is a supervised machine learning algorithm used for both classification and regression. The objective of this algorithm is to identify hyperplanes to separate data points into different classes, which is improved by mapping input feature data into a higher-dimensional feature space [51]. Accordingly, Kernel functions are utilized to map input feature data from a lower-dimensional space into a higherdimensional space [52]. The radial basis function kernel is selected as the kernel function in this article. Input vectors of the SVM include average (except for barometer), STD, the difference between the maximum and minimum values, skewness and zero crossing rate of different sensors' data, while the output is the motion state. The recognition accuracy of the DTree algorithm based on 5-fold cross-validation is shown in Table   The recognition accuracy of the DTree algorithm based on 5-fold cross-validation is shown in Table 2. The average recognition accuracy of the phone-carrying modes was 98.7% for women and 99.7% for men. DTree confusion matrices for both men and women are given in Table 3, with the rows representing actual phone-carrying modes and the columns showing the detected phone-carrying modes. According to Table 3, texting and swinging modes were recognized correctly in both genders. Nevertheless, 2.9% and 0.9% instances of the calling mode were misrecognized as the swinging mode in women and men, respectively. The recognition performance of SVM based on 5-fold cross-validation is given in Table 4. According to Table 4, the average recognition accuracy of pedestrian activities for different states was 95.5%. The SVM confusion matrices for both men and women are shown in Table 5, with the rows representing actual pedestrian activities and the columns showing the detected pedestrian activities. According to Table 5, in all six states, descending and ascending stairs were distinguished with over 97.9% accuracy. In addition, three types of walking speed were distinguished for women in texting, calling and swinging modes with an average accuracy of 94.2%, 94.6% and 93.2%, respectively. For men in texting, calling and swinging modes, three types of walking speeds were distinguished with an average accuracy of 92%, 94.4% and 95.9%, respectively.

Step Detection
The peak detection method is used for step detection and its process is initiated by detecting the peak points in the accelerometer data. If the peak points are below the peak threshold or closer to the corresponding valley points than the peak valley threshold, they are eliminated. Additionally, peak points are removed if the time between them and the next peak point is less than the time threshold to prevent overcounting [20]. The mentioned thresholds are illustrated in Figure 9.

Step Detection
The peak detection method is used for step detection and its process is initiated by detecting the peak points in the accelerometer data. If the peak points are below the peak threshold or closer to the corresponding valley points than the peak valley threshold, they are eliminated. Additionally, peak points are removed if the time between them and the next peak point is less than the time threshold to prevent overcounting [20]. The mentioned thresholds are illustrated in Figure 9. Based on pedestrian activity and walking speed, threshold values were determined empirically to improve the accuracy of step detection. Table 6 lists the relevant threshold values for pedestrian activities and walking speeds.  Based on pedestrian activity and walking speed, threshold values were determined empirically to improve the accuracy of step detection. Table 6 lists the relevant threshold values for pedestrian activities and walking speeds.

Step Length Estimation
Weinberg's model, which uses the quartic root of the difference between the maximum and minimum of z-axis acceleration, was adopted to estimate step length [26]. Forty people, including 20 men and 20 women of different ages and heights, walked along a 20-m path at different speeds while carrying their smartphones in texting, calling and swinging modes. Then, the K coefficient was estimated for each state using the least squares technique. The mathematical equation of Weinberg's model is presented in (2).
where a max is the maximum acceleration in each step, a min denotes the minimum acceleration in each step and k represents the coefficient estimated based on different walking speeds, genders and phone-carrying modes. According to Figure 10, the k coefficient for men was higher than for women at the same speed in each motion mode. Furthermore, the k value increased for higher walking speeds.

Step Length Estimation
Weinberg's model, which uses the quartic root of the difference between the maximum and minimum of z-axis acceleration, was adopted to estimate step length [26]. Forty people, including 20 men and 20 women of different ages and heights, walked along a 20m path at different speeds while carrying their smartphones in texting, calling and swinging modes. Then, the K coefficient was estimated for each state using the least squares technique. The mathematical equation of Weinberg's model is presented in (2).
where is the maximum acceleration in each step, denotes the minimum acceleration in each step and k represents the coefficient estimated based on different walking speeds, genders and phone-carrying modes. According to Figure 10, the k coefficient for men was higher than for women at the same speed in each motion mode. Furthermore, the k value increased for higher walking speeds. The step length was calculated using the Weinberg model. To assess the performance of the step length estimation, four experimenters of different ages and heights participated, including two women and two men. The mean age and height of the men were respectively 25.5 ± 6 years and 175.1 ± 6.5 cm, while those of the women were respectively 25.5 ± 5.5 years and 161.5 ± 7.7 cm. In this section, gender and walking speeds are called effective parameters. Assuming that pedestrian activity is detected, for walking, the k values were selected based on effective parameters and step length was estimated based on the selected k; otherwise, for ascending and descending stairs, the step length was assumed 0.3 m regardless of the effective parameters. Tables 7 and 8 present the estimated distance for two paths, including a straight path of 56.7 m and a rectangular path of 79.9 m, respectively. These tables also include comparisons of distance error values by considering and neglecting effective parameters. Column M2 in Tables 7 and 8 represents the results of the step length estimation without considering the effective parameters. Accord- The step length was calculated using the Weinberg model. To assess the performance of the step length estimation, four experimenters of different ages and heights participated, including two women and two men. The mean age and height of the men were respectively 25.5 ± 6 years and 175.1 ± 6.5 cm, while those of the women were respectively 25.5 ± 5.5 years and 161.5 ± 7.7 cm. In this section, gender and walking speeds are called effective parameters. Assuming that pedestrian activity is detected, for walking, the k values were selected based on effective parameters and step length was estimated based on the selected k; otherwise, for ascending and descending stairs, the step length was assumed 0.3 m regardless of the effective parameters. Tables 7 and 8 present the estimated distance for two paths, including a straight path of 56.7 m and a rectangular path of 79.9 m, respectively. These tables also include comparisons of distance error values by considering and neglecting effective parameters. Column M2 in Tables 7 and 8 represents the results of the step length estimation without considering the effective parameters. According to Table 7, the relative distance errors of the straight path for texting, calling and swinging modes were 1.4% and 6.1%, 1.7% and 10.5% and 1.6% and 8.1%, respectively, when considering and neglecting the effective parameters. As shown in Table 8, the relative distance errors of the rectangular path for texting, calling and swinging modes were respectively 1.5% and 6%, 0.7% and 10% and 1.7% and 9.5% when considering and neglecting effective parameters. Based on Figure 11a,b, the distance estimation accuracy was improved significantly in both straight and rectangular paths by considering the effective parameters. According to Table 9, the relative distance errors of 3D paths for texting, calling and swinging modes were 0.7% and 24.5%, 1.4% and 25% and 1.1% and 23.8%, respectively, when considering and neglecting the effective parameters and activity detection. According to Figure 12, in addition to considering the effective parameters, recognizing the ascending or descending stairs significantly reduced the distance estimation error in the 3D trajectory.    According to Table 9, the relative distance errors of 3D paths for texting, calling and swinging modes were 0.7% and 24.5%, 1.4% and 25% and 1.1% and 23.8%, respectively, when considering and neglecting the effective parameters and activity detection. According to Figure 12, in addition to considering the effective parameters, recognizing the ascending or descending stairs significantly reduced the distance estimation error in the 3D trajectory.

Heading Estimation
The GDA algorithm (Algorithm 1) was used for heading estimation. The mathematical analysis of the gradient descent algorithm for heading estimation has been widely covered in the literature [32,53]; therefore, only a summary of the equations used for heading estimation is presented and discussed in this section. This algorithm uses accelerometer and magnetometer signals to calculate the gyroscope measurement error as quaternion derivatives. System inputs include acceleration, gyroscopes and magnetometer sensors. Generally, GDA assumes that magnetic data within a building are subject to external magnetic disturbances. To increase accuracy, magnetic data with a wide fluctuation range relative to the reference magnetic field is avoided [53]. In this algorithm, stability is the result of magnetic field stability. , ℎ and mag_stability_threshold represent the measured magnetometer field, the Earth's local reference magnetic field and the threshold to limit the magnetic field interference, respectively. Vector F represents the error vector between the estimated value and the measured data of acceleration and magnetometer. If magnetic stability = 1, the magnetometer data are used; otherwise, gyroscope and accelerometer data are combined. Consequently, in the case of stable magnetic information, error vector F(̂− 1 . ) and, otherwise, error vector F(̂− 1 . acc) is used to correct the ̇ and the final optimal quaternion value ̂ is obtained. This algorithm requires a parameter called β, which represents the measurement error of the gyroscope [32]. β was assumed to be 0.05 in this paper.  Figure 12. Comparison of the average relative errors of distance estimation in the 3D trajectory.

Heading Estimation
The GDA algorithm (Algorithm 1) was used for heading estimation. The mathematical analysis of the gradient descent algorithm for heading estimation has been widely covered in the literature [32,53]; therefore, only a summary of the equations used for heading estimation is presented and discussed in this section. This algorithm uses accelerometer and magnetometer signals to calculate the gyroscope measurement error as quaternion derivatives. System inputs include acceleration, gyroscopes and magnetometer sensors. Generally, GDA assumes that magnetic data within a building are subject to external magnetic disturbances. To increase accuracy, magnetic data with a wide fluctuation range relative to the reference magnetic field is avoided [53]. In this algorithm, stability is the result of magnetic field stability. mag s , mag Earth and mag_stability_threshold represent the measured magnetometer field, the Earth's local reference magnetic field and the threshold to limit the magnetic field interference, respectively. Vector F represents the error vector between the estimated value and the measured data of acceleration and magnetometer. If magnetic stability = 1, the magnetometer data are used; otherwise, gyroscope and accelerometer data are combined. Consequently, in the case of stable magnetic information, error vector F(q t−1 . mag) and, otherwise, error vector F(q t−1 . acc) is used to correct the . q t and the final optimal quaternion valueq t is obtained. This algorithm requires a parameter called β, which represents the measurement error of the gyroscope [32]. β was assumed to be 0.05 in this paper.

Calculation of the Pedestrians' Movement Height
According to (4), pressure sensor measurements were used for height estimation [55].
where h 0 is the initial height in meters, R is the universal gas constant equal to 8.31432 NM molk , T 0 is the temperature in Kelvin and P 0 and P t are, respectively, the initial atmospheric pressure and the atmospheric pressure in Pascal at time t. Moreover, g is the magnitude of local gravity acceleration equal to 9.806 m s 2 and M is the average molar mass of air equal to 0.0289644 Kg mol . Figure 13a demonstrates the pressure sensor measurements. Building floors are distinguished based on altitudes derived from pressure sensor measurements. As shown in Figure 13b, walking initiates on the first level. As the pedestrian walks upstairs, his/her height increases from zero on the first level to 9 m on the third. The values of altitude estimation error were calculated based on differences between the estimated and the actual altitude values. The mean and standard divisions of altitude estimation error were 0.26 m and 0.19 m, respectively. The cumulative disturbance function (CDF) was used to further analyze the absolute estimation altitude errors. According to Figure 14, the 80% probability of altitude estimation error is less than 0.42 m. This value cannot affect floor detection in this building because the floors' level elevation differs by 4.5 m and it is comparatively small. The values of altitude estimation error were calculated based on differences between the estimated and the actual altitude values. The mean and standard divisions of altitude estimation error were 0.26 m and 0.19 m, respectively. The cumulative disturbance function (CDF) was used to further analyze the absolute estimation altitude errors. According to Figure 14, the 80% probability of altitude estimation error is less than 0.42 m. This value cannot affect floor detection in this building because the floors' level elevation differs by 4.5 m and it is comparatively small.
The values of altitude estimation error were calculated based on differences between the estimated and the actual altitude values. The mean and standard divisions of altitude estimation error were 0.26 m and 0.19 m, respectively. The cumulative disturbance function (CDF) was used to further analyze the absolute estimation altitude errors. According to Figure 14, the 80% probability of altitude estimation error is less than 0.42 m. This value cannot affect floor detection in this building because the floors' level elevation differs by 4.5 m and it is comparatively small.

Positioning Experiments and Assessment
The experiments were conducted in the building of the School of Surveying and Geospatial Engineering at the University of Tehran (Iran). As shown in Figure 15, it is a normal multi-story building with classrooms and offices. Using the multi-story building plan in Google SketchUp software, a three-dimensional model was generated for a better representation of the studied area. This section of the paper contains the presentation of the results followed by the analysis and discussion of the results. The experiments were conducted in the building of the School of Surveying and Geospatial Engineering at the University of Tehran (Iran). As shown in Figure 15, it is a normal multi-story building with classrooms and offices. Using the multi-story building plan in Google SketchUp software, a three-dimensional model was generated for a better representation of the studied area. This section of the paper contains the presentation of the results followed by the analysis and discussion of the results. To evaluate the performance of the positioning, experimenters of different ages and heights, two women and two men, participated. The average age and height of the men were, respectively, 28 years and 174.1 cm and, respectively, 25 years and 164 cm for women. The experimenters moved along the designed path of 159.2 m using four smartphones (Samsung Galaxy S4, Xiaomi Poco F2 Pro, Samsung Galaxy Note 10 and iPhone 13 Pro). As shown in Figure 16, the starting point of the test was on the third floor and its ending point was on the first floor.
In this experiment, reference points were set at the ending and starting points of staircases and turning points, which are significant landmarks for estimating error positioning along the designed path. In this regard, we asked the experimenters to step over the reference point as precisely as possible. The positioning error is estimated by calculating the To evaluate the performance of the positioning, experimenters of different ages and heights, two women and two men, participated. The average age and height of the men were, respectively, 28 years and 174.1 cm and, respectively, 25 years and 164 cm for women. The experimenters moved along the designed path of 159.2 m using four smartphones (Samsung Galaxy S4, Xiaomi Poco F2 Pro, Samsung Galaxy Note 10 and iPhone 13 Pro). As shown in Figure 16, the starting point of the test was on the third floor and its ending point was on the first floor.

Texting Mode Positioning Experimentation
According to Table 10, for women, the average relative distance error decreased from 21.38% to 4.97% and 0.88% using an activity-based PDR and the proposed method, respectively. For men, by using the activity-based PDR and the proposed method, the relative distance error decreased from 21.02% to 8.12% and 1.15%, respectively. The average and STD of positioning error values are presented in Table 10. For women, the typical PDR method had higher error values compared to the other two methods. It had an average error value of 3.02 m and an STD of 2.82 m. The mean and standard errors of the activity-based PDR were 2.52 m and 1.71 m, respectively, confirming that it is more accurate than the typical PDR. The proposed method had the lowest error values among the three methods and its average and STD were 1.28 m and 0.76 m, respectively, confirming that it is more accurate than the other two methods. For men (Table 10), the typical PDR method had higher error values than the other two methods. It had an average error value of 4.07 m and an STD of 2.09 m. The activity-based PDR's mean and STD errors were 3.33 m and 1.61 m, respectively. Moreover, the proposed method had the lowest error values and its average and STD were 1.26 m and 0.68 m, respectively, demonstrating that it performs best among the three methods. Based on Table 10, the PDR algorithm performance was improved by activity, walking speed and gender detection. By detecting activities, the average positioning error was reduced by 0.5 m for women and 0.74 m for men. Walking speed detection and gender were also important factors for improving PDR performance in addition to activity detection. The proposed method decreased the average errors by 1.24 m for women and 2.07 m for men compared to the recognition of activity alone.  In this experiment, reference points were set at the ending and starting points of staircases and turning points, which are significant landmarks for estimating error positioning along the designed path. In this regard, we asked the experimenters to step over the reference point as precisely as possible. The positioning error is estimated by calculating the Euclidean distance between the estimated and actual coordinates of reference points. Furthermore, the estimated distance is the total length of the step lengths and the distance estimation error is the difference between the estimated distance and the actual distance. In this section, positioning with the PDR method based on the recognition of walking, ascending and descending stairs is called activity-based PDR. However, the proposed method recognizes walking speed in addition to activities. It also considers different genders in each activity and the walking speed.

Texting Mode Positioning Experimentation
According to Table 10, for women, the average relative distance error decreased from 21.38% to 4.97% and 0.88% using an activity-based PDR and the proposed method, respectively. For men, by using the activity-based PDR and the proposed method, the relative distance error decreased from 21.02% to 8.12% and 1.15%, respectively. The average and STD of positioning error values are presented in Table 10. For women, the typical PDR method had higher error values compared to the other two methods. It had an average error value of 3.02 m and an STD of 2.82 m. The mean and standard errors of the activity-based PDR were 2.52 m and 1.71 m, respectively, confirming that it is more accurate than the typical PDR. The proposed method had the lowest error values among the three methods and its average and STD were 1.28 m and 0.76 m, respectively, confirming that it is more accurate than the other two methods. For men (Table 10), the typical PDR method had higher error values than the other two methods. It had an average error value of 4.07 m and an STD of 2.09 m. The activity-based PDR's mean and STD errors were 3.33 m and 1.61 m, respectively. Moreover, the proposed method had the lowest error values and its average and STD were 1.26 m and 0.68 m, respectively, demonstrating that it performs best among the three methods. Based on Table 10, the PDR algorithm performance was improved by activity, walking speed and gender detection. By detecting activities, the average positioning error was reduced by 0.5 m for women and 0.74 m for men. Walking speed detection and gender were also important factors for improving PDR performance in addition to activity detection. The proposed method decreased the average errors by 1.24 m for women and 2.07 m for men compared to the recognition of activity alone. The cumulative error distribution curve of reference point estimation for the first woman is illustrated in Figure 17a. This curve indicates that the mean position error with a probability of 95% has decreased from 4.85 m to 3.31 m and 2.09 m using the activity-based PDR and the proposed method, respectively. Moreover, as shown in Figure 17b, for the male subject 1, by using the activity-based PDR and the proposed method, the mean position error with a probability of 95% decreased from 5.33 m to 5.06 m and 2.17 m, respectively. The cumulative error distribution curve of reference point estimation for the first woman is illustrated in Figure 17a. This curve indicates that the mean position error with a probability of 95% has decreased from 4.85 m to 3.31 m and 2.09 m using the activitybased PDR and the proposed method, respectively. Moreover, as shown in Figure 17b, for the male subject 1, by using the activity-based PDR and the proposed method, the mean position error with a probability of 95% decreased from 5.33 m to 5.06 m and 2.17 m, respectively.   Figures 18 and 19 compare the position results of the two strategies, including activitybased PDR and the proposed method, from a 3D perspective for the Female and Male subject 1. Figures 18a and 19a show the positioning results for the third floor, while Figures 18b and 19b depict the positioning results for the first floor. The yellow line shows the ground truth, the green line represents the results of the activity-based PDR and the red line denotes the results of the proposed method. As shown in these figures, due to neglecting speed changes, the green line drifts away from the reference line at some points. Based on the proposed method (red line), the position is determined much more accurately and its distance from the reference path is significantly reduced since the step length error is decreasing when considering walking speed variations and gender differences.

Calling Mode Positioning Experimentation
According to Table 11, for women, the average of relative distance errors decreased from 16.3% to 4.21% and 0.67% using the activity-based PDR and the proposed method, respectively. For men, by using the activity-based PDR and the proposed method, the relative distance error decreased from 12.84% to 4.11% and 0.93%, respectively. The average and STD of positioning error values are presented in Table 11. For women, the typical PDR method had higher error values compared to the other two methods. It had an average error value of 3.52 m and an STD of 1.76 m. The activity-based PDR had a mean error of 1.78 m and an STD of 0.94 m, confirming its higher accuracy compared to typical PDRs. As compared to the other two methods, the proposed method had the lowest error values, with an average and STD of 0.98 m and 0.51 m, respectively. For men (Table 11), the typical PDR method had higher error values than the other two methods. It had an average error value of 4.23 m and an STD of 2.31 m. Besides, the activity-based PDR's mean and STD errors were 2.49 m and 1.12 m, respectively. Furthermore, the proposed method had the lowest error values and its average and STD were 1.17 m and 0.7 m, respectively, indicat-

Calling Mode Positioning Experimentation
According to Table 11, for women, the average of relative distance errors decreased from 16.3% to 4.21% and 0.67% using the activity-based PDR and the proposed method, respectively. For men, by using the activity-based PDR and the proposed method, the relative distance error decreased from 12.84% to 4.11% and 0.93%, respectively. The average and STD of positioning error values are presented in Table 11. For women, the typical PDR method had higher error values compared to the other two methods. It had an average error value of 3.52 m and an STD of 1.76 m. The activity-based PDR had a mean error of 1.78 m and an STD of 0.94 m, confirming its higher accuracy compared to typical PDRs. As compared to the other two methods, the proposed method had the lowest error values, with an average and STD of 0.98 m and 0.51 m, respectively. For men (Table 11)

Calling Mode Positioning Experimentation
According to Table 11, for women, the average of relative distance errors decreased from 16.3% to 4.21% and 0.67% using the activity-based PDR and the proposed method, respectively. For men, by using the activity-based PDR and the proposed method, the relative distance error decreased from 12.84% to 4.11% and 0.93%, respectively. The average and STD of positioning error values are presented in Table 11. For women, the typical PDR method had higher error values compared to the other two methods. It had an average error value of 3.52 m and an STD of 1.76 m. The activity-based PDR had a mean error of 1.78 m and an STD of 0.94 m, confirming its higher accuracy compared to typical PDRs. As compared to the other two methods, the proposed method had the lowest error values, with an average and STD of 0.98 m and 0.51 m, respectively. For men (Table 11), the typical PDR method had higher error values than the other two methods. It had an average error value of 4.23 m and an STD of 2.31 m. Besides, the activity-based PDR's mean and STD errors were 2.49 m and 1.12 m, respectively. Furthermore, the proposed method had the lowest error values and its average and STD were 1.17 m and 0.7 m, respectively, indicating that it performs the best out of the three. Results in Table 11 indicate that the performance of the PDR algorithm is improved by activity, walking speed and gender detection. By detecting activities, the average positioning error was reduced by 1.74 m for women and 1.73 m for men. In addition to activity detection, PDR performance was enhanced by detecting walking speed and gender. The proposed method decreased the average errors by 0.8 m for women and 1.32 m for men compared to the recognition of activity alone. The cumulative error distribution curve of reference point estimation for the first woman is illustrated in Figure 20a. This curve indicates that the mean position error with a probability of 95% decreased from 5.14 m to 3.59 m and 1.92 m using the activity-based PDR and the proposed method, respectively. Moreover, as shown in Figure 20b, for the first man, by using the activity-based PDR and the proposed method, the mean position error with a probability of 95% decreased from 8.  The cumulative error distribution curve of reference point estimation for the first woman is illustrated in Figure 20a. This curve indicates that the mean position error with a probability of 95% decreased from 5.14 m to 3.59 m and 1.92 m using the activity-based PDR and the proposed method, respectively. Moreover, as shown in Figure 20b, for the first man, by using the activity-based PDR and the proposed method, the mean position error with a probability of 95% decreased from 8.24 m to 4.16 m and 2.72 m, respectively.

Swinging Mode Positioning Experimentation
According to Table 12, for women, the average relative distance error decreased from 17.39% to 5.76% and 0.93% using the activity-based PDR and the proposed method, respectively. For men, by using the activity-based PDR and the proposed method, the aver-

Swinging Mode Positioning Experimentation
According to Table 12, for women, the average relative distance error decreased from 17.39% to 5.76% and 0.93% using the activity-based PDR and the proposed method, respectively. For men, by using the activity-based PDR and the proposed method, the aver-

Swinging Mode Positioning Experimentation
According to Table 12, for women, the average relative distance error decreased from 17.39% to 5.76% and 0.93% using the activity-based PDR and the proposed method, respectively. For men, by using the activity-based PDR and the proposed method, the average relative distance error decreased from 11.93% to 3.71% and 0.77%, respectively. For women, according to Table 12, the typical PDR method had higher error values compared to the other two methods. It had an average error value of 3.81 m and an STD of 1.97 m. Compared to the typical PDR, the activity-based PDR had a mean error of 2.15 m and an STD of 1.25 m, confirming its higher accuracy. In comparison to the other two methods, the proposed method had the lowest error values, with an average and STD of 1.29 m and 0.64 m, respectively. For men (Table 12), the typical PDR method had higher error values than the other two methods. It had an average error value of 5.87 m and an STD of 3.53 m. Besides, the activity-based PDR's mean and STD errors were 2.52 m and 1.37 m, respectively. Furthermore, the proposed method had the lowest error values and its average and STD were 1.25 m and 0.66 m, respectively, demonstrating that it performs the best out of the three. Results in Table 12 indicate that the performance of the PDR algorithm is improved by activity, walking speed and gender detection. By detecting activities, the average positioning error was reduced by 1.66 m for women and 3.35 m for men. In addition to activity detection, the PDR performance was promoted by detecting walking speed and gender. The proposed method reduced the average errors by 0.86 m for women and 1.27 m for men compared to the recognition of activity alone. The cumulative error distribution curve of reference point estimation for the first woman is illustrated in Figure 23a. It demonstrates that the mean position error with a probability of 95% decreased from 6.49 m to 3.19 m and 2.88 m using the activity-based PDR and the proposed method, respectively. Furthermore, as depicted in Figure 23b, for the first man, by using the activity-based PDR and the proposed method, the mean position error with a probability of 95% decreased from 10.09 m to 3.2 m and 2.12 m, respectively.   The proposed method (red line) reduced step length errors and its distance from the reference path significantly declined. At some points, however, the green line (associated with the activity-based PDR) veered off the reference line. Figure 26 compares the average positioning error of four smartphone models, including Samsung Galaxy S4, Xiaomi Poco F2 Pro, Samsung Galaxy Note 10 and iPhone 13 Pro for various phone-carrying modes. As compared to the other smartphone models, positioning with iPhone 13 Pro and Samsung Galaxy S4 had the lowest and highest error values, with an average of 1.05 m and 1.46 m, respectively.
According to Table 13, key parameters were not considered by Wang and Luo [17], Geng and Xia [14], Park and Lee [45], Wu and Ma [1] and Saadatzadeh and Ali Abbaspour [56]. The experiments by Wang and Luo [17] were carried out on a trajectory of 146 m for the texting mode and the distance error was 1.91 m. In Geng and Xia [14], the experiments were conducted on a trajectory of 118 m for texting and the positioning error was 1.61 m, whereas in Park and Lee [45] the experiments were performed on a trajectory of 58 m for texting and swinging and the positioning errors were 1.61 m and 3.41 m, respectively. A trajectory of 210 m was used by Wu and Ma [1] and, for the texting mode, the positioning error was 2.68 m. In Saadatzadeh and Ali Abbaspour [56], the experiment was conducted on a trajectory of 148.53 m for texting, calling and swinging modes, with distance errors of 2.68 m, 3.82 m and 8.39 m, respectively. In Klein and Solaz [16], the step length parameters were optimized based on walking speed, as shown in Table 13. The experiments were conducted on a trajectory of 21.4 m involving texting, calling and swinging modes, with distance errors of 0.38 m, 0.107 m and 0.47 m, respectively. In addition to the walking speed, Gu and Khoshelham [18] and Lu and Wu [43] also considered the pedestrian characteristics. As reported by Gu and Khoshelham [18], on a trajectory of 100 m, the distance error was 3.01 m. Furthermore, Lu and Wu [43] studied the texting mode on a trajectory of 100 m, with a distance error of 1.74 m. In this study, by optimizing the parameters of step detection and step length estimation based on different walking speeds, motion states and gender, the distance errors in texting, calling and swinging modes were 1.68 m, 1.27 m and 1.35 m, respectively, which improved significantly. Figures 24 and 25 compare the position results of the two strategies, including the activity-based PDR and the proposed method, from a 3D perspective for the first woman and man. Figures 24a and 25a display the positioning results for the third floor, while Figures 24b and 25b show the positioning results for the first floor. The proposed method (red line) reduced step length errors and its distance from the reference path significantly declined. At some points, however, the green line (associated with the activity-based PDR) veered off the reference line.    According to Table 13, key parameters were not considered by Wang and Luo [17],   According to Table 13, key parameters were not considered by Wang and Luo [17], Geng and Xia [14], Park and Lee [45], Wu and Ma [1] and Saadatzadeh and Ali Abbaspour [56]. The experiments by Wang and Luo [17] were carried out on a trajectory of 146 m for the texting mode and the distance error was 1.91 m. In Geng and Xia [14], the experiments were conducted on a trajectory of 118 m for texting and the positioning error was 1.61 m, whereas in Park and Lee [45] the experiments were performed on a trajectory of 58 m for texting and swinging and the positioning errors were 1.61 m and 3.41 m, respectively. A

Conclusions
This study used adaptive PDR positioning. Different pedestrian activities, phonecarrying modes and walking speeds were detected using a combination of SVM and DTree algorithms to promote the robustness of PDR positioning. Additionally, each motion state was investigated separately based on the experimenter's gender. The proposed classification approach recognized various motion states and walking speeds with a recognition accuracy of 95% for women and 97% for men. After motion state detection, motion states, walking speeds and gender were utilized to adjust the parameters of step counting and step length estimation methods separately for each motion state and gender. The goal was to enhance the robustness of PDR positioning. Using the optimization parameters, the absolute distance estimation error for texting, calling and swinging modes were respectively 1.