# Dual PID Adaptive Variable Impedance Constant Force Control for Grinding Robot
## 3 Position-Based Adaptive Impedance Control  
### Dual PID Adaptive Variable Impedance Control  
Since industrial robots generally only open a position loop, it is difficult to obtain accurate values of workpiece stiffness and position. Therefore, position-based impedance control avoids the consideration of dynamics. According to the target impedance to calculate the position deviation, compensating for the reference position achieves accurate force control. The contact state of the robot is shown in Figure 5.  
The position-based impedance control strategy is shown in Figure 3, where \(X_{r}\), \(X_{c}\), and \(X_{z}\) are represented as reference trajectory, command trajectory, and robot end output trajectory, respectively. Assume that the robot's controller performs well, namely, \(X_{c}=X_{z}\). The contact position between the end and the environment is \(E=X_{z}-X_{r}=X_{c}-X_{r}\). The contact environment stiffness is \(K_{e}\); the desired contact force is \(F_{d}\). The contact force between the end of the robot and the environment can be simplified as \(F_{e}=K_{e}(X_{e}-X_{z})=K_{e}(X_{e}-X_{c})\). Then, the end contact force error is:  
\[\Delta F=F_{e}-F_{d} \tag{5}\]  
In general, the impedance model is represented by a second-order transfer function \(K(s)\), \(K(s)=\frac{1}{\frac{\mathrm{d}{\mathrm{d}}^{2}+B+K}{\mathrm{d}}}\). The dynamic relationship between force error \(\Delta F\) and position disturbance \(E\) is as follows:  
\[M\frac{\mathrm{d}^{2}E(t)}{dt^{2}}+B\frac{\mathrm{d}E(t)}{dt}+KE(t)=\Delta F(t) \tag{6}\]  
where \(M\) is the mass of the target impedance, \(B\) is the damping of the target impedance, and \(K\) is the stiffness of the target impedance. Thus, the reference position can be modified by position perturbation \(E\):  
\[X_{c}=X_{r}+E=X_{r}+\Delta F\cdot K(s) \tag{7}\]  
Figure 4: Simulation and experimental results of robot end contact state transition. Figure 5: The state of contact between the workpiece and the end effector. In the robot grinding process, only one dimension of the end is considered. Therefore, we rewrite Equation (6) as:  
\[\Delta f=f_{e}-f_{d}=k_{e}(x_{e}-x_{z})-f_{d}=k_{e}x_{e}-k_{e}(x_{r}+k(s)\Delta f )-f_{d} \tag{8}\]  
where \(\Delta f\) is the force error of one dimension. \(f_{e}\) is the contact force of one dimension. \(f_{d}\) is the desired force of one dimension. \(k_{e}\) is the environmental stiffness of one dimension. \(x_{e}\) is the environmental position of one dimension. \(x_{z}\) is the output position of the robot end in the force control direction. \(x_{r}\) is the reference position of one dimension. \(k(s)\) is a second-order transfer function in one dimensional direction. Then, Equation (8) can be rewritten as:  
\[\Delta f=\frac{ms^{2}+bs+k}{ms^{2}+bs+k+k_{e}}[k_{e}(x_{e}-x_{r})-f_{d}] \tag{9}\]  
The steady-state force tracking error \(\Delta f_{ss}\) is obtained as follows:  
\[\Delta f_{ss}=\Delta f=\frac{k}{k+k_{e}}[k_{e}(x_{e}-x_{r})-f_{d}] \tag{10}\]  
If the force tracking error converges to 0 under steady-state conditions, the following conditions need to be met:  
\[k=0,\ \text{or}\,\ x_{r}=x_{e}-\frac{f_{d}}{k_{e}} \tag{11}\]  
According to Equation (11), the steady-state error of 0 can be satisfied under the condition that the environmental position \(x_{e}\) and the contact stiffness \(k_{e}\) are known. However, in the robot grinding process, accurate \(x_{e}\) and \(k_{e}\) values are not easy to obtain. Therefore, setting the stiffness term of the impedance controller to 0 can compensate for the environmental uncertainty. Since the position of the environment is replaced by the initial environmental position \(x_{e}\) instead of the reference position \(x_{r}\), the position disturbance is \(e=x_{z}-x_{e}\):  
Equation (8) can be expressed as:  
\[\Delta F=F_{e}-F_{d} \tag{5}\]0  
where \(\ddot{e}=\dot{x}_{z}-\dot{x}_{e}\) and \(\dot{e}=\dot{x}_{z}-\dot{x}_{e}\)  
Through the above analysis, if it is flat grinding, namely, \(\ddot{x}_{e}=\dot{x}_{e}=0\), then \(\Delta f_{ss}=0\).