Gait Phase Recognition Using Fuzzy Logic Regulation with Multisensor Data Fusion

The health challenges brought by aging population and chronic noncommunicable diseases are increasingly severe. Scientific physical exercise is of great significance to prevent the occurrence of chronic diseases and subhealth intervention and promote health. However, improper or excessive exercise can cause injury. Research shows that the sports injury rate of people who often exercise is as high as 85%. Aiming at the problem of low accuracy of single sensor gait analysis, a real-time gait detection algorithm based on piezoelectric film and motion sensor is proposed. On this basis, a gait phase recognition method based on fuzzy logic is proposed, which enhances the ability of gait space-time measurement. Experimental results show that the proposed gait modeling method based on ground reaction force (GRF) signal can effectively recognize and quantify various gait patterns. At the same time, the introduction of heterogeneous sensor data fusion technology can effectively make up for the accuracy defects of single sensor measurement and improve the estimation accuracy of gait space-time measurement.


Introduction
In 2019, the World Health Organization (WHO) proposed at the global health assembly that by 2030, the number of people actively participating in sports activities in the world will reach 100 million [1]. Scientific physical activity is one of the most important methods to manage chronic noncommunicable diseases and cope with the aging population. Regular physical exercise is helpful to slow down and prevent the occurrence of chronic diseases and is of great significance to the intervention of subhealth and the promotion of human health. However, improper exercise can lead to injury. Research shows that the sports injury rate of people who often exercise is as high as 85%. Sports activity monitoring provides individuals with health promotion awareness of personal habits. It is very important to accurately track the sports activities in people's daily life.
Walking is one of the most common sports activities in people's daily life. Whether the gait is healthy or not and the degree of health can reflect the health status of human body to a certain extent, therefore, gait evaluation is of great significance and has become a hot issue. The importance of gait analysis has been fully elaborated in many literature, and its application is also very wide, including pedestrian navigation, exercise fitness guidance, pathological gait evaluation, fall detection, exercise rehabilitation, age estimation and gender classification [2], balance functions evaluation [3], Parkinson diagnosis [4], and assessment of running asymmetry [5]. Gait analysis also has broad application prospects in emergency personnel search and rescue, blind path guidance, and other aspects [6]. In the past, gait analysis often relied on the experience of clinicians, and the qualitative evaluation of gait was easily affected by subjective factors. In recent years, large gait analysis systems such as infrared spot catcher, dynamometer, and electromyography have been used for quantitative analysis of human gait [7] in order to quantify the factors controlling lower limb function during walking. There are two gold standards that are often used to quantify gait: (1) 3D motion capture systems based on multicamera/infrared spot catcher [8], such as Vicon system and Qualisys system, which capture the motion trajectory of human body markers, analyze and calculate the three-dimensional space coordinates of markers and obtain the motion parameters of human lower limbs. (2) Instrumented gait [9], such as treadmill system with pressure sensor and GAITRite pressure sensitive gait system, is used to measure and analyze biomechanical signals generated during walking. These systems are large-scale, high-cost, usually deployed in hospitals or professional gait analysis laboratories, and need professional personnel to operate. Long-time gait data recording is usually needed in clinical environment. Experienced clinicians need to interpret and evaluate gait performance in high-dimensional and massive data, which brings great complexity to gait analysis [10].
The rapid development of microelectromechanical system (MEMS) has promoted the application of wearable devices in personal health monitoring. Wearable health monitoring devices are usually composed of multiple physiological sensors and inertial sensors. These sensors are deployed on the human body to realize continuous and dynamic monitoring of the body status, and help people track their health status during exercise and fitness, or better monitor their personal health for medical rehabilitation [11]. The commonly used information in gait analysis include kinematics information and dynamics information. When designing wearable human activity measurement device, physiological sensors such as inertial measurement unit (IMU) and pressure sensor are usually used. IMU is usually deployed on human lower limbs to obtain human kinematic information, but the kinematic information of lower limbs is usually not equivalent to that of whole body. In order to obtain complete and accurate kinematic information, it is necessary to wear multiple IMUs in different parts, such as heel [12], waist [13], instep [14,15], ankle [16][17][18], and thigh and leg [18]. In Reference [19], the influence of the position of inertial sensor on gait analysis is analyzed from the perspective of accuracy and repeatability. It is found that the performance of the algorithm depends on the position of inertial sensor, and the closer IMU is to the ground, the better performance can be obtained for gait event detection. In Reference [20], a foot switch is used to obtain the contact mode, but the binary signal generated by the foot switch cannot capture the subtle difference caused by the transfer of foot weight during walking. Most of the literature used the signals of four pressure sensors to analyze gait events, where the first sensor is located at the thumb, two sensors are located at the forefoot (the first and fifth metatarsals), and the other sensor is located at the heel [21,22].
Although gait analysis algorithms have been widely studied, as far as we know, there is little research on real-time and accurate gait health evaluation using multisensor information fusion technology. Therefore, this paper designs and implements a gait evaluation system based on pressure sensor and inertial measurement unit. Through the collection and analysis of kinematic information and dynamics information, the gait behavior is explained accurately, which provides a richer application basis for future research.
The rest of this paper is organized as follows. In Section 2, the system model and signal composition are described. In Section 3, we propose the gait modeling method to realize gait phase recognition. We propose a gait health evaluation model in Section 4 using IMU-based gait detection, together with the analyses of accuracy and gait health score. Finally, the conclusions are drawn in Section 5.

