Arithmetic optimization algorithm-based finite-state machine gait detection method

By dividing the gait cycle into multiple discrete states in a finite state machine and constructing a fitness function to obtain the optimal threshold, and combining the Weinberg model and the heading correction model, the misjudgment problem of traditional gait detection methods is solved, and high-precision pedestrian localization is achieved.

CN121252801APending Publication Date: 2026-01-02LIAONING TECHNICAL UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511396548.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-28
Publication Date
2026-01-02

AI Technical Summary

Technical Problem

Traditional gait detection methods rely on fixed thresholds, leading to misjudgments and low robustness, making it difficult to achieve high-precision pedestrian positioning in complex indoor environments.

Method used

A finite state machine gait detection method using arithmetic optimization algorithms is proposed. By dividing the gait cycle into multiple discrete states, a fitness function is constructed using the step deviation rate to quickly obtain the optimal undetermined threshold. Combined with an improved Weinberg model and a heading correction model, the pedestrian coordinates are calculated.

Benefits of technology

It significantly improves the accuracy and robustness of gait detection, enhances the adaptability and accuracy of pedestrian positioning, is applicable to different pedestrian movement states and smartphone postures, and does not rely on infrastructure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121252801A_ABST
    Figure CN121252801A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of pedestrian indoor positioning, in particular to an arithmetic optimization algorithm-based finite-state machine gait detection method, which comprises the following steps of: S1, acquiring original data such as three-axis acceleration, angular velocity and the like based on sensor data acquisition software MATLAB Mobile software; s2, carrying out smoothing processing on the original data through zero offset correction and Kalman filtering; s3, according to a resultant acceleration change trend in the gait cycle and in combination with peak and trough threshold constraints, setting an undetermined threshold, and dividing the gait cycle into a plurality of discrete states; s4, constructing an arithmetic optimization algorithm by taking the step number deviation ratio as a fitness function, quickly obtaining an optimal threshold to be determined, substituting the optimal threshold to be determined into finite-state machine gait detection, and detecting pedestrian gait information; and S5, calculating pedestrian step length and course information based on the gait information, and establishing a motion equation to reconstruct a pedestrian trajectory. According to the technical scheme, the gait detection precision can be remarkably improved, and the adaptability and robustness of pedestrian positioning are effectively enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of indoor pedestrian positioning and navigation, and specifically to a finite state machine gait detection method based on an arithmetic optimization algorithm. Background Technology

[0002] With the development of IoT technology, location-based services have been widely applied in people's daily lives. Statistics show that people spend 70%-80% of their time indoors, and 80% of their information is related to indoor location. Modern urban architecture is becoming increasingly complex, with richer indoor and underground spatial structures. Satellite signals are easily affected by obstacles and human interference during propagation, significantly reducing positioning performance. Pedestrian Dead Reckoning (PDR) collects triaxial acceleration and angular velocity data during pedestrian movement, analyzes the periodic changes in pedestrian gait, and calculates information such as gait, stride length, and heading to determine pedestrian coordinates. It requires no infrastructure and has advantages such as low cost and high autonomy.

[0003] However, traditional gait detection methods rely on the periodic variation of the resultant acceleration during pedestrian movement and set fixed thresholds, which has significant technical limitations. Peak detection methods typically use fixed thresholds, but due to body shaking or swaying during walking, false peaks in the resultant acceleration often appear, leading to misjudgments and exhibiting low robustness. Finite state machine methods divide a single gait into discrete states based on the periodic variation of the resultant acceleration, detecting gait information through the transitions between these discrete states; however, the detection accuracy depends on the algorithm's understanding of the gait mechanism. In summary, traditional gait detection methods all set parameters to fixed empirical values ​​or obtained through multiple experiments, resulting in subjective bias and making it difficult to obtain globally optimal values.

[0004] Therefore, developing a gait detection method that can adaptively obtain the undetermined threshold of a finite state machine is of great significance for improving gait detection accuracy and enhancing the adaptability and robustness of pedestrian localization. Summary of the Invention

[0005] In view of this, the present invention provides a finite state machine gait detection method based on an arithmetic optimization algorithm. According to the variation law of the resultant acceleration within the gait period, the gait period is divided into multiple discrete states, and an arithmetic optimization algorithm is constructed with the step deviation rate as the fitness function to quickly obtain the optimal undetermined threshold, detect gait information, calculate pedestrian step length and heading information, and solve pedestrian coordinates, which significantly improves the gait detection accuracy and effectively enhances the adaptability and robustness of pedestrian positioning.

