# Motion Rehabilitation Robot Control Based on Human Posture Information

Authors: Guangfeng He
Journal: Journal of Sensors
 (2022)

---

## Abstract

In order to meet the needs of postoperative rehabilitation training of lower limbs, a motion rehabilitation robot control system based on human posture information is proposed in this paper. The functions of active/passive training mode control, movement posture and EMG signal acquisition, WiFi communication, safety protection, etc. of the lower limb rehabilitation robot are realized. The recognition and analysis of the training process are realized by using random forest machine learning algorithm and linear regression algorithm. The experimental results show that in the first row of the confusion matrix of the random forest algorithm, 7316 data are correctly identified as speeda and only one data is incorrectly identified as speed B, which is superior to other algorithms. In conclusion, the developed control and monitoring system of lower limb rehabilitation robot can be portable controlled by Android and can realize intelligent analysis of the training process through the monitoring signals in the training process. At the same time, the random forest algorithm has more advantages than the linear regression algorithm in motion recognition, which is of positive significance to the automatic monitoring and intelligent control of the training process.


---

## Body

## 1. Introduction

The ideal way for stroke patients to recover their motor ability is to use rehabilitation training to recover their motor function, while the traditional rehabilitation training is for doctors to hold the patient’s affected limb and assist the patient to exercise by using simple instruments or various techniques. This training method has the following problems: first, the training process is boring, the patients receive the training passively, the active consciousness is not strong, and the effect is not good. Second, the labor intensity of rehabilitation doctors is very high, which affects the efficiency of rehabilitation training. Third, the effect of rehabilitation depends on the experience and level of rehabilitation doctors to a great extent. Fourth, the process of rehabilitation is based on qualitative observation, lacking objective monitoring basis, which is not conducive to the further determination of treatment plan. Fifth, there is no objective rehabilitation evaluation index, so it is impossible to conduct in-depth study on the neurorehabilitation law of patients [1]. Based on the above points, it is extremely urgent to find a convenient and effective means of rehabilitation training to enable patients to recover their active sports ability, improve their quality of life, and reduce the burden on families and society. With the continuous progress of science and technology and the in-depth application of automated robots, the field of rehabilitation medicine is gradually using robots to train patients with motor dysfunction, which can significantly improve the loss of motor function caused by nervous system damage (such as stroke, trauma, and spinal injury), as shown in Figure 1 [2]. Using robot technology to evaluate, reconstruct, and improve the movement ability of patients’ limbs has become a hot topic in domestic research. Therefore, the research on the control technology of medical rehabilitation robot is of great significance. Referring to the relevant technologies of industrial automation robots and combining the characteristics of medical robots, the medical rehabilitation robots first tried to commercialize robots that serve people with limb movement difficulties after the 1960s. After the test of practice, these attempts ended in failure [3]. The main reasons are as follows: first, the man-machine interface design is not ideal, and the installation and wearing cannot be completed by nonprofessionals. The second reason is the cost. At that time, the robot technology was not popularized, resulting in the high unit price of products, which patients could not afford.Figure 1
Rehabilitation robot.


## 2. Literature Review

