# A Safe Admittance Boundary Algorithm for Rehabilitation Robot Based on Space Classification Model
## 2 Safe Admittance Boundary Algorithm
### Variable Stiffness Admittance Strategy  
The space classification model is integrated with admittance control to impose virtual constraints on the workspace in the control layer. For this purpose, we design a variable stiffness admittance strategy to define the safe admittance boundary for the robot. First, the real-time coordinates \(S\left(x,y,z\right)\) of the moving point in the end-effector of the robot are calculated using the admittance model and the position, pose, and six-dimensional force data of the end-effector. The admittance model is given below:  
\[\mathrm{M\ddot{x}_{e}+B\dot{x}_{e}+Kx_{e}=F_{e}} \tag{7}\]  
where: \(F_{e}\in\mathbb{R}^{6}\) is the force imposed by the human wrist on the force sensor; \(M\in\mathbb{R}^{6\times 6}\), \(B\in\mathbb{R}^{6\times 6}\), and \(K\in\mathbb{R}^{6\times 6}\) are the virtual mass, virtual damping, and virtual stiffness in the admittance model, respectively; \(x_{e}\in\mathbb{R}^{6}\) is the corrected position and pose; and \(\dot{x}_{e}\in\mathbb{R}^{6}\) and \(\ddot{x}_{e}\in\mathbb{R}^{6}\) are the first- and second-order derivatives of \(x_{e}\), respectively--that is, the velocity and acceleration of the corrected position and pose, respectively. The corrected position and pose \(x_{e}=x-x_{d}=[\Delta v,\ \Delta\xi]\). The corrected position and pose is the difference between the actual position and pose \(x\) and the expected position and pose \(x_{d}\); \(\Delta v\) is the position deviation and \(\Delta\xi\) is the pose deviation. In the actual admittance model, we not only take into account the robot's virtual mass \(M_{r}\in\mathbb{R}^{6\times 6}\), virtual damping \(B_{r}\in\mathbb{R}^{6\times 6}\), and virtual stiffness \(K_{r}\in\mathbb{R}^{6\times 6}\), but also consider human dynamics [10]. We consider the human dynamics compensation, introduce human virtual mass compensation \(M_{h}\in\mathbb{R}^{6\times 6}\), virtual damping compensation \(B_{h}\in\mathbb{R}^{6\times 6}\) and virtual stiffness compensation \(K_{h}\in\mathbb{R}^{6\times 6}\) in the admittance model, and define \(M=M_{r}+M_{h}\), \(B=B_{r}+B_{h}\), and \(K=K_{r}+K_{h}\) for the admittance model in this system. In the process of HRI, the size of \(K\) has a direct bearing on the robot's ability to track the intention of a human arm motion. A lower \(K\) value allows the patient to move in a greater range; a higher \(K\) value allows the robotic arm to more precisely track the expected position and pose or the motion trajectory. For the purpose of robot-assisted active training, a lower virtual stiffness \(K_{low}\) is set for the initial admittance model of the robotic arm. The acceleration of the corrected position and pose is calculated using the admittance model:  
\[\ddot{x}_{e}=M^{-1}\big{(}F_{e}-B\dot{x}_{e}-Kx_{e}\big{)} \tag{8}\]  
Based on the acceleration of the corrected position and pose, the corrected position and pose is calculated by taking the quadratic integral:  
\[X_{e}=\int\!\left(\int\ddot{x}_{e}dt\right)dt \tag{9}\]  
The position and pose \(x\ =x_{d}+\ x_{e}\) of the moving point in the end-effector for the next moment is calculated based on the corrected position and pose and the expected  
Figure 5: Space classification model constructed based on the nearest neighbor density of the point cloud. position and pose input from robot motion planning. Inverse kinematics is implemented to determine the expected joint coordinate matrix \(\mathrm{q_{d}}\) for each joint to achieve robot motion control. The control gains are tuned by referencing [33]. Additionally, FK is applied to the real-time joint coordinate \(\mathrm{q}\) of the robot to obtain the real-time coordinate \(\mathrm{S}\) (x,y,z ) of the moving point in the end-effector. Next, the boundary model of the HRI space is integrated with the admittance model. The architecture of the control layer of the variable stiffness admittance strategy is shown in Figure 6. Thus, we establish the variable stiffness admittance strategy (Algorithm 2).