Signal Acquisition with Heterogeneous Sensors
In view of the limitation that most of the existing researches use a single sensor for gait analysis, this paper designs a small gait detection device, which can monitor the motion state in real time and output the gait evaluation results. It not only cooperatively uses multiple pressure sensors but also uses a mixture of accelerometer and gyroscope for gait analysis. In addition to the dynamic data information, it also makes full use of the data collected by multiple sensors to jointly identify the motion state. As shown in Figure 1, the developed wearable gait analysis system is composed of 8-way pressure sensor, ADC, IMU, MCU, and wireless communication module.
The signal acquisition subsystem consists of inertial measurement unit, pressure sensor, and ADC. In this paper, the sampling frequency of inertial measurement unit and pressure sensor is 50 Hz. A ZNX-01 resistance flexible film pressure sensor is used to collect the ground reaction force signal, and ADC has a 12-bit resolution. The results show that sole and heel are the main biomechanical regions during walking. Therefore, the distribution of 8-way pressure sensors is deployed as shown in Figure 2, where the pressure sensors GRF1-GRF3 are located at the heel, the pressure sensors GRF4-GRF7 are located at the phalanx, and the pressure sensor GRF8 is located at the thumb.
MPU6050 module is used to collect the kinematic data of human walking. The module is a 6-axis digital motion processor (DMP), which can not only greatly reduce the installation space but also connect with external magnetometer. In order to track fast and slow motion accurately, MPU6050 module integrates three-axis MEMS angular velocity sensor (gyroscope) and three-axis MEMS accelerometer. The sensing range of these inertial sensors can be programmed. The analog-to-digital converter of three-axis gyroscope and three-axis accelerometer in MPU6050 module is 16 bits, which can collect the digital output data of human kinematics.
The signal analysis subsystem includes gait phase recognition module and gait cycle segmentation module. The method of coordinate system rotation and attitude quaternion correction is used to improve the measurement accuracy. The wireless communication subsystem uses WiFi as the wireless data transmission mode to transfer the collected data.