Assad UZ Zaman and others found that there are nerve centers for coordinated movement of upper and lower limbs in the human body. Through scientific coordinated training of upper and lower limbs, the rehabilitation of injuries can be more effectively promoted [4]. Chen and others designed and completed the first upper limb rehabilitation robot. The robot is composed of two linkage mechanisms. Patients need to hold the end of the robot during training, and the robot drives them to complete rehabilitation training. The robot adopts the impedance control principle and can realize the smooth and compliant movement of the end point of the mechanism. The robot can collect and store the rehabilitation data of patients and provide help for the formulation of rehabilitation programs [5]. Yuvaraj and others designed a three degree of freedom arm guide for upper limb rehabilitation robot. The robot has a simple structure, can provide patients with multidirectional linear rehabilitation movement, and can also collect and store the rehabilitation movement information of patients. Because of its huge size and poor flexibility, it can only carry out limited training [6]. Li and others designed a prototype of a lower limb rehabilitation robot. In the aspect of mechanical design, the researchers designed the structure of the robot according to the different human body sizes of different patients, ensuring the coaxiality of human joints and robot joints during training [7]. Liu and others designed an active and passive rehabilitation robot for upper and lower limbs. The robot has a simple structure, and the upper and lower limb systems have two rotational degrees of freedom. The robot uses the single chip microcomputer as the main controller and adopts the double closed-loop PID control method of current loop and speed loop to control the motor speed and torque. Finally, four training modes of passive, active, active assistance, and resistance are realized [8]. Raj and others designed a limb coordinated rehabilitation robot. The upper limb training system of the robot is a five-bar mechanism with end traction, which has two degrees of freedom. The lower limb is a bicycle mechanism with single degrees of freedom. The coordinated movement of the upper and lower limbs is realized through the coordinated control of the upper and lower limb systems. The robot has three postures: lying, sitting, and standing. It can realize adaptive passive training and impedance active training, but the training track is single [9]. Li and others designed an upper and lower limb rehabilitation robot. The robot has eight degrees of freedom including shoulder joint, hip joint, knee joint, and ankle joint. The passive linkage position control of the upper and lower limbs is realized by pole placement method. The robot has few degrees of freedom of upper limbs and cannot follow the patient well. Moreover, the rehabilitation mode is relatively simple, and the control system is simple [10]. In this paper, the monitoring technology of training mode control process of lower limb rehabilitation robot is studied, in order to realize the intelligent portable control of training process and the intelligent recognition analysis of training process and lay the foundation for the intelligent control of lower limb rehabilitation robot.


## 3. Research Methods

### 3.1. System Structure and Hardware Design

#### 3.1.1. Lower Limb Rehabilitation Mechanical Structure

The lower limb rehabilitation robot serves patients with lower limb motor dysfunction. In order to avoid secondary injury to patients, the safety of the lower limb rehabilitation robot should be improved from all aspects of the control system [11]. The control system is divided into hardware system and software system. The hardware system is the bridge between the software system and the robot mechanical body. It is particularly important to build a reasonable hardware system. The software system should be designed with beautiful interface, convenient operation, and comprehensive functions, so as to better realize the value of the rehabilitation robot [12]. As a member of medical devices, rehabilitation robot must meet the requirements of electromagnetic compatibility. The lower limb rehabilitation robot actuator developed in this paper realizes the active and passive training functions of the lower limb according to the rehabilitation needs of the knee joint after operation. Each leg module has 3 degrees of freedom, corresponding to the hip, knee, and ankle on the sagittal plane of the human body. In order to meet the needs of patients with different heights, the thigh length and calf length in the leg module are designed to be adjustable. In order to meet the needs of different obese and thin patients, the width between the leg module and the seat is designed to be adjustable. In order to meet the needs of patients with different conditions, the angle of the seat back is designed to be adjustable, so that patients can train in lying posture and sitting posture. In order to facilitate patients’ training, the seat is designed to be movable, and universal wheels are installed below. The seat can be separated from the lower limb rehabilitation robot. After the patient sits on the seat, push the seat into the robot and lock it [13]. All adjustment functions are realized by electric adjustment. The knee joint is mainly composed of the lower femur, the upper tibia and the patella. The maximum angle of motion of the knee joint in a normal human body is about 70°. The mechanical structure of the lower limb rehabilitation robot designed in this paper realizes the rotation movement by using the rotating pair. The range of motion of the knee joint is shown in Table 1.Table 1
Range of motion of knee joint.
JointActivity statusMaximum angle (°)Maximum range (°)Comfort range (°)Knee jointFlexion and extension1300~1300~70Knee flexion pronation300~300~8Knee flexion external rotation450~450~8Through the simulation of the motion range of the actuator of the lower limb rehabilitation robot with ADAMS software, the results show that the change range of the joint angle basically conforms to the range of human motion comfort, and the system structure basically conforms to the rehabilitation effect, which can help the user automatically complete the rehabilitation training process, as shown in Figure2.Figure 2
Adams motion range simulation.


