# Gait Phase Identification and Damping Control for Knee Orthosis Using Time Series Forest Classifier
## 3 Gait Phase Segregation and Percentage Share  
IMU data acquisition involves the use of footswitch data acquired simultaneously with two different IMUs' angular displacement and acceleration of the right leg for labeling the gait phases. A frequency distribution analysis is performed on the labeled data and an averaged gait percentage share is obtained. This helps to identify the share of each gait subphase in one gait cycle and its relative importance, and is combined with the simulated knee moment. This acts as a marker for the time period when the knee joint is under strain. The IMU Adafruit BNO085 is equipped with a 9-DoF (degrees of freedom) sensor fusion algorithm, incorporating data from the accelerometer, gyroscope, and magnetometer. Combining the data from multiple sensors provides orientation estimates that are more accurate and reliable, effectively reducing the likelihood of a gimbal lock. Furthermore, it has autocalibration support, allowing continuous updating of calibration parameters to compensate for factors such as temperature variations or sensor aging. The sensor is accompanied by a proprietary motion engine that utilizes the Mahony and Madgwick sensor fusion algorithms. These algorithms estimate orientation by considering sensor biases, noise, and other characteristics, resulting in enhanced accuracy and stability. A normalized gait cycle is obtained with a percentage share of each phase. Together, these two sets of information are used to obtain the gait phase activation cycle with the corresponding magnitude. Roll, pitch, and yaw associated with IMUs with units in degrees are collected from the sensor's onboard motion engine along with acceleration along the three axes to make the model more generalized when analyzing actual gait, which has variations in data output from two IMUs mounted on the thigh and shin of the right leg (only right leg is considered for data collection and testing) shown in Table 2.  
The knee flexion is captured with a pair of IMUs mounted on the thigh and shin, shown in Figure 7, with X1 and X2 denoting angular displacement along the transverse \begin{table}
\begin{tabular}{c c c c c c c c c c c c c} \hline \hline  & & \multicolumn{3}{c}{IMU-1 (Thigh)} & & & & & \multicolumn{3}{c}{IMU-2 (Shin)} & \\ \hline R\({}_{i}\) & P\({}_{i}\) & Y\({}_{i}\) & X\({}_{ii}\) & Y\({}_{ii}\) & Z\({}_{ii}\) & R\({}_{2}\) & P\({}_{2}\) & Y\({}_{2}\) & X\({}_{22}\) & Y\({}_{22}\) & Z\({}_{22}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Headers for data collection. Figure 6: Normalized, phase-shifted, and scaled knee moments. plane, Y1 and Y2 denoting angular displacement along the sagittal plane, and Z1 and Z2 denoting angular displacement along the frontal plane. The use of four-foot switches, two for each leg mounted on the sole under the heel and ball, is shown in Figure 8, toggling between active and inactive states, resulting in permutations of 24 binary states. In a normal gait, seven distinct combinations are identified, excluding the standing-still condition where full feet support is present. Some momentary states are excluded, which arise during the transition from one phase to another, and the remaining impossible states, which are not possible, are identified as shown in Table 3, where the foot switches mounted on the left leg are labeled as L\({}_{10}\) and L\({}_{20}\) for the ball and heel mounted switches, whereas R\({}_{10}\) and R\({}_{20}\) are the right leg ball and heel mounted switches. The resolution of gait when segregated with foot switches causes some of the gait to merge in a single state, as depicted in states 2, 4, and 13, whereas certain gait phases are skewed and are identified by demarking them as starting and ending states, as depicted in states 5 and 9. The dataset description is given in Table 4. The gait is divided into seven different phases, which is shown in Figure 9.  
Figure 8: Foot switch placement. Figure 7: IMU placement and axial description.