Gait Parameters.
Walking is a continuous and regular periodic movement. According to medical standards, gait 2 Journal of Sensors cycle is composed of stance stage and swing stage of a certain lower limb (such as right limb). The stance stage refers to the process when the feet touch the ground while walking, and the swing stage refers to the process when the feet leave the ground and move forward to land again. As shown in Figure 3, according to Perry gait model [23], each gait cycle is divided into eight phases, of which five phases belong to the stance stage, namely, initial contact (IC), loading response (LR), mid stance (MS), terminal stance (TS), and preswing (PS). The other three phases belong to swing stage, which are initial swing (IS), mid swing (MS), and terminal swing (TS). The commonly used gait measurement methods are time measurement and space measurement. Time measurement parameters include gait cycle, cadence, velocity, percentage of stance stage, and percentage of swing stage. The parameter of space measurement is stride length. In the process of walking, normal gait shows reasonable stride length and cadence. Therefore, in gait health assessment, we should first study the parameter range of normal gait and then use it to detect abnormal gait. Gait parameters are defined as follows.
(1) Gait cycle: Gait cycle refers to the time interval between two consecutive events of the same lower limb, usually the time of two consecutive heel landing, also known as stride time For a particular lower limb, the duration of the stance stage and swing stage of different individuals may be completely different. We normalize them to gait cycles. The stance stage accounts for about 60% of the whole gait cycle, and the swing stage accounts for about 40% of the whole gait cycle. In the process of walking, the time percentage of the  3.2. Gait Phase Recognition. The quantification of gait time parameters requires accurate recognition of gait events. The dynamic information of gait phase analysis mainly refers to the ground reaction between the foot and the ground. The embedded pressure sensor can easily detect the ground reaction force generated in the process of movement and directly reflect the overall gait behavior of human body. A detailed description of each gait phase and its corresponding pressure sensor status is as follows.
(1) Initial contact phase: The lower limbs begin to contact the ground, and the GRF1~GRF3 pressure value of heel position is nonzero (2) Loading response stage: The lateral part of the foot of the lower limb begins to contact the ground, and the body center of gravity is transferred from the heel to the whole foot. At this time, the pressure of GRF4~GRF5 is not zero (3) Mid stance phase: The inner side of the lower limb begins to contact the ground, and the pressure value of GRF6~GRF7 is not zero. Due to individual gait differences, GRF8 may or may not have a nonzero pressure value (4) Terminal stance phase: The gravity center of human body moves forward, and the heel of lower limb no longer contacts with the ground; that is, GRF1~GRF3 have zero pressure (5) Preswing phase: It is the last phase of the stance stage, the thumb and toe of the lower limb contact the ground, and at this time, only GRF8 has nonzero pressure (6) Swing phase: The measured lower limbs do not touch the ground, and no pressure signal is detected by GRF1~GRF8 Gait cycle is characterized by gait phases. Accurate detection of gait event/phase is of great significance for gait analysis. In the process of gait phase detection, the transition between adjacent gait phases is very subtle, and it is easy to misjudge each gait phase by using threshold method. In this paper, fuzzy logic algorithm is used to process the original GRF signal to realize the smooth and continuous recognition of gait phase. The gait phase recognition method based on fuzzy reasoning is as follows.
Firstly, the input variables are fuzzed. The sigmoid membership function is used to fuzzify the input GRF signal of each pressure sensor, as shown in Equation (1). According to the value of pressure signal, each pressure value is divided into L and S fuzzy values.
where x is the range of input variables; we use the voltage collected by the piezoelectric sensor as the input; that is, x ∈ ½0, 3:3. The opening direction of the sigmoid function in Equation (1) is determined by the parameter a. The fuzzy value "L" is declared when a is positive and "S" is declared when a is negative. The value "L" means that the corresponding sensor is likely to contact the ground. The value "S" means that the possibility of the sensor contacting the ground is very small. Then, the output variables are fuzzed. Each output variable is fuzzified by trapezoidal membership function and triangular membership function, and then, it is judged as one of the six fuzzy values of IC, LR, MS, TS, PS, and SW. The member functions are as follows.
where y is the output variable. The shape of membership function in Equation (2)   Journal of Sensors used for fuzzy sets IC and SW, and triangular membership function is used for other fuzzy sets, as shown in Figure 4. Next, we will establish the fuzzy inference rules by using the change of pressure sensor signal and the landing position information that may appear in each gait phase as fuzzy rules. There are 8 output variables for 8-way pressure sensors, and each variable has two possible values, so there are totally 2 8 = 256 fuzzy inference rules can be constructed. The formulation of fuzzy inference rules is the core content of fuzzy logic reasoning, and its performance depends on fuzzy inference rules to a great extent. We only use the rules with the greatest contribution to distinguish the possible phases and form the fuzzy inference rule table as shown in Table 1.
The form of fuzzy inference rule is "if... Then". For example, rule #10 can be described as "(GRF1 is S) and (GRF2 is S) and (GRF3 is S) and (GRF4 is S) and (GRF5 is S) and (GRF6 is S) and (GRF7 is S) and (GRF8 is S), then the gait phase is SW". The expression of fuzzy inference rules is complex, which is usually expressed by fuzzy inference rule matrix. For example, the rule vector corresponding to rule #10 is [2 2 2 2 2 2 2 2 6 1 1].
Finally, the fuzzy logic output is obtained. The average maximum membership method is used to solve the problem of multiple output maximum membership elements, and the corresponding fuzzy inference results are obtained through defuzzification operation as the following equation.
where N is the total number of elements with the same maximum membership.
Journal of Sensors 3.3. Gait Cycle Segmentation. Accurate detection of key gait events is essential to the evaluation of gait. When we have detected continuous and smooth gait phases, we will segment them into gait cycles. Because of the difference of gait cycle composition among different people, the fixed threshold method cannot get accurate results. In this paper, a personalized gait cycle segmentation algorithm is proposed, which takes full account of the differences of individual gait cycle composition and uses fuzzy logic inference to get accurate gait cycle information.
The flow chart of the proposed gait cycle segmentation algorithm is shown in Figure 5. We have found that plantar pressure signal has obvious time-domain characteristics. Therefore, we analyze the gait phase signal X = ½x 1 , x 2 , ⋯, x i , x i+1 , ⋯, x n after fuzzy processing in time-domain, which corresponds to a certain gait phase.
(1) Determine the starting point of gait phase Accurate detection and marking of gait event transition from one gait phase to another is the premise of accurate gait cycle segmentation. In this paper, real-time gait phase output can be obtained according to the collected pressure signal. Gait phase transition can be declared when x i+1 − x i ≠ 0, and this position can be regarded as the starting point of the following gait phase. The starting point sequence of gait phase is recorded as the following equation.
(2) Obtain gait phase duration In the starting point sequence of gait phase, the duration of current gait phase is equal to the time interval between adjacent elements, which can be calculated as follows:   The initial gait cycle is segmented by using the sequence of gait phase starting points obtained in Step 1, and the composition and duration of each gait cycle are obtained as follows.
(a) The gait cycle begins at the stance phase. Therefore, the first detected gait phase that is different from the swing stage behind the swing stage is regarded as the beginning of the gait cycle. We can get the starting point sequence of N + 1 gait cycles  Table 2. During the experiment, all subjects walk in a straight line independently at a comfortable speed, and they can turn back and forth at will. There is no limit to the distance of straight line walking. Considering that the first step and the last step of each walk may not be a complete gait cycle, we remove these two incomplete gait cycles in the subsequent gait analysis.