#### 3.1.2. Design and Implementation of Training Control

(1) Training Control Process. In the passive training mode, the target speed of the motor is set first, and the user passively follows the training during the training. The intensity of the training process can be adjusted. After completing a rehabilitation training, the robot stops and saves the rehabilitation training data [14]. In the active training mode, the user is required to make active efforts. When the lower limb muscle strength of the user is insufficient to achieve the predetermined goal, the robot assists the patient to complete the corresponding training. After completing a rehabilitation training, the robot stops and saves the rehabilitation training data. The control flow is shown in Figure 3.Figure 3
Control flow of lower limb rehabilitation robot.(2) System Hardware Mechanism. After the rehabilitation training control program is determined, the hardware part is selected and designed. For the normal operation of the equipment, the peripheral module circuit is used to meet the design requirements. The hardware control system structure of the system includes the single-chip microcomputer controller, power module, data communication module, upper computer industrial control host, data acquisition module, and execution module [15].(3) Control Circuit Design. According to the requirements of training control process, power supply, clock, reset, signal acquisition, motor drive, communication and other circuits are designed.STM32 is selected as the main control chip to realize the stable and accurate control of the lower limb rehabilitation robot [16]. The reset circuit is mainly used to restart the system and keep the system stable. The clock circuit can produce accurate oscillation circuit to ensure the accuracy of the system. At the same time, the system also designs a debugging interface, which can facilitate the single-step debugging of the control system program and facilitate the control, development, and debugging of the rehabilitation robot. The RS-485 serial bus communication is used to realize the information exchange between the upper computer and STM32 controller. Mc33931 chip produced by Freescale Semiconductor Co., Ltd. is used as the motor drive chip, which has the function of controlling inductive load. Its maximum current can reach 5A. By default, the enable pin is set to high level, and three pins IN1, IN2, and FB are used to control the motor motion mode [17]. The specific control mode is shown in Table 2.Table 2
Motor control logic.
PC8_MC_IN1PC9_MC_IN2PC3_MC_FBMotor status10PWMSpeed regulation forward rotation01PWMSpeed regulation reverse00PWM/0Stall11PWM/0Stop(4) Design of Wireless Communication Circuit. A WiFi module has the advantages of fast transmission speed, supporting multiperson connection, and long communication distance and can support web page and app configuration. Esp-m1 chip is selected in the system. The TXD pin of the chip is connected with the RX pin in the STM32 main controller, and the RXD pin of the ESP chip is connected with the TX pin of the STM32 main controller serial port. By default, the esp-m1 chip is enabled. The program initialization of the STM32 main controller determines the use of the module. The NRST pin of the chip is pulled up with 3.3 V voltage. When the pin level is pulled down, the chip resets.


### 3.2. Software Design of Control System Based on Android

The lower limb rehabilitation robot software system developed on Android platform improves the controllability and practicability of the system. According to the overall scheme of the rehabilitation robot, the system realizes the functions of registration, training mode selection and control, monitoring data management, and so on. The operation interface is simple and improves the human-computer interaction ability [18]. The socket connection is made between the mobile phone and the esp-m1 chip on the control board. Based on the TCP/ip protocol, the request command can be sent through the remote control end of the Android mobile phone. When the controller receives the information sent by the mobile phone to the esp-m1 module, it sends the action command to drive the circuit to control the rehabilitation robot to perform the rehabilitation movement. Using Android control platform, the experiment of lower limb rehabilitation robot in passive training mode is carried out. By setting the joint training speed, the operation effect of the equipment is verified, and the training parameters and training progress can be seen through the mobile phone interface. The acquisition card is used to collect the pulse signal fed back by the encoder, and the sampling frequency is 50 Hz, which preliminarily verifies the stability of the system. In the active training mode, when the patient’s strength is not enough, the rehabilitation robot will judge for 2 s. When the patient does not reach the training speed, the rehabilitation robot will assist the patient in movement to meet the movement requirements [19].


