## 3 Methods
### Gait Intention Detection Strategy  
In this study, the progression of a single gait cycle is categorized into three phases: hip extension, weight shift, and knee flexion.  
Especially, as shown in Figure 4a, the actuator module is aligned with the thigh, allowing the IMU to capture not only the thigh's rotational movement in the sagittal plane but also the rotational movement caused by weight shifts in the coronal plane.  
During the hip extension phase, when the normal leg steps forward, the thigh on the affected side naturally rotates backward. This displacement corresponds to the roll displacement of the IMU connected to the thigh. In other words, the rotation of the IMU's roll axis includes the user's intention to move forward.  
Figure 3: The finite state machine for the KAEGO gait control.  
In the weight shift phase, the center of gravity moves either to the left or right side. This movement is accompanied by a rotation in the pitch direction of the IMU fixed to the thigh, meaning that the rotation of the IMU's pitch axis contains information about the patient's weight shift.  
The final stage, knee flexion, is when the bending of the knee joint naturally begins due to the flexion torque of the hip joint. This stage signifies the transition from the stance phase to the swing phase. In this study, these three continuous rotational displacements are defined as the user's gait intention, and the information from the built-in IMU and knee angle sensor reflects these gait intentions.  
As shown in Figure 4b, the angular displacement of the IMU roll and pitch is linked to hip extension and weight shift motions, respectively. However, there are limitations to processing based solely on angular displacement, as each displacement includes noise and a random offset. Additionally, during walking, various events, such as changes in speed or direction, can occur, and often it is necessary to stop the walking process in response to these events. Therefore, in this study, to classify only motions related to the actual gait intention, angular velocities that periodically meet a minimum threshold are extracted, and only the cumulative result of these is used as a meaningful displacement value. This approach enables the controller to detect unusual movements and respond to emergency situations. The formula below represents the relationship for calculating the cumulative angle from the angular velocity of IMU roll or pitch, where \(\theta\) represents the roll or pitch angle.  
\[\theta_{cum}=\theta_{0}+\sum_{i=1}^{n}[\omega_{i}\times\Delta t\times I( \omega_{i}>\omega_{th})] \tag{1}\]  
Here, \(\theta_{0}\) is the initial angle, \(\theta_{cum}\) is cumulative angle, \(\omega_{i}\) is the angular velocity at the \(i\)-th time interval, \(\omega_{th}\) is the threshold angular velocity, \(\Delta t\) is the time interval (in this case, 10 ms), and the \(I(\omega_{i}>\omega_{th})\) is indicator function, which takes the value 1 when \(\omega_{i}>\omega_{th}\) and 0 otherwise. This function ensures that only the angular velocities exceeding the threshold contribute to the cumulative angle.  
Figure 5 below shows a control block diagram that represents the transition to the pres-swing assist state, which assists the initial knee flexion after recognizing the gait intention, and finally switches to assist mode upon confirming the knee flexion. As illustrated in the control block diagram, abnormal movements can be detected in the process of calculating the cumulative angle, and during the pre-swing state, such movements are distinguished from changes in angular velocity. This approach minimizes the impact of malfunctions or misrecognitions.  
Figure 4: Motion categorization into three phase during a single gait cycle: (**a**) Stepwise motion changes in a gait cycle; (**b**) The angular displacement of the IMU roll, pitch, and knee angle linked to the progression of a single gait cycle, such as hip extension, weight shift, and knee flexion, respectively.