# FSM-HSVM-Based Locomotion Mode Recognition for Exoskeleton Robot
## 2 Materials and Methods
### Motion Pattern Recognition Algorithm
#### 2.4.1 Hierarchical Support Vector Machine Classifier (HSVM)

Table 1: The comparison of the training and classification complexity of the multi-classification SVM. the points on the time axis. According to the research, the cycle length of human walking is not fixed, and the cycle length under the five different motion modes is also obviously different, leading to the fact that the time series cannot correspond one by one, so the Euclidean distance cannot be solved in this case. At this time, we can further analyze the change trend and duration of the gait cycle by using the DTW algorithm [33], and deeply analyze the similarity of data of two consecutive gait cycles based on the continuity of time. To compare the similarity of two sets of data, the distortion of their corresponding frames must be calculated. The smaller the distortion, the higher the similarity. Because the total number of frames in two segments of gait cycle data is typically different, the signal value sequence must be re-aligned in time. The algorithm for dynamic time warping can effectively solve this data comparison problem. In other words, the data sequence of the smaller total frame number is mapped to the data sequence of the larger total frame number, and the degree of distortion between the newly corresponding frames is calculated and added. Next, the complete data of one cycle under five motion modes are intercepted separately to calculate the DTW distance, as shown in Table 2, in order to investigate the similarity between various locomotion modes. As shown in the table above, the most recent data groups for the five terrain types are: [FW, DR], [US, UR], [DS, DR], [UR, US], [DR, DS]. As shown in Figure 4, the five motion modes can be subdivided according to the tree structure to establish the hierarchical structure in HSVM. As shown in Figure 3, the classification procedure involves hierarchical decision-making and gradual subdivision. First of all, five motion modes can be divided into two major categories by first classifier SVM1 according to DTW distance. The first category includes up stairs and up ramps, while the second category includes three modes: flat walking, down stairs and down ramp. Then, the classifier SVM2 is used to identify up the stairs and up the ramp, and SVM3 is used to further divide the second category into \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Terrains** & **FW** & **US** & **DS** & **UR** & **DR** \\ \hline FW & 0 & 428.261 & 451.527 & 451.113 & 319.962 \\ \hline US & 428.261 & 0 & 391.622 & 295.413 & 355.106 \\ \hline DS & 451.527 & 391.622 & 0 & 462.905 & 302.851 \\ \hline UR & 451.113 & 295.413 & 462.905 & 0 & 377.584 \\ \hline DR & 319.962 & 355.106 & 302.851 & 377.584 & 0 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: The DTW distance for different locomotion modes. Figure 4: Segmentation of different locomotion modes by HSVM. L and {DS, DR}. Ultimately, the forth classifier SVM4 is utilized to differentiate between DS and DR. So far, four classifiers have been used to separate the five motion patterns. The penalty coefficient c and the kernel function parameter \(\sigma\) will have a significant effect on the accuracy of these binary classifiers. In this paper, specific values of c and \(\sigma\) are screened using the grid method, which is easy to implement and does not require manual adjustment.