### 3.3. Recognition of Training Process Based on Random Forest

Random forest is a strong classifier composed of multiple weak classifiers (decision trees) based on the bootstrap aggregation method. Firstly, the bootstrap method is used to sample and construct subtraining datasets. Each subtraining dataset constructs a decision tree, and then the characteristic parameters are randomly selected to train the decision tree. Each decision tree is irrelevant to each other. When making a decision, the decision results of multiple decision tree classifiers are voted to obtain the final result [20]. The recognition performance of random forest is higher than that of single decision tree, and overcomes the over fitting problem of decision tree. At the same time, due to the use of random sampling, the training model has small variance and strong generalization ability and is robust to missing data and unbalanced data.The random forest algorithm proposed in this paper adopts a feature selection method based on Gini coefficient and a classification and regression trees (CART) decision tree. Gini coefficient represents the chaos degree of the model. The smaller the Gini coefficient, the smaller the chaos degree. The feature with the smallest Gini coefficient is selected so that all samples of each child node belong to one classification as far as possible. The Gini coefficient of the probability distribution is as follows:(1)Ginip=2p1−p.For sample setD, after traversing all the segmentation points of feature parameter A, sample set D is divided into two parts by using the relationship between feature parameter and threshold (TA) (A>TA), that is, sample set D1 satisfying A>TA and sample set D2 not satisfying A>TA. When A>TA, the Gini index of sample set D is the following formula:
(2)GiniD,A=D1DGiniD1+D2DGiniD2,where GiniD1 and GiniD2 represent the uncertainty of sample set D1 and D2, respectively, and GiniD,A represents the uncertainty of set d after A>TA division.CART decision tree is a binary tree. According to the different numerical characteristics of dependent variables in the dataset, regression tree, and classification tree can be constructed, respectively. The construction method of classification tree is as follows.(1)
The subdatasets are obtained through the self-help method, and the feature parameters are randomly selected as the division features of the classification tree nodes. For each feature parameterA selected, all possible thresholds TA are taken, and the Gini coefficients of the subdatasets divided by A>TA are calculated. The feature parameters with the smallest Gini coefficients and their corresponding thresholds are selected as the feature division points of the node(2)
If the number of samples in the node or the depth of the tree reaches the requirements, the construction of the classification tree ends and the CART decision tree that has been successfully constructed is returned. Otherwise, step 1 is recursively executed for the two child nodes


## 3.1. System Structure and Hardware Design

### 3.1.1. Lower Limb Rehabilitation Mechanical Structure

