# FSM-HSVM-Based Locomotion Mode Recognition for Exoskeleton Robot
## 2 Materials and Methods
### Motion Pattern Recognition Algorithm
#### 2.4.3 Fsm-Hsvm  
The movement of human body is an action sequence consisting of continuous and sequential movements along the time axis. As long as the current motion mode is known, the following motion mode will be constrained. The human-machine movement conforms to the same as human movement, and there will be no unreasonable mode switching. For instance, if the current motion mode is ascending stairs, the locomotion mode can only be ascending stairs or walking on flat ground, and it is impossible to convert directly to going down ramp. Therefore, reasonable transformation should be taken into account when recognizing the locomotion mode, and unreasonable transformation can be eliminated immediately. This paper introduces a finite state machine to construct the exoskeleton movement mode finite state machine framework, so as to make necessary restrictions on the movement modes and their transitions.  
According to actual statistics and research, there are five common motion modes: flat walking (FW), up the stairs (US), down the stairs (DS), up the ramp (UR) and down the ramp (DR). There are only eight corresponding locomotion mode transitions, namely FW\(\rightarrow\)US, US\(\rightarrow\)FW, FW\(\rightarrow\)DS, DS\(\rightarrow\)FW, FW\(\rightarrow\)UR, UR\(\rightarrow\)FW, FW\(\rightarrow\)DR, DR\(\rightarrow\)FW. The transitions between US\(\rightarrow\)DS and UR\(\rightarrow\)DS modes of locomotion does not exist. When the current mode is FW, the next motion mode may be stability mode FW or four other conversion modes, i.e., US, DS, UR and DR. When the current mode is other four motion modes, the motion mode at the next time is either the same stable mode as the previous time or flat mode. Other locomotion mode transitions, such as US\(\rightarrow\)DS and UR\(\rightarrow\)DS are unreasonable and do not exist in the actual environment. Figure 5 depicts the specific finite-state transition diagram of locomotion mode.  
Currently, the finite state machine in reference [19] is only used for mode switching post-processing and is not integrated with the recognition algorithm. This paper proposes a support vector machine algorithm based on finite state machine (FSM-HSVM). By combining the finite state machine with common locomotion modes and the HSVM recognition model, the model transformation framework is established. The algorithm can restrict mutations in the stable locomotion, and significantly enhance recognition efficiency. It can be divided into five rules for the FSM motion mode framework and HSVM recognition model fusion. The specific rules are as follows:  
1. If CurrentState \(=\)\(FW\), NextState \(=\)\(FW,US,DS,UR,DR(HSVM)\)
2. If CurrentState \(=\)\(US\), NextState \(=\)\(US,FW(SVM1)\)
3. If CurrentState \(=\)\(DS\), NextState \(=\)\(DS,FW(SVM3)\)
4. If CurrentState \(=\)\(UR\), NextState \(=\)\(UR,FW(SVM1)\)
5. If CurrentState \(=\)\(DR\), NextState \(=\)\(DR,FW(SVM3)\).  
According to rule 1, the next motion mode can be any of the five locomotion modes when the locomotion mode is flat walking, and the entire HSVM model must be invoked for recognition. According to rule 2, when the locomotion mode is ascending stairs, it can only continue ascending stairs or transition to walking on flat ground. Currently, only one sub-classifier SVM1 is required for recognition. Rules 3, 4 and 5 are identical to rule 2. That is, only rule 1 needs to call the whole HSVM model for recognition. Other rules need to call one sub-classifier to meet the classification requirements. The FSM-HSVM model has no more than (K-1), which is the smallest number among all multi-classification SVM methods.