[0006] To achieve the above objectives, the present invention adopts the following technical solution:

[0007] A finite state machine gait detection method based on an arithmetic optimization algorithm includes the following steps:

[0008] Step S1: Based on the sensor data acquisition software MATLAB Mobile, collect triaxial acceleration and angular velocity;

[0009] Step S2: Smooth the original data using zero bias correction and Kalman filtering;

[0010] Step S3: Based on the smoothed triaxial acceleration information, according to the trend of the resultant acceleration change within the gait cycle, and combined with the peak and trough threshold constraints, set an undetermined threshold to divide the gait cycle into multiple discrete states.

[0011] Step S4: Construct an arithmetic optimization algorithm using the step deviation rate as the fitness function to quickly obtain the optimal undetermined threshold, and substitute it into the finite state machine gait detection to detect pedestrian gait information;

[0012] Step S5: Based on the gait information and smoothed triaxial angular velocity information obtained above, construct an improved Weinberg model and a heading correction model, calculate the pedestrian's stride length and heading information, and establish motion equations to solve for the pedestrian's coordinates.

[0013] Preferably, the sensor data acquisition process described in step S1 specifically includes:

[0014] Based on the sensor data acquisition software MATLAB Mobile, and using the phone's built-in accelerometer and gyroscope, the three-axis acceleration and angular velocity were collected at a sampling rate of 100Hz during pedestrian movement and when the phone was stationary.

[0015] Preferably, the data smoothing process described in step S2 specifically includes:

[0016] Step S21: Based on the three-axis acceleration and angular velocity of the mobile phone in a stationary state, calculate the difference between the mean value of each axis and the ideal output in a stationary state, and obtain the three-axis zero bias error for correction;

[0017] Step S22: Based on the acceleration and angular velocity after zero bias correction, perform optimal estimation of the system state. Let the system observation value be a, the system state variable be A, and the Kalman filter be established as follows:

[0018]

[0019] In the formula, K is the Kalman gain, P is the error covariance, and R and Q are the noise covariances.

[0020] Preferably, the gait period division process described in step S3 specifically includes:

[0021] Step S31: Based on the peak and trough values ​​of the resultant acceleration that occur periodically during the pedestrian's movement, each step of the pedestrian is divided into the initial state M0, the first acceleration state M1, the peak state M2, the deceleration state M3, the trough state M4, and the second acceleration state M5.

[0022] Step S32: Based on the resultant acceleration a at adjacent time points j a j+1 The difference, the number of times the combined acceleration increases positively, t u and negative decrease number t d The expression is as follows:

[0023]

[0024] In the formula, A is the threshold for judging the difference between adjacent resultant accelerations;

[0025] Step S33, based on t u t d Given a threshold value to be determined, determine the mutual transformation relationship between states M0 and M5. The transformation relationship is as follows:

[0026] Let t u =0,t d =0, determine whether the initial state M0 has entered the first acceleration state M1, the judgment condition is:

[0027]

[0028] In the formula, A f The threshold for determining whether a system is entering a growth phase;

[0029] Introducing the resultant acceleration peak threshold A U To determine whether the first growth rate state M1 has entered the peak state M2, the judgment condition is:

[0030]

[0031] In the formula, The threshold for the negative reduction of M1 under the growth rate state. The threshold for the number of positive increases under the growth rate condition M1;

[0032] Let t d =0, peak state M2 automatically enters deceleration state M3;

[0033] Introducing the resultant acceleration and introducing the trough threshold A D To determine whether the deceleration state M3 has entered the valley state M4, the judgment condition is:

[0034]

[0035] In the formula, TD The threshold for the negative reduction of the number of times under the deceleration state M3;

[0036] Let t u =0, the valley state M4 automatically enters the second growth state M5;

[0037] To determine whether the second growth rate state M5 returns to the initial state M0, the condition is:

[0038]

[0039] In the formula, The threshold for the number of positive increases under the growth rate condition of M5;

[0040] At this point, the stride returns to the initial state M0, and a new gait cycle begins.

[0041] Preferably, the undetermined threshold optimization process described in step S4 specifically includes:

[0042] Step S41: Calculate the step deviation rate based on the real step count (RealStep) and the detected step count (Step). The fitness score is calculated as follows:

[0043]

[0044] Step S42: Calculate the mathematical acceleration optimizer MOA and the mathematical probability optimizer MOP;