The lower limb rehabilitation robot serves patients with lower limb motor dysfunction. In order to avoid secondary injury to patients, the safety of the lower limb rehabilitation robot should be improved from all aspects of the control system [11]. The control system is divided into hardware system and software system. The hardware system is the bridge between the software system and the robot mechanical body. It is particularly important to build a reasonable hardware system. The software system should be designed with beautiful interface, convenient operation, and comprehensive functions, so as to better realize the value of the rehabilitation robot [12]. As a member of medical devices, rehabilitation robot must meet the requirements of electromagnetic compatibility. The lower limb rehabilitation robot actuator developed in this paper realizes the active and passive training functions of the lower limb according to the rehabilitation needs of the knee joint after operation. Each leg module has 3 degrees of freedom, corresponding to the hip, knee, and ankle on the sagittal plane of the human body. In order to meet the needs of patients with different heights, the thigh length and calf length in the leg module are designed to be adjustable. In order to meet the needs of different obese and thin patients, the width between the leg module and the seat is designed to be adjustable. In order to meet the needs of patients with different conditions, the angle of the seat back is designed to be adjustable, so that patients can train in lying posture and sitting posture. In order to facilitate patients’ training, the seat is designed to be movable, and universal wheels are installed below. The seat can be separated from the lower limb rehabilitation robot. After the patient sits on the seat, push the seat into the robot and lock it [13]. All adjustment functions are realized by electric adjustment. The knee joint is mainly composed of the lower femur, the upper tibia and the patella. The maximum angle of motion of the knee joint in a normal human body is about 70°. The mechanical structure of the lower limb rehabilitation robot designed in this paper realizes the rotation movement by using the rotating pair. The range of motion of the knee joint is shown in Table 1.Table 1
Range of motion of knee joint.
JointActivity statusMaximum angle (°)Maximum range (°)Comfort range (°)Knee jointFlexion and extension1300~1300~70Knee flexion pronation300~300~8Knee flexion external rotation450~450~8Through the simulation of the motion range of the actuator of the lower limb rehabilitation robot with ADAMS software, the results show that the change range of the joint angle basically conforms to the range of human motion comfort, and the system structure basically conforms to the rehabilitation effect, which can help the user automatically complete the rehabilitation training process, as shown in Figure2.Figure 2
Adams motion range simulation.


### 3.1.2. Design and Implementation of Training Control

(1) Training Control Process. In the passive training mode, the target speed of the motor is set first, and the user passively follows the training during the training. The intensity of the training process can be adjusted. After completing a rehabilitation training, the robot stops and saves the rehabilitation training data [14]. In the active training mode, the user is required to make active efforts. When the lower limb muscle strength of the user is insufficient to achieve the predetermined goal, the robot assists the patient to complete the corresponding training. After completing a rehabilitation training, the robot stops and saves the rehabilitation training data. The control flow is shown in Figure 3.Figure 3
Control flow of lower limb rehabilitation robot.(2) System Hardware Mechanism. After the rehabilitation training control program is determined, the hardware part is selected and designed. For the normal operation of the equipment, the peripheral module circuit is used to meet the design requirements. The hardware control system structure of the system includes the single-chip microcomputer controller, power module, data communication module, upper computer industrial control host, data acquisition module, and execution module [15].(3) Control Circuit Design. According to the requirements of training control process, power supply, clock, reset, signal acquisition, motor drive, communication and other circuits are designed.STM32 is selected as the main control chip to realize the stable and accurate control of the lower limb rehabilitation robot [16]. The reset circuit is mainly used to restart the system and keep the system stable. The clock circuit can produce accurate oscillation circuit to ensure the accuracy of the system. At the same time, the system also designs a debugging interface, which can facilitate the single-step debugging of the control system program and facilitate the control, development, and debugging of the rehabilitation robot. The RS-485 serial bus communication is used to realize the information exchange between the upper computer and STM32 controller. Mc33931 chip produced by Freescale Semiconductor Co., Ltd. is used as the motor drive chip, which has the function of controlling inductive load. Its maximum current can reach 5A. By default, the enable pin is set to high level, and three pins IN1, IN2, and FB are used to control the motor motion mode [17]. The specific control mode is shown in Table 2.Table 2
Motor control logic.
PC8_MC_IN1PC9_MC_IN2PC3_MC_FBMotor status10PWMSpeed regulation forward rotation01PWMSpeed regulation reverse00PWM/0Stall11PWM/0Stop(4) Design of Wireless Communication Circuit. A WiFi module has the advantages of fast transmission speed, supporting multiperson connection, and long communication distance and can support web page and app configuration. Esp-m1 chip is selected in the system. The TXD pin of the chip is connected with the RX pin in the STM32 main controller, and the RXD pin of the ESP chip is connected with the TX pin of the STM32 main controller serial port. By default, the esp-m1 chip is enabled. The program initialization of the STM32 main controller determines the use of the module. The NRST pin of the chip is pulled up with 3.3 V voltage. When the pin level is pulled down, the chip resets.


