## 2 Description of the Rehabilitation Robot
### Dynamics Model and Control  
Regarding the end-effector rehabilitation robot developed in this paper, the dynamic analysis of the rehabilitation robot is mainly to carry out dynamic modeling and analysis for the two commercial manipulators. In general, the dynamic model of the serial manipulator can be derived through the Lagrangian equation or Newton-Euler equation. Once given the joint position, joint velocity, and joint acceleration, the dynamics model in the joint space can be written:  
\[M(q)\ddot{q}+C(q,\ \dot{q})\dot{q}+G(q)+F(\dot{q})=\tau+\tau_{ext} \tag{2}\]  
\[\tau_{ext}=J^{\tau}(q)F_{ext} \tag{3}\]  
where \(\tau\in R^{7}\) are the applied torques by actuators; \(M(q)\in R^{7\times 7}\) is the inertial matrix; \(C(q,\dot{q})\in R^{7\times 7}\) denotes the centrifugal and Coriolis matrix; \(G(q)\in R^{7}\) is the gravity vector; \(F(\dot{q})\in R^{7}\) denotes the friction vector; \(F_{ext}\) is the external wrench applied on the end-effector, and \(J(q)\) is the Jacobian matrix.  
According to Equation (2), [PERSON] [20] proposed the impedance control algorithm that describes a dynamic relationship between the motion and the force of the end of a manipulator, which can make the manipulator behave as a mass-spring-damping system when it is driven by an external wrench, or following a determined reference trajectory. For convenience of expression, the impedance control algorithm in the joint space of the manipulator makes the manipulator behave as a mass-spring-damping system, and the control law of impedance control in the joint space can be expressed as:  
\[\tau_{ext}=I_{\theta}\Delta\ddot{q}+D_{\theta}\Delta\dot{q}+K_{\theta}\Delta q \tag{4}\]  
where \(I_{\theta}\), \(D_{\theta}\), and \(K_{\theta}\) represent, respectively, the inertial, the damping, and the stiffness desired matrices at the joint level. In order to derive the impedance control model of the manipulator in Cartesian space, it is necessary to apply the geometric Jacobian matrix of the manipulator to map the robot joint space model to Cartesian space, as shown in Figure 4:  
\[\Delta X=X_{0}-X \tag{5}\]  
\[\Delta\dot{X}=-\dot{X}=-\dot{J}\dot{q} \tag{6}\]  
\[\Delta\ddot{X}=-\dot{X}=-\dot{J}\dot{q}-\dot{J}\dot{q} \tag{7}\]  
Figure 3: The schematic diagram of the coordinate frames relationship.  
Therefore, the control equation of the impedance control model of manipulator in Cartesian space is obtained [40]:  
\[F_{ext}=M_{X}\Delta\ddot{X}+D_{X}\Delta\dot{X}+K_{X}\Delta X \tag{8}\]  
where \(I_{\theta}=J^{T}M_{X}J\), \(D_{\theta}=J^{T}D_{X}J\), \(K_{\theta}=J^{T}K_{X}J\);\(M_{X}\), \(D_{X}\), and \(K_{X}\) represent, respectively, the virtual inertial, damping, and stiffness matrices, defined at the Cartesian level. Therefore, the appropriate impedance parameters can be constructed to achieve the desired compliance level of the manipulator. When we expect the manipulator to work in position control mode, we could construct the stiffness parameters of the manipulator as \(K_{des}\to K_{\max}\); now, the manipulator's controller becomes a position controller combining the Equations (3), (4), and (9). When we expect the manipulator to work under torque control mode, we need to construct the stiffness parameters of the manipulator \(K_{des}\to 0\). When the manipulator is expected to work under impedance control, the stiffness parameters that meet the requirements need to be formulated according to the requirements.