[0045] MOA is used to adjust the step size and direction of an arithmetic optimization algorithm. The expression is:

[0046]

[0047] In the formula, Min and Max are the minimum and maximum values ​​of MOA, respectively, CurI is the current iteration number, and MaxI is the maximum iteration number;

[0048] MOP is used to adjust the frequency of use of different operators, and its expression is:

[0049]

[0050] In the formula, α represents the effective accuracy of the iterative process;

[0051] Step S43: Determine the relationship between the random number r1 in the range [0,1] and MOA; when r1 > MOA, the algorithm enters the exploration phase; when r1 ≤ MOA, the algorithm enters the development phase.

[0052] Global exploration of the exploration area is performed based on division and multiplication operators. The expression for the exploration stage is:

[0053]

[0054] In the formula, B j The position of the current optimal solution is given by ε, which is the minimum constant. ub and lb are the upper and lower limits of the undetermined threshold, μ is the control parameter, and r2 is a random number between [0,1].

[0055] Based on addition and subtraction operators, local optimization is performed in the development region. The expression for the development phase is:

[0056]

[0057] In the formula, r3 is a random number between [0,1].

[0058] Preferably, the pedestrian coordinate calculation process in step S5 specifically includes:

[0059] Step S51: Based on the pedestrian's gait frequency and resultant acceleration amplitude, the step length is calculated as follows:

[0060]

[0061] In the formula, f k Let the step frequency be the step frequency at step k. Let $\begin{p}$ be the standard deviation, maximum value, and minimum value of the net acceleration of the pedestrian during the k-th step, respectively.

[0062] Step S52: Establish a complementary filter model and use the normalized triaxial acceleration to correct the triaxial angular velocity. The expression is:

[0063]

[0064] In the formula, ω x ω y ω z For the three-axis angular velocity, k f a is the proportionality constant. x a y a z The normalized triaxial accelerations are given by q0, q1, q2, and q3, which are quaternions, and k is the normalized triaxial acceleration. e These are the error integral coefficients;

[0065] The quaternion is updated using the corrected angular velocity, expressed as:

[0066]

[0067] In the formula, dt is the sampling period;

[0068] The heading can be calculated using quaternions, expressed as:

[0069]

[0070] Step S53: Set the heading at time j. The difference between the main orientation and the main orientation is mapped to the interval [0, Δ], and the offset is calculated as follows:

[0071]

[0072] In the formula, mod(·) is the remainder function;

[0073] Based on the offset, a sign function is constructed, and the heading correction is as follows:

[0074]

[0075] In the formula, sgn(·) is the sign function, and i is the heading correction amount;

[0076] Step S54, the equation of motion for the pedestrian is expressed as:

[0077]

[0078] In the formula, (X k ,Y k Let L be the coordinate of the k-th step. k , These represent the step size and heading at step k, respectively.

[0079] Therefore, the finite state machine gait detection method based on arithmetic optimization algorithm described above, as used in this invention, has the following technical advantages:

[0080] (1) Based on the changing trend of the resultant acceleration within a single gait cycle, this invention constructs an improved finite state machine gait detection, further applying threshold constraints to the peak and trough states, thereby improving the adaptability of gait detection to the gait cycle.

[0081] (2) This invention introduces an arithmetic optimization algorithm to construct a fitness function based on the step deviation rate and obtain the optimal undetermined threshold, thereby improving the accuracy and robustness of gait detection;

[0082] (3) This invention combines the improved Weinberg model and the heading correction model, which effectively suppresses step size and heading errors and improves pedestrian positioning accuracy;

[0083] (4) This invention is applicable to different pedestrian movement states and smartphone postures, has strong universality and practicality, does not rely on infrastructure, has low algorithm complexity, and is easy to promote. Attached Figure Description

[0084] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0085] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0086] Figure 1 This is a flowchart illustrating a finite state machine gait detection method based on an arithmetic optimization algorithm, provided in an embodiment of the present invention.

[0087] Figure 2 The curve showing the variation of the resultant acceleration is provided in the embodiment of the present invention;

[0088] Figure 3 This is a schematic diagram of the sensor data acquisition process provided in an embodiment of the present invention;

[0089] Figure 4 The gait detection results provided in the embodiments of the present invention;

[0090] Figure 5 The step count results provided in the embodiments of the present invention;

[0091] Figure 6 The coordinate calculation results are provided for embodiments of the present invention. Detailed Implementation

