# Research on Robotic Peg-in-Hole Assembly Method Based on Variable Admittance
## 2 Materials and Methods
### Admittance Control Design  
#### 2.2.1 Pose Solving Based on Admittance  
The interaction between the robot and its environment can be regarded as a virtual second-order system composed of mass-spring-damper elements in all degrees of freedom. Admittance control establishes a dynamic relationship between positional deviation X and force deviation F based on this second-order system. The system architecture of the admittance control is depicted in Figure 2 below:  
The dynamic equation of the system is expressed as follows:  
\[\mathrm{M}\ddot{X}_{e}+\mathrm{B}\dot{X}_{e}+\mathrm{K}X_{e}=F_{e} \tag{1}\]  
\[X_{e}=X-X_{d} \tag{2}\]  
\[F_{e}=F-F_{d} \tag{3}\]  
where \(\mathrm{M},\mathrm{B}\) and \(\mathrm{K}\) represent virtual inertia, damping, and stiffness, respectively. \(X_{e}\) is the positional deviation, \(X\) is the absolute position of the robot's end axis, and \(X_{d}\) is the  
Figure 1: The status of the peg-in-hole assembly. (**a**) The hole-seeking stage; (**b**) The adjustment stage; (**c**) The insertion stage.  
expected position. \(\dot{X}_{e}\) is the velocity deviation, and \(\ddot{X}_{e}\) is the acceleration deviation. \(F_{e}\) is the deviation of force, and \(F\) is the contact force data between the shaft and the surrounding material, collected by the six-axis force/torque sensor. \(F_{d}\) is the expected force set, which is the contact force maintained between the desired axis and the hole.  
Due to the fact that data measured by the six-axis force/torque sensor included additional forces from sensor zero drift and the gravity of the end load, it was necessary to perform zero-point compensation and gravity compensation on the sensor before the experiment. This ensured that the measured force values accurately reflected the true contact forces.  
Rewrite Formula (1) into the following form:  
\[\ddot{X}_{e}=\frac{F_{e}-B\dot{X}_{e}-KX_{e}}{M} \tag{4}\]  
By using Formula (4), the intermediate velocity \(\dot{X}_{e}^{t+1}\) and the pose deviation \(X_{e}^{t+1}\) at the next moment can be calculated by using the integration method. The pose deviation can then be compensated to the robot to complete trajectory adjustment. Ultimately, it will be smoothly inserted into the hole.  
\[\left\{\begin{array}{l}\dot{X}_{e}^{t+1}=\dot{X}_{e}^{t}+\ddot{X}_{e}\Delta t \\ X_{e}^{t+1}=X_{e}^{t}+\dot{X}_{e}^{t+1}\Delta t\end{array}\right. \tag{5}\]  
The displacement vector was directly integrated and iteratively calculated using the aforementioned formula. However, the components of the pose, which were equivalent axial vectors, needed to be converted into the corresponding attitude matrix operations first, and then transformed back into equivalent axial vectors. By integrating Formula (5), the rotational quaternion \(q_{t}\) could be solved, allowing the upper computer to obtain the real-time posture data \(q_{r}\) of the robot. Multiplying the rotational quaternion \(q_{t}\) on the right by the real-time posture quaternion \(q_{r}\) enabled the calculation of the target quaternion \(q\). Subsequently, after converting the quaternion to a rotation vector, it was sent to the robot to complete the control of the robot's posture.