## 3.1.1. Lower Limb Rehabilitation Mechanical Structure

The lower limb rehabilitation robot serves patients with lower limb motor dysfunction. In order to avoid secondary injury to patients, the safety of the lower limb rehabilitation robot should be improved from all aspects of the control system [11]. The control system is divided into hardware system and software system. The hardware system is the bridge between the software system and the robot mechanical body. It is particularly important to build a reasonable hardware system. The software system should be designed with beautiful interface, convenient operation, and comprehensive functions, so as to better realize the value of the rehabilitation robot [12]. As a member of medical devices, rehabilitation robot must meet the requirements of electromagnetic compatibility. The lower limb rehabilitation robot actuator developed in this paper realizes the active and passive training functions of the lower limb according to the rehabilitation needs of the knee joint after operation. Each leg module has 3 degrees of freedom, corresponding to the hip, knee, and ankle on the sagittal plane of the human body. In order to meet the needs of patients with different heights, the thigh length and calf length in the leg module are designed to be adjustable. In order to meet the needs of different obese and thin patients, the width between the leg module and the seat is designed to be adjustable. In order to meet the needs of patients with different conditions, the angle of the seat back is designed to be adjustable, so that patients can train in lying posture and sitting posture. In order to facilitate patients’ training, the seat is designed to be movable, and universal wheels are installed below. The seat can be separated from the lower limb rehabilitation robot. After the patient sits on the seat, push the seat into the robot and lock it [13]. All adjustment functions are realized by electric adjustment. The knee joint is mainly composed of the lower femur, the upper tibia and the patella. The maximum angle of motion of the knee joint in a normal human body is about 70°. The mechanical structure of the lower limb rehabilitation robot designed in this paper realizes the rotation movement by using the rotating pair. The range of motion of the knee joint is shown in Table 1.Table 1
Range of motion of knee joint.
JointActivity statusMaximum angle (°)Maximum range (°)Comfort range (°)Knee jointFlexion and extension1300~1300~70Knee flexion pronation300~300~8Knee flexion external rotation450~450~8Through the simulation of the motion range of the actuator of the lower limb rehabilitation robot with ADAMS software, the results show that the change range of the joint angle basically conforms to the range of human motion comfort, and the system structure basically conforms to the rehabilitation effect, which can help the user automatically complete the rehabilitation training process, as shown in Figure2.Figure 2
Adams motion range simulation.


## 3.1.2. Design and Implementation of Training Control

(1) Training Control Process. In the passive training mode, the target speed of the motor is set first, and the user passively follows the training during the training. The intensity of the training process can be adjusted. After completing a rehabilitation training, the robot stops and saves the rehabilitation training data [14]. In the active training mode, the user is required to make active efforts. When the lower limb muscle strength of the user is insufficient to achieve the predetermined goal, the robot assists the patient to complete the corresponding training. After completing a rehabilitation training, the robot stops and saves the rehabilitation training data. The control flow is shown in Figure 3.Figure 3
Control flow of lower limb rehabilitation robot.(2) System Hardware Mechanism. After the rehabilitation training control program is determined, the hardware part is selected and designed. For the normal operation of the equipment, the peripheral module circuit is used to meet the design requirements. The hardware control system structure of the system includes the single-chip microcomputer controller, power module, data communication module, upper computer industrial control host, data acquisition module, and execution module [15].(3) Control Circuit Design. According to the requirements of training control process, power supply, clock, reset, signal acquisition, motor drive, communication and other circuits are designed.STM32 is selected as the main control chip to realize the stable and accurate control of the lower limb rehabilitation robot [16]. The reset circuit is mainly used to restart the system and keep the system stable. The clock circuit can produce accurate oscillation circuit to ensure the accuracy of the system. At the same time, the system also designs a debugging interface, which can facilitate the single-step debugging of the control system program and facilitate the control, development, and debugging of the rehabilitation robot. The RS-485 serial bus communication is used to realize the information exchange between the upper computer and STM32 controller. Mc33931 chip produced by Freescale Semiconductor Co., Ltd. is used as the motor drive chip, which has the function of controlling inductive load. Its maximum current can reach 5A. By default, the enable pin is set to high level, and three pins IN1, IN2, and FB are used to control the motor motion mode [17]. The specific control mode is shown in Table 2.Table 2
Motor control logic.
PC8_MC_IN1PC9_MC_IN2PC3_MC_FBMotor status10PWMSpeed regulation forward rotation01PWMSpeed regulation reverse00PWM/0Stall11PWM/0Stop(4) Design of Wireless Communication Circuit. A WiFi module has the advantages of fast transmission speed, supporting multiperson connection, and long communication distance and can support web page and app configuration. Esp-m1 chip is selected in the system. The TXD pin of the chip is connected with the RX pin in the STM32 main controller, and the RXD pin of the ESP chip is connected with the TX pin of the STM32 main controller serial port. By default, the esp-m1 chip is enabled. The program initialization of the STM32 main controller determines the use of the module. The NRST pin of the chip is pulled up with 3.3 V voltage. When the pin level is pulled down, the chip resets.