[0092] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0093] This invention provides a finite state machine gait detection method based on an arithmetic optimization algorithm, such as... Figure 1 As shown, it includes the following steps:

[0094] Step S1: Based on the sensor data acquisition software MATLAB Mobile, and using the built-in accelerometer and gyroscope of the mobile phone, collect the triaxial acceleration and angular velocity of the pedestrian during movement and the mobile phone when stationary at a sampling rate of 100Hz.

[0095] Step S2: Smooth the original data using zero-bias correction and Kalman filtering. The specific process is as follows:

[0096] Step S21: Based on the three-axis acceleration and angular velocity of the mobile phone in a stationary state, calculate the difference between the mean value of each axis and the ideal output in a stationary state, and obtain the three-axis zero bias error for correction;

[0097] Step S22: Based on the acceleration and angular velocity after zero bias correction, perform optimal estimation of the system state. Let the system observation value be a, the system state variable be A, and the Kalman filter be established as follows:

[0098]

[0099] In the formula, K is the Kalman gain, P is the error covariance, and R and Q are the noise covariances.

[0100] Step S3: Based on the smoothed triaxial acceleration, according to the trend of the resultant acceleration within the gait cycle, and combined with the peak and trough threshold constraints, set an undetermined threshold to divide the gait cycle into multiple discrete states; specifically, from... Figure 2 As can be seen, at the start of the gait cycle, the pedestrian enters the initial state M0. As the heel lifts off the ground, the leg rises, and the combined acceleration begins to increase, entering the first acceleration state M1. As the leg continues to rise, the combined acceleration continues to increase positively, reaching its maximum at the highest point, entering the peak state M2. Subsequently, the leg begins to fall, and the combined acceleration begins to decrease negatively, entering the deceleration state M3. As the leg continues to fall, the combined acceleration continues to decrease negatively, reaching its minimum when the foot lands on the ground, entering the trough state M4. Then, during the foot's landing process, the combined acceleration begins to increase positively, entering the second acceleration state M5. When the combined acceleration increases to a certain threshold, the pedestrian returns to the initial state M0 and enters the next gait cycle. The specific process is as follows:

[0101] Step S31: Based on the peak and trough values ​​of the resultant acceleration that occur periodically during the pedestrian's movement, each step of the pedestrian is divided into the initial state M0, the first acceleration state M1, the peak state M2, the deceleration state M3, the trough state M4, and the second acceleration state M5.

[0102] Step S32: Based on the resultant acceleration a at adjacent time points j a j+1 The difference, the number of times the combined acceleration increases positively, t u and negative decrease number t d The expression is as follows:

[0103]

[0104] In the formula, A is the threshold for judging the difference between adjacent resultant accelerations;

[0105] Step S33, based on t u t d Given a threshold value to be determined, determine the mutual transformation relationship between states M0 and M5. The transformation relationship is as follows:

[0106] Let t u =0,t d =0, determine whether the initial state M0 has entered the first acceleration state M1, the judgment condition is:

[0107]

[0108] In the formula, A f The threshold for determining whether a system is entering a growth phase;

[0109] Introducing the resultant acceleration peak threshold A U To determine whether the first growth rate state M1 has entered the peak state M2, the judgment condition is:

[0110]

[0111] In the formula, The threshold for the negative reduction of M1 under the growth rate state. The threshold for the number of positive increases under the growth rate condition M1;

[0112] Let t d =0, peak state M2 automatically enters deceleration state M3;

[0113] Introducing the resultant acceleration and introducing the trough threshold A D To determine whether the deceleration state M3 has entered the valley state M4, the judgment condition is:

[0114]

[0115] In the formula, T D The threshold for the negative reduction of the number of times under the deceleration state M3;

[0116] Let t u =0, the valley state M4 automatically enters the second growth state M5;

[0117] To determine whether the second growth rate state M5 returns to the initial state M0, the condition is:

[0118]

[0119] In the formula, The threshold for the number of positive increases under the growth rate condition of M5;

[0120] At this point, the stride returns to the initial state M0, and a new gait cycle begins.

[0121] Step S4: Construct an arithmetic optimization algorithm using the step deviation rate as the fitness function to quickly obtain the optimal undetermined threshold. Substitute this threshold into a finite state machine for gait detection to detect pedestrian gait information. The specific process is as follows:

[0122] Step S41: Calculate the step deviation rate based on the real step count (RealStep) and the detected step count (Step). The fitness score is calculated as follows:

[0123]