Experimental
Results and Performance Analysis. In Figure 6, the traditional gait cycle segmentation algorithm based on empirical formula is compared with the proposed algorithm. The proposed algorithm identifies the key gait event heel strike (HS) and key gait event toe off (TO) in the gait cycle and divides each gait cycle into two phases. In Figure 6, the red circle represents the key gait event HS, and the red pentagon represents the key gait event TO. The gait modeling algorithm based on ground response signal is shown in Figure 7. As mentioned above, accurate detection of the starting point of gait cycle is the key to accurate recognition of gait cycle. In Figure 7, the red circle is the starting point of each gait cycle. The gait phase sequence of most gait cycles is the same as Perry gait model, i.e., IC > MS > PS > SW, but the duration of gait phase sequence of each gait cycle is different. Some gait cycles show different gait phase sequences from Perry gait model; for example, some of them may lack a certain gait phase, and some of them may have disorder gait phases. It can be seen from Figure 7 that the proposed gait modeling algorithm does not need to set the offset between each gait stage in advance. The algorithm can not only detect gait phase accurately and effectively but also recognize different types of gait cycle, which shows that the algorithm has strong adaptability to different groups of people, regardless of the age, gender, height, and weight of the subjects. Figure 8 shows the frequency histogram of 446 gait cycles. The red dotted line indicates the threshold for identifying short periods. The duration of each gait cycle may be inconsistent. Regardless of the number of gait phases in each gait cycle, if the duration of a gait cycle is less than 0.75 times of the average duration, we regard it as a short cycle. It can be seen from Figure 8 that the threshold adopted can effectively identify the period with short duration and facilitate the subsequent integration of continuous short periods. It 7 Journal of Sensors is worth mentioning that the algorithm proposed in this paper has good robustness and has achieved good results in the subsequent gait modeling. Figures 9 and 10 show examples of two consecutive short periods, wherein the purple solid line identifies the first short period and the red solid line identifies the second short period. In Figures 9 and 10, we can see that the duration of some phases in the gait cycle is too short, which will lead to the emergence of short cycles. Specifically, the first short period in Figure 9 lacks PS phase, the duration of SW phase is too short, and the second short period lacks IC phase and MS phase. Although the first short cycle in Figure 10 contains a complete gait phases, the duration of the IC phase, PS phase, and SW phase is too short. The appearance of a continuous short period is often accompanied by the abnormal mutation point of swing phase, which is due to the error caused by the high sensitivity of the pressure sensor in collecting the ground reaction force signal. If there are continuous short periods, no matter whether the number of phases in the gait period is complete or not, we will combine the continuous short periods to improve the accuracy of the gait period recognition. The acceleration data measured by the three-axis accelerometer is mapped into the corresponding reference coordinate system, and the velocity value can be obtained by one-time integration. The stride length can be obtained by integration of velocity; that is to say, the stride length can be obtained by quadratic integral of acceleration signal. In practical application, because of the noise and drift of the sensor, the stride obtained by directly integrating of velocity has a drift error. In the process of space measurement, resetting the integral window regularly can effectively alleviate the imprecision caused by error integral.
Most sports, such as walking and running, have identifiable repetition periods. In the process of activity, a gait cycle starts when the foot just touches the ground, and usually, the heel touches the ground first, which will cause a large peak acceleration and then vibration. In the stance stage, there is only a small duration of time when the foot fully contacts the ground. At this time, the foot and the ground are relatively static and the velocity is almost zero. These short periods are often referred to as the full standing phase and occur before the foot enters the swing phase. ZVU algorithm makes full use of the zero velocity information of the foot to   9 Journal of Sensors correct the self-cumulative error by inputting the gait segmentation results; that is, when in the mid stance phase, the instantaneous speed is 0. ZVU algorithm is only suitable for the case of IMU on the foot, and its effectiveness depends on the detection of the zero velocity moment. The improved integration method is used to estimate the space measurement of gait. The flow chart of the algorithm is as follows.
(1) Step 1: Map the acceleration data measured by the three-axis accelerometer to the world coordinate system to obtain the acceleration value a W ðtÞ in the world coordinate system (2) Step 2: Eliminate the influence of gravity acceleration to get the acceleration caused by motion (3) Step 3: Integrate the acceleration caused by motion in the world coordinate system to obtain the instantaneous velocity in the process of motion where ½T 1 , T 2 represents the sampling period. (4) Step 4: After modeling the individual gait, when full stance is detected, ZVU algorithm is used to eliminate the instantaneous speed estimation error and the stride estimation error is also eliminated. Next, we describe the implementation of ZVU algorithm Because of the intrinsic measurement error of the acceleration sensor, the acceleration data of each movement stage in the gait cycle consists of two parts: where a e a ðtÞ is the acceleration value caused by the real motion, ε is the drift error of the sensor, and T is the duration of each motion stage. Assuming that the drift error is constant in time 0~T, it can be regarded as a constant. Then, the speed of the foot before entering the full stance phase can be calculated by the following formula: In Step 3, there is an error in the estimation of the instantaneous step speed. v e a ðtÞ is the instantaneous speed caused by actual motion, and εt is the speed error caused by drift error integral. When the foot enters the full stance stage of the following gait cycle, that is to say, when the foot contacts the ground completely once again, the instantaneous speed caused by the actual motion should be 0. The difference between the actual instantaneous speed and the nonzero v e m ðTÞ obtained by integration is used to  Journal of Sensors correct the acceleration drift error, and the drift error ε in a gait cycle can be estimated as follows: Then, the operation in Step 3 is used to integrate the corrected real acceleration value to obtain the instantaneous walking speed. (5) Step 5: Integrating the corrected instantaneous step speed obtained in Step 4 once more to obtain the corresponding estimated position 4.2. Gait Health Evaluation Model. The purpose of gait health evaluation is to establish a model that can identify the gait health status of different groups of people. On this basis, a quantitative evaluation model of gait health is constructed. Gait health evaluation is achieved by measuring the symmetry and homogeneity of gait. Gait disorder can affect the symmetry and homogeneity of gait. Symmetry indicates the similarity between the pressure signal and inertia signal measured by the left feet and right feet at each step, and homogeneity indicates the time repeatability of the same pressure mode and inertia mode between two adjacent steps of the same lower limb. In this paper, the monopedal gait analysis method is adopted, so the gait is evaluated by the homogeneity of gait, and the degree of abnormal gait is indicated by the range of departure from normal gait parameters. The flow of gait health evaluation algorithm is shown in Figure 11.
(1)  (1) Case 1: The subjects walk freely until they reach a fixed location, and the walking distance is fixed at 0.6 m (2) Case 2: The subjects walk in a straight line at their comfortable speed, they may turn back and forth freely, and the straight line walking distance is not limited 4.3.2. Experimental Results and Performance Analysis. Figure 12 shows the deviation between the actual stride length and the single stride length measured by the proposed algorithm. The gait cycle starts from the starting of stance phase and ends at the beginning of the next gait cycle. The length of gray line segment in the graph indicates the degree of deviation, and it can be found that the deviation between them is less than 4.7%. Although there is no special research in the long-term experiment, the algorithm has no obvious error accumulation in the 5-minute walking process. This is due to the introduction of ZVU algorithm in the spatial metric estimation and accurate zero speed detection, which can effectively suppress the error accumulation. Table 3 shows the gait evaluation results of each subject walking during 1 minute. We can see that the accuracy of the proposed algorithm is almost 100%, proving that it can be used for the subsequent time-space parameter analysis for gait. The accuracy of cadence is also relatively high, close to 100%. The average velocity and cadence of the experimental subjects are low, and the number of abnormal gait cycles is also at a low level. This is because most of the subjects choose a slower walking speed during the test. Gait health score is defined as the proportion of normal gait cycles to the total number of gait cycles multiplied by 100.

Conclusion
This paper presents a gait detection algorithm based on multisensor information fusion technology. The pressure sensor is used to collect the human body dynamics information, and the inertial measurement unit is used to collect the human body kinematics information to detect the temporal and spatial parameters of gait. Aiming at the problem that the traditional threshold-based gait phase recognition algorithm cannot distinguish the subtle changes between gait phases, a gait phase recognition algorithm based on fuzzy logic reasoning is adopted to realize the smooth and continuous recognition of gait phases. In order to overcome the attitude calculation error caused by inertial module measurement error and noise, quaternion correction and complementary filtering are used to correct the measurement accuracy and combined with zero speed update technology to suppress the accumulation of inertial module measurement error. The experimental data show that the gait evaluation algorithm based on heterogeneous sensor data fusion   Journal of Sensors can significantly improve the accuracy of gait spatiotemporal parameters and provide support for gait health evaluation.
In the future, we will study more applications based on gait detection parameters, such as quantitative detection of energy consumption, fall prediction, and sports injury risk early warning.

Data Availability
The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
The authors declare that they have no conflicts of interest.