## 3.2. Software Design of Control System Based on Android

The lower limb rehabilitation robot software system developed on Android platform improves the controllability and practicability of the system. According to the overall scheme of the rehabilitation robot, the system realizes the functions of registration, training mode selection and control, monitoring data management, and so on. The operation interface is simple and improves the human-computer interaction ability [18]. The socket connection is made between the mobile phone and the esp-m1 chip on the control board. Based on the TCP/ip protocol, the request command can be sent through the remote control end of the Android mobile phone. When the controller receives the information sent by the mobile phone to the esp-m1 module, it sends the action command to drive the circuit to control the rehabilitation robot to perform the rehabilitation movement. Using Android control platform, the experiment of lower limb rehabilitation robot in passive training mode is carried out. By setting the joint training speed, the operation effect of the equipment is verified, and the training parameters and training progress can be seen through the mobile phone interface. The acquisition card is used to collect the pulse signal fed back by the encoder, and the sampling frequency is 50 Hz, which preliminarily verifies the stability of the system. In the active training mode, when the patient’s strength is not enough, the rehabilitation robot will judge for 2 s. When the patient does not reach the training speed, the rehabilitation robot will assist the patient in movement to meet the movement requirements [19].


## 3.3. Recognition of Training Process Based on Random Forest

Random forest is a strong classifier composed of multiple weak classifiers (decision trees) based on the bootstrap aggregation method. Firstly, the bootstrap method is used to sample and construct subtraining datasets. Each subtraining dataset constructs a decision tree, and then the characteristic parameters are randomly selected to train the decision tree. Each decision tree is irrelevant to each other. When making a decision, the decision results of multiple decision tree classifiers are voted to obtain the final result [20]. The recognition performance of random forest is higher than that of single decision tree, and overcomes the over fitting problem of decision tree. At the same time, due to the use of random sampling, the training model has small variance and strong generalization ability and is robust to missing data and unbalanced data.The random forest algorithm proposed in this paper adopts a feature selection method based on Gini coefficient and a classification and regression trees (CART) decision tree. Gini coefficient represents the chaos degree of the model. The smaller the Gini coefficient, the smaller the chaos degree. The feature with the smallest Gini coefficient is selected so that all samples of each child node belong to one classification as far as possible. The Gini coefficient of the probability distribution is as follows:(1)Ginip=2p1−p.For sample setD, after traversing all the segmentation points of feature parameter A, sample set D is divided into two parts by using the relationship between feature parameter and threshold (TA) (A>TA), that is, sample set D1 satisfying A>TA and sample set D2 not satisfying A>TA. When A>TA, the Gini index of sample set D is the following formula:
(2)GiniD,A=D1DGiniD1+D2DGiniD2,where GiniD1 and GiniD2 represent the uncertainty of sample set D1 and D2, respectively, and GiniD,A represents the uncertainty of set d after A>TA division.CART decision tree is a binary tree. According to the different numerical characteristics of dependent variables in the dataset, regression tree, and classification tree can be constructed, respectively. The construction method of classification tree is as follows.(1)
The subdatasets are obtained through the self-help method, and the feature parameters are randomly selected as the division features of the classification tree nodes. For each feature parameterA selected, all possible thresholds TA are taken, and the Gini coefficients of the subdatasets divided by A>TA are calculated. The feature parameters with the smallest Gini coefficients and their corresponding thresholds are selected as the feature division points of the node(2)
If the number of samples in the node or the depth of the tree reaches the requirements, the construction of the classification tree ends and the CART decision tree that has been successfully constructed is returned. Otherwise, step 1 is recursively executed for the two child nodes


## 4. Result Analysis

Through experiments on a number of subjects with an average age of about 25 years, the measured original EMG signals are analyzed, and the signals of inertial measurement unit (IMU) are trained and recognized by four different machine learning methods, and the data are analyzed by machine learning algorithm. Preprocess the collected surface electromyography (sEMG) data and IMU data to eliminate the problems of missing data, uneven distribution, and abnormal data. Then, the data are divided into a training set and test set according to the ratio of 7 : 3, which are randomly disrupted. The training speed is recognized by four algorithms: decision tree, random forest, MLP (multi-layer perceptron) neural network, and linear regression.Carry out passive training for users at four different speeds. By analyzing the characteristic values of EMG signals in a training cycle, it can be seen that the median frequency (MDF), mean frequency (MNF), and peak peak value (PPV) can better reflect the energy change, as shown in Table3. It can be seen from Table 3 that under the four different training speeds, through the right shift of the median frequency, the muscle groups exert different forces and show regularity, which is helpful for doctors to evaluate the effect of rehabilitation training.Table 3
SEMG signal characteristic values under different speed conditions.
SpeedRectus femorisGastrocnemius muscleMDFMNFPPVMDFMNFPPVA413.8454.50.04415.0455.20.045B454.1484.00.03460.3489.60.038C486.8501.90.03485.7498.40.036D510.3518.50.02514.2520.10.017Figure4 shows the change curve of thigh IMU acceleration during training. Due to the structure of the lower limb rehabilitation robot, IMU can only detect the acceleration of the z-axis. It can be seen that the acceleration in the training process is variable and nonlinear.Figure 4
Thigh acceleration change curve.Figure5 shows the confusion matrix of the recognition effect of the random forest algorithm on the motion state, and Figure 6 shows the confusion matrix of the linear regression algorithm on the motion recognition effect. It can be seen that the recognition effect of the random forest algorithm is better. Taking the first behavior of random forest algorithm confusion matrix as an example, 7316 data were correctly identified as speed a, and only one data was incorrectly identified as speed B, which is superior to other algorithms.Figure 5
Confusion matrix based on the random forest algorithm.Figure 6
Confusion matrix based on the linear regression algorithm.


## 5. Conclusion

In this paper, the hardware and software of the training control and monitoring system of the lower limb rehabilitation robot are designed for the passive training and active training of patients after lower limb surgery. The hardware design takes STM32F373RBT6 main control chip as the core, and the software system is developed based on an Android platform to realize the functions of registration, training mode selection and control, data monitoring, and management. At the same time, by analyzing the eigenvalues of EMG signals under different speed passive training, the difference of training effect under different speed is verified. Through the identification and classification of IMU signals, the superiority of random forest algorithm in motion state identification is verified, which lays a foundation for man-machine cooperative control. In the follow-up, the designed lower limb rehabilitation robot and its control and monitoring system should be applied to the actual rehabilitation process of patients, and the physiological signals of patients should be analyzed and studied.



---

*Source: 5067346-2022-07-21.xml*