## 2 Methods
### Real-Time Joint Stiffness Configuration Strategy
For the robot with flexible joints, the joint space stiffness of the robot will affect the comprehensive surface contact stiffness in human-robot collision. Therefore, by adjusting the joint space stiffness of the robot in real-time, the safety of human-robot collision can be improved in the human-robot interaction environment. The joint space stiffness of the robot is related to the joint torque and the passive joint deflection angle. In order to maintain the motion stability of the robot, the closer the joints are to the base coordinate system, a greater the stiffness of joints is required. And when the joint torque is too large, the passive joint deflection angle should be controllable. According to the above requirements, referring to the hyperbolic tangent function, the relation equation between the joint torque \(\boldsymbol{\tau}\) and the passive joint deflection angle \(\Delta\boldsymbol{\theta}\) of the robot is proposed as follows:  
\[\Delta\boldsymbol{\theta}=\boldsymbol{b}\text{tanh}(\boldsymbol{\tau}/ \boldsymbol{a}) \tag{6}\]  
where, for 7-DOF humanoid manipulator with flexible joints, \(\boldsymbol{a}\) and \(\boldsymbol{b}\) are \(7\times 1\) parameter matrices respectively, which can be determined according to the working environment of the humanoid manipulator; the joint torque \(\boldsymbol{\tau}\) and the passive joint deflection angle \(\Delta\boldsymbol{\theta}\) are \(7\times 1\) matrices respectively. The relationship curves between the joint torque and the passive joint deflection angle of the humanoid manipulator are S-shaped curve. For example, we assign values to \(\boldsymbol{a}\) and \(\boldsymbol{b}\), if \(\left\{ \begin{array}{l}\boldsymbol{a}=\left[\frac{50}{\pi},\frac{45}{\pi}, \frac{40}{\pi},\frac{35}{\pi},\frac{55}{\pi},\frac{60}{\pi},\frac{65}{\pi} \right]^{T}\\ \boldsymbol{b}=\left[5\times 10^{-4},4.5\times 10^{-4},4\times 10^{-4},3.5 \times 10^{-4},5.5\times 10^{-4},6\times 10^{-4},6.5\times 10^{-4}\right]^{T} \end{array} \right.\), then the relationship curve between the joint torque and the passive joint deflection angle of the humanoid manipulator is shown in Figure 1.  
It can be seen from Figure 1 that according to the given parameter matrices \(\boldsymbol{a}\) and \(\boldsymbol{b}\), no matter what the joint torque of the humanoid manipulator is, the passive joint  
Figure 1: The relationship curve between the joint torque and the passive joint deflection angle. deflection angle will always be limited in a certain range. When the joint torque is small, the relationship between the joint torque and the passive joint deflection angle is approximately linear, in this case, the joint space stiffness is basically constant. When the joint torque is large, the passive deflection angle of the joint has little change with the increase of the joint torque, and the joint space stiffness gradually increases. The relationship curve meets the motion stability requirements of the humanoid manipulator. In addition, the joint torque \(\boldsymbol{\tau}\) is calculated as follows:  
\[\boldsymbol{\tau}=\boldsymbol{J}^{\boldsymbol{T}}\boldsymbol{F} \tag{7}\]  
where \(\boldsymbol{J}^{\boldsymbol{T}}\) is the force Jacobian matrix and \(\boldsymbol{F}\) is the force/torque on the end effector of the robot. According to Equations (6) and (7), the calculation equation of the joint space stiffness of the humanoid manipulator can be obtained.