## 3 Trajectory Prediction Variable Admittance Control Method  
Consider a typical mass-spring-damper model where the mass \(\mathbf{M}_{x}\) is subjected to an external force \(F_{\text{ext}}\), and the second-order linear equation is as follows. \[\mathbf{M}_{x}\Big{(}\ddot{X}-\ddot{X}_{d}\Big{)}+\mathbf{D}_{x}\Big{(}\dot{X}-\dot{X}_{ d}\Big{)}+\mathbf{K}_{x}(X-X_{d})=F_{\text{ext}}+G+f \tag{1}\]  
where \(X\) is the position of the end tool in Cartesian space, and \(X_{d}\) represents the pre-defined reference trajectory, and G represents gravity and \(f\) is the friction. \(\mathbf{M}_{x}\), \(\mathbf{D}_{x}\) and \(\mathbf{K}_{x}\) are the virtual mass, damping and stiffness in Cartesian coordinate system respectively. The application scenario of this paper is grinding task in knee replacement surgery, and the Equation (1) can be further simplified. First, in the \"hand-on\" human-robot collaboration mode, the robot is set to be freely moved by the operator, and will maintain its position after releasing the hand. In this control mode, the robot has no reference trajectory, and the stiffness in the equivalent admittance is zero, so \(X_{d}\) and \(\mathbf{K}_{x}\) will not appear in the admittance equation. Secondly, the gravity term can be compensated based on the joint angle, and friction is not considered in this paper, so gravity \(G\) and friction \(f\) will not appear in the equation. Finally, considering that the damping force is obtained by the output torque of the controller, the dynamic equation is as follows:  
\[\left\{ \begin{array}{c}\mathbf{M}_{x}\ddot{X}+\mathbf{D}_{x}\dot{X}=F_{\text{ext}}\\ \mathbf{D}_{x}\dot{X}=\mathbf{J}^{-\text{T}}\tau\end{array} \right. \tag{2}\]  
where \(\mathbf{J}\) is the Jacobian matrix and \(\tau\) is the output torque of the motor. By comparing the dynamic model in joint space, it is generally:  
\[\left\{ \begin{array}{c}\mathbf{M}_{x}(q)=\mathbf{J}^{-\text{T}}(q)\mathbf{M}_{q}(q)\mathbf{ J}^{-1}(q)\\ \mathbf{D}_{x}(q)=\mathbf{J}^{-\text{T}}(q)\mathbf{C}_{q}(q,\dot{q})\mathbf{J}^{-1}(q)\end{array} \right. \tag{3}\]  
where \(q\) is joint angle, \(\mathbf{M}_{q}\) and \(\mathbf{C}_{q}\) are the virtual mass, damping in joint space respectively. In the trajectory prediction variable admittance control (TPVAC) method proposed in this paper, the key step is to predict the movement direction of robot end tool, and then change the damping in that direction. The schematic diagram and control block diagram of TPVAC are shown in the Figure 2.  
Figure 1: Overview of the control system consisting of a robot system, a LSTM network, and an admittance control system. In Figure 2a, points \(P_{t}\) and \(P_{t+\Delta t}\) are the positions of the robot end tool at time \(t\) and \(t+\Delta t\), respectively, and \(P^{\prime}{}_{t+\Delta t}\) is the predicted point at time \(t+\Delta t\). \(V_{t}\) and \(V^{\prime}{}_{t}\) are actual movement velocity and predicted movement velocity respectively, and \(V^{\prime}{}_{t}\) = (\(P^{\prime}{}_{t+\Delta t}-P_{t}\))/\(\Delta t\). Then the predicted motion direction vector is \(d_{mt}\) = \(V^{\prime}{}_{t}\)/ \(\mid V^{\prime}{}_{t}\mid\). \(F_{t}\) and \(F^{\prime}{}_{t}\) are the robot damping force under constant damping and variable damping control at time \(t\) respectively. Since the damping force and motion are reversed under constant damping control, it is assumed that the initial damping matrix is \(\mathbf{D}_{0}\), that is, \(F_{t}\) = \(-\mathbf{D}_{0}V_{t}\). At the same time, the damping force can be decomposed into component forces \(F_{tu}\) and \(F_{tv}\) that are perpendicular and parallel to the direction of motion. \(\mathbf{D}_{0}\) can be decomposed into \(\mathbf{D}_{ut}\) and \(\mathbf{D}_{vt}\), and their calculation formulas are as follows:  
\[\left\{ \begin{array}{l}F_{tu}=-D_{tu}V_{t}\\ F_{tv}=-D_{tv}V_{t}\end{array} \right.