[0124] Step S42: Calculate the mathematical acceleration optimizer MOA and the mathematical probability optimizer MOP;

[0125] MOA is used to adjust the step size and direction of an arithmetic optimization algorithm. The expression is:

[0126]

[0127] In the formula, Min and Max are the minimum and maximum values ​​of MOA, respectively, CurI is the current iteration number, and MaxI is the maximum iteration number;

[0128] MOP is used to adjust the frequency of use of different operators, and its expression is:

[0129]

[0130] In the formula, α represents the effective accuracy of the iterative process;

[0131] Step S43: Determine the relationship between the random number r1 in the range [0,1] and MOA; when r1 > MOA, the algorithm enters the exploration phase; when r1 ≤ MOA, the algorithm enters the development phase.

[0132] Global exploration of the exploration area is performed based on division and multiplication operators. The expression for the exploration stage is:

[0133]

[0134] In the formula, B j The position of the current optimal solution is given by ε, which is the minimum constant. ub and lb are the upper and lower limits of the undetermined threshold, μ is the control parameter, and r2 is a random number between [0,1].

[0135] Based on addition and subtraction operators, local optimization is performed in the development region. The expression for the development phase is:

[0136]

[0137] In the formula, r3 is a random number between [0,1].

[0138] Step S5: Based on the gait information and smoothed triaxial angular velocity information obtained above, construct an improved Weinberg model and a heading correction model, calculate the pedestrian's stride length and heading information, establish motion equations to solve for the pedestrian's coordinates. The specific process is as follows:

[0139] Step S51: Based on the pedestrian's gait frequency and resultant acceleration amplitude, the step length is calculated as follows:

[0140]

[0141] In the formula, f k Let the step frequency be the step frequency at step k. Let $\begin{p}$ be the standard deviation, maximum value, and minimum value of the net acceleration of the pedestrian during the k-th step, respectively.

[0142] Step S52: Establish a complementary filter model and use the normalized triaxial acceleration to correct the triaxial angular velocity. The expression is:

[0143]

[0144] In the formula, ω x ω y ω z For the three-axis angular velocity, k f a is the proportionality constant. x a y a z The normalized triaxial accelerations are given by q0, q1, q2, and q3, which are quaternions, and k is the normalized triaxial acceleration. e These are the error integral coefficients;

[0145] The quaternion is updated using the corrected angular velocity, expressed as:

[0146]

[0147] In the formula, dt is the sampling period;

[0148] The heading can be calculated using quaternions, expressed as:

[0149]

[0150] Step S53: Set the heading at time j. The difference between the main orientation and the main orientation is mapped to the interval [0, Δ], and the offset is calculated as follows:

[0151]

[0152] In the formula, mod(·) is the remainder function;

[0153] Based on the offset, a sign function is constructed, and the heading correction is as follows:

[0154]

[0155] In the formula, sgn(·) is the sign function, and i is the heading correction amount;

[0156] Step S54, the equation of motion for the pedestrian is expressed as:

[0157]

[0158] In the formula, (X k ,Y k Let L be the coordinate of the k-th step. k , These represent the step size and heading at step k, respectively.

[0159] Example

[0160] This embodiment experimentally verifies and analyzes the method proposed in this invention from three aspects: threshold optimization capability, gait detection capability, and coordinate calculation capability. The main contents are as follows:

[0161] In this embodiment, the experimental sites were selected in the lobby and stairwell of an innovation practice building, and the corridor on the third floor of an office building. Using the sensor data acquisition software MATLAB Mobile, and based on the built-in accelerometer and gyroscope of a smartphone, the triaxial acceleration and angular velocity of a pedestrian during movement were collected at a sampling rate of 100Hz. The raw data was then smoothed using zero-bias correction and Kalman filtering. Specifically, as shown... Figure 3 As shown, to analyze threshold optimization capability, participants walked 60 steps with a Huawei Mate 60 Pro under different movement states (fast, slow, going upstairs, going downstairs) and different phone postures (navigation, calling, swinging, pocket), collecting 8 sets of data. To analyze gait detection capability, one male and one female participant walked 60 steps with a Huawei Mate 60 Pro and a Xiaomi 10S under different movement states and different phone postures, collecting 32 sets of data. To analyze coordinate calculation capability, participants walked forward and backward along a preset path with a Huawei Mate 60 Pro and a Xiaomi 10S held horizontally, collecting 8 sets of data. Some hardware information of the two smartphones is shown in Table 1.

[0162] Table 1. Partial Hardware Information of Smartphones

[0163] Huawei Mate 60 Pro Xiaomi 10S Processor Model Kirin 9000S - 12 cores - up to 2.62GHz Qualcomm Snapdragon 870 - 8 cores - up to 3.2GHz Accelerometer model rgm 3-axis Accelerometer lsm6dso Accelerometer Non-wakeup Gyroscope Model rgm 3-axis Gyroscope lsm6dso Gyroscope Non-wakeup

[0164] First, this embodiment uses the Balanced Optimizer (EO) algorithm, the Bald Eagle Search (BES) algorithm, the Harris Eagle Optimization (HHO) algorithm, and the Arithmetic Optimization (AOA) algorithm of this invention to analyze the threshold optimization capability. For eight sets of data with different motion states and different mobile phone postures, each of the four algorithms was repeated 50 times, and the optimal fitness and iteration time were statistically analyzed, as shown in Tables 2 and 3:

[0165] Table 2 Comparison of Optimal Fitness (Unit: %)

[0166] algorithm slow fast Go upstairs Go downstairs navigation swing call pocket mean EO 0 6.93 0 0.27 1.67 14.03 0.73 21.6 5.65 BES 0 6.57 0 0 0.53 1.83 0.77 8.17 2.23 HHO 0 6.9 0 0 0.1 1.67 0.33 4.63 1.7 AOA 0 6.6 0 0 0.23 0 0.57 1.77 1.15

[0167] Table 3. Comparison of iteration times (unit: seconds)

[0168] algorithm slow fast Go upstairs Go downstairs navigation swing call pocket mean EO 2.9364 2.1993 3.1549 2.9209 2.5436 2.4008 2.3666 2.9893 2.689 BES 13.5303 12.4329 13.9 13.5535 14.2334 13.5623 12.5121 18.2043 13.9911 HHO 5.5866 4.1713 5.7967 5.5394 4.7677 4.6094 4.6098 6.3321 5.1766 AOA 2.4995 1.901 2.6004 2.4774 2.1623 2.295 1.992 2.8082 2.342

[0169] Observing Tables 2 and 3, it can be seen that although the EO algorithm has a shorter average iteration time, it has a larger average optimal fitness; the BES and HHO algorithms have better average optimal fitness, but their iteration times are longer. The AOA algorithm used in this invention has an optimal fitness of 1.15% and an average iteration time of 2.234s, which is efficient in both fitness and iteration time, and has the best threshold optimization ability. Compared with the EO, BES, and HHO algorithms, the optimal fitness is more accurate by 4.5%, 1.08%, and 0.55%, respectively, and the iteration time is reduced by 0.347s, 11.6491s, and 2.8346s, respectively.

[0170] Secondly, this embodiment uses Dual Threshold Gait Detection (DT-SD), Acceleration Differential Finite State Machine (AD-FSM), Improved Finite State Machine (IFSM), and the Adaptive Threshold Finite State Machine (AT-FSM) proposed in this invention to analyze gait detection capabilities. For 32 sets of data, the number of steps detected by the four algorithms is statistically analyzed, such as... Figure 4 As shown, eight sub-images illustrate the step count information for the four algorithms under different motion states and phone postures. Taking a specific experimental set as an example, the gait detection results of the four algorithms are presented, such as... Figure 5 As shown, the curve is the resultant acceleration curve, and the points represent gait information at the start / end of the stride.

[0171] observe Figure 4-5It can be seen that DF-SD mistakenly records the peak moment as the start / end moment of the stride, indicating a significant time delay. AD-FSM exhibits false detections, with gait cycles fluctuating. IFSM can generally accurately identify the gait cycle, but in swing and pocket modes, the combined acceleration no longer changes periodically with each step, resulting in poor accuracy. AT-FSM can stably identify the gait cycle with virtually no time delay, averaging 59 steps and achieving an accuracy of 98.33%, demonstrating the best gait detection capability. Compared to DT-SD, AD-FSM, and IFSM, its accuracy is improved by 11.66%, 35%, and 5%, respectively.

[0172] Finally, this embodiment uses gait information detected by dual-threshold gait detection (DT-SD), acceleration differential finite state machine (AD-FSM), improved finite state machine (IFSM), and the adaptive threshold finite state machine (AT-FSM) proposed in this invention to calculate pedestrian stride length and heading, and performs coordinate calculation capability analysis. For 8 sets of data, the pedestrian coordinate information calculated by the four algorithms is statistically analyzed, such as... Figure 6 As shown in Table 4, the positioning error of the calculated trajectory endpoint is as follows:

[0173] Table 4. Track endpoint positioning error (unit: m)

[0174] algorithm Experiment 1 Experiment 2 Experiment 3 Experiment 4 Experiment 5 Experiment 6 Experiment 7 Experiment 8 mean Standard deviation DT-SD 2.1984 1.0343 2.1233 1.7337 1.0550 1.0470 2.2063 3.5674 1.8707 0.9221 AD-FSM 1.8338 1.6222 10.9302 12.4095 1.8194 2.8490 6.8757 13.6350 6.4969 5.1603 IFSM 1.4686 1.5437 1.2174 1.6783 0.7616 1.0006 1.2953 3.2226 1.5235 0.7478 AT-FSM 0.7070 0.8713 0.6842 0.4923 0.6127 0.5992 0.9815 0.9656 0.7392 0.1805

[0175] observe Figure 6 As shown in Table 3, AD-FSM has relatively large positioning errors and standard deviations, indicating poor accuracy and stability. While DT-SD and IFSM have made some improvements, their performance is still inferior to AT-FSM. AT-FSM has the best average positioning error (0.7392m) and average standard deviation (0.1805m), demonstrating the best accuracy and stability, and the best coordinate calculation capability. Compared to DT-SD, AD-FSM, and IFSM, its positioning errors are reduced by 1.1316m, 4.9734m, and 0.7843m, respectively, and its standard deviations are reduced by 0.7416m, 4.9798m, and 0.5673m, respectively.

[0176] Therefore, this invention employs a finite state machine gait detection method based on arithmetic optimization algorithm. Based on the changing trend of the resultant acceleration within the gait cycle, the step is divided into multiple discrete states. A fitness function is constructed based on the step deviation rate to search for the optimal undetermined threshold and detect gait information. Combined with an improved Weinberg model and a heading correction model, the method calculates pedestrian step length and heading information, establishes motion equations to reconstruct the pedestrian trajectory, significantly improving gait detection accuracy and effectively enhancing the adaptability and robustness of pedestrian localization.

[0177] Finally, it should be noted that the above description is merely a preferred embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A finite state machine gait detection method based on an arithmetic optimization algorithm, characterized in that, The method comprises the following steps: Step S1, collecting three-axis acceleration and angular velocity based on sensor data collection software MATLAB Mobile; Step S2, smoothing the original data through zero offset correction and Kalman filtering; Step S3, dividing the gait cycle into multiple discrete states based on the smoothed three-axis acceleration, the variation trend of the resultant acceleration in the gait cycle, and the constraint of the peak and valley threshold values, and setting the to-be-determined threshold value; Step S4, constructing an arithmetic optimization algorithm with the step deviation rate as the fitness function to quickly obtain the optimal to-be-determined threshold value, and substituting the threshold value into the finite state machine gait detection to detect the gait information of the pedestrian; Step S5, constructing an improved Weinberg model and a heading correction model based on the gait information and the smoothed three-axis angular velocity information to calculate the step length and the heading information of the pedestrian, and establishing a motion equation to solve the coordinates of the pedestrian.

2. The finite state machine gait detection method based on arithmetic optimization algorithm according to claim 1, characterized in that, The sensor data collection process in step S1 specifically comprises: Collecting three-axis acceleration and angular velocity in the process of pedestrian movement and in the state of the mobile phone being stationary at a sampling rate of 100 HZ based on the sensor data collection software MATLAB Mobile and the built-in accelerometer and gyroscope of the mobile phone.

3. The finite state machine gait detection method based on arithmetic optimization algorithm according to claim 2, characterized in that, The data smoothing process in step S2 specifically comprises: Step S21, calculating the difference between the mean value of each axis and the ideal output in the state of the mobile phone being stationary to obtain the three-axis zero offset error for correction based on the three-axis acceleration and angular velocity in the state of the mobile phone being stationary; Step S22, performing optimal estimation on the system state based on the acceleration and angular velocity after zero offset correction, setting the system observation value as a and the system state quantity as A, and establishing the Kalman filter as: In the formula, K is the Kalman gain, P is the error covariance, and R and Q are noise covariances.

4. The finite state machine gait detection method based on arithmetic optimization algorithm according to claim 3, characterized in that, The gait cycle division process in step S3 specifically comprises: Step S31, dividing each step of the pedestrian into a starting state M0, a first speed increasing state M1, a peak value state M2, a speed decreasing state M3, a valley value state M4, and a second speed increasing state M5 according to the periodic peak and valley values of the resultant acceleration in the process of pedestrian movement; Step S32: Based on the resultant acceleration a at adjacent time points j a j+1 The difference, the number of times the combined acceleration increases positively, t u and negative decrease number t d The expression is as follows: In the formula, A is the judgment threshold value of the difference between adjacent resultant accelerations; Step S33, according to t u , t d and the pending threshold, determine the mutual conversion relationship between states M0-M5, and the conversion relationship is as follows: Let t u = 0, t d = 0, determine whether the starting state M0 enters the first speed-up state M1, the determination condition being: In the formula, A f is a judgment threshold for entering the speed-up state; introducing a sum acceleration peak threshold value A U whether the first speed-up state M1 enters the peak state M2, the judgment condition being In the formula, is a negative frequency decrease threshold value in the speed-up state M1, is a positive frequency increase threshold value in the speed-up state M1. Let t d = 0, the peak state M2 automatically enters the speed reduction state M3; introducing a combined acceleration introduction trough threshold value A D , judging whether the deceleration state M3 enters the trough state M4, the judging condition being: In the formula, T D is a negative direction reduction frequency threshold value in the reduced speed state M3. Let t u = 0, the valley state M4 automatically enters the second speed-up state M5; The judgment condition is that the second speed increasing state M5 returns to the initial state M0. In the formula, is a positive forward increase frequency threshold value in the acceleration state M5. At this point, the pace returns to the initial state M0, and a new round of gait cycle begins.

5. The finite state machine gait detection method based on arithmetic optimization algorithm according to claim 4, characterized in that, The to-be-determined threshold value optimization process in step S4 specifically comprises: Step S41, calculating the step deviation rate based on the real step number RealStep and the detected step number Step, and calculating the fitness Fitness as: Step S42, calculating the mathematical acceleration optimizer MOA and the mathematical probability optimizer MOP; The MOA is used to adjust the step length and direction of the arithmetic optimization algorithm, and the expression is: In the formula, Min and Max are the minimum value and the maximum value of the MOA respectively, CurI is the current iteration number, and MaxI is the maximum iteration number; The MOP is used to adjust the usage frequency of different operators, and the expression is: In the formula, α is the effective accuracy of the iteration process. Step S43, judging the relationship between the random number r1 in [0, 1] and the MOA; when r1>MOA, the algorithm enters the exploration stage; when r1≤MOA, the algorithm enters the development stage; Based on the division operator and the multiplication operator, global exploration is carried out in the exploration area, and the expression in the exploration stage is: In the formula, B j is the position of the current optimal solution, ε is the minimum constant, ub and lb are the upper and lower limits of the threshold to be determined, μ is the control parameter, and r2 is a random number between 0 and 1. Based on the addition operator and the subtraction operator, local optimization is carried out in the development area, and the expression in the development stage is: In the formula, r3 is a random number in [0, 1].

6. The finite state machine gait detection method based on arithmetic optimization algorithm according to claim 5, characterized in that, The pedestrian coordinate solving process in step S5 specifically includes: In step S51, based on the pedestrian step frequency and the resultant acceleration amplitude, the step length is calculated as: where f k is the step frequency of the kth step, are the standard deviation, maximum and minimum of the sum of the accelerations in the kth step of the pedestrian, respectively. In step S52, a complementary filtering model is established, and the three-axis angular velocity is corrected using the normalized three-axis acceleration, and the expression is: where ω x , ω y , ω z are three-axis angular velocities, k f is a proportional coefficient, a x , a y , a z are normalized three-axis accelerations, q0, q1, q2, q3 are quaternions, k e is an error integration coefficient; The updated quaternion is updated using the corrected angular velocity, and the expression is: In the formula, dt is the sampling period; The heading is solved using the quaternion, and the expression is: Step S53, mapping the difference between the heading at the jth moment and the main orientation into the interval [0, Δ], and calculating the offset as: Step S53, mapping the difference between the heading at the jth moment and the main orientation into the interval [0, Δ], and calculating the offset as: In the formula, mod(·) is the remainder function; Based on the offset, a sign function is constructed, and the heading correction is: In the formula, sgn(·) is the sign function, and i is the heading correction amount; In step S54, the pedestrian motion equation is represented as: where (X k ,Y k ) is the coordinate of the kth step, L k 、 is the step length and heading of the kth step, respectively.