## 3 Adaptive Control System
### Adaptive Control Based on Environmental Information Estimation  
From the previous subsection, it is known that the actual working environment is typically time-varying and unknown [27]. In such cases, the real-time online estimation of environmental parameters is required. Let \(\hat{k}_{e}\) and \(\hat{x}_{e}\) represent the estimated values of \(k_{e}\) and \(x_{e}\), respectively. Then, Equation (14) can be expressed as  
\[x_{r}=\frac{f_{r}}{\hat{k}_{e}}+\hat{x}_{e} \tag{15}\]  
When substituting the estimated values of the environmental parameters into Equation (6), and by taking the difference with Equation (6), we can obtain the estimated value of the contact force \(\hat{f}_{e}\) and the estimation error of the contact force:  
\[\hat{f}_{e}=\hat{k}_{e}(x_{d}-\hat{x}_{e})=\hat{k}_{e}x_{d}-\hat{k}_{e}\hat{x} _{e} \tag{16}\]  
\[\hat{f}_{e}-f_{e}=(x-\hat{x}_{e})\hat{k}_{e}-(x-x_{e})k_{e}=x\Big{(}\hat{k}_{e} -k_{e}\Big{)}-\Big{(}\hat{k}_{e}\hat{x}_{e}-k_{e}x_{e}\Big{)} \tag{17}\]  
When simplifying Equation (17), we obtain  
\[\hat{f}_{e}-f_{e}=\big{[}x\quad-1\big{]}\phi \tag{18}\]  
where, \(\phi_{k}=\hat{k}_{e}-k_{e}\), \(\phi_{x}=\hat{k}_{e}\hat{x}_{e}-k_{e}x_{e}\), \(\phi=[\phi_{k}\phi_{x}]^{T}\). Therefore, it is possible to set the control law to an online estimate of the environmental parameters \(\hat{k}_{e}\) and \(\hat{x}_{e}\) such that as \(t\) approaches infinity, \(\hat{f}_{e}\) approaches \(f_{e}\), and \(f_{e}\) approaches \(f_{r}\), achieving the desired force tracking objective. The design of the Lyapunov function is shown below:  
\[V=\phi^{T}\Gamma\phi \tag{19}\]  
where, \(\Gamma=[r_{1},r_{2}]I_{2\times 2}\) is a positive definite matrix, \(r_{1}\) and \(r_{2}\) are positive real constants, and \(\phi\) is represented as  
\[\phi=-\Gamma^{-1} \begin{bmatrix}x\\ -1\end{bmatrix} \Big{(}\hat{f}_{e}-f_{e}\Big{)} \tag{20}\]  
By combining Equations (19) and (20), and taking the derivative of Equation (19), we obtain  
\[\dot{V}=2\phi^{T}\Gamma\dot{\phi}=-2(\hat{f}_{e}-f_{e})^{2}\leq 0 \tag{21}\]Because \(V\) is positive definite, it is evident from Equation (21) that it possesses the semi-negative definite property, ensuring the stability of the controller. When substituting the positive definite symmetric matrix \(\Gamma\) into Equation (20), we obtain  
\[ \begin{split}\dot{\phi}=\left[\begin{array}{c}\dot{\phi}_{k}\\ \dot{\phi}_{x}\end{array}\right]=-\Gamma^{-1}\left[\begin{array}{c}x\\ -1\end{array}\right]\left(\dot{f}_{e}-f_{e}\right)=-\frac{1}{r_{1}r_{2}} \left[\begin{array}{cc}r_{2}&0\\ 0&r_{1}\end{array}\right]\left[\begin{array}{c}x\\ -1\end{array}\right]\left(\dot{f}_{e}-f_{e}\right)\\ =\left[\begin{array}{c}\dot{k}_{e}-k_{e}\\ \dot{k}_{e}\dot{x}_{e}+\dot{k}_{e}\dot{x}_{e}-\dot{k}_{e}x_{e}-k_{e}\dot{x}_{e} \end{array}\right]=-\frac{1}{r_{1}r_{2}}\left[\begin{array}{c}r_{2}x\\ -r_{1}\end{array}\right]\left(\dot{f}_{e}-f_{e}\right)\end{split}  \tag{22}\]  
According to the analysis, simplifying Equation (22) yields  
\[ \begin{split}\begin{bmatrix}\dot{k}_{e}\\ \dot{k}_{e}\end{bmatrix}=\left[\begin{array}{c}-\frac{x}{r_{1}}\left(\dot{f }_{e}-f_{e}\right)\\ \frac{\left(\dot{f}_{e}-f_{e}\right)}{k_{e}}\left(\frac{1}{r_{2}}+\frac{x}{r_{ 1}}\dot{x}_{e}\right)\end{array}\right]\end{split}  \tag{23}\]  
For convenience, we define \(\eta_{1}=1/r_{1}\) and \(\eta_{2}=1/r_{2}\). Then, the adaptive control algorithm based on environmental information can be represented as follows:  
\[x_{r}=\dot{x}_{e}+\frac{f_{r}}{\dot{k}_{e}} \tag{24}\]  
\[\dot{x}_{e}(t)=\dot{x}_{e}(0)-\int_{0}^{t}\frac{(\dot{f}_{e}-f)}{\dot{k}_{e}} \big{(}\eta_{1}x\dot{x}_{e}+\eta_{2}\big{)}dt \tag{25}\]  
\[\dot{k}_{e}(t)=\dot{k}_{e}(0)-\eta_{1}\int_{0}^{t}x(t)(\dot{f}_{e}-f_{e})dt \tag{26}\]  
From Equations (24)-(26), it can be observed that the designed adaptive control algorithm estimates the environmental information parameters \(x_{e}\) and \(k_{e}\) in real time based on the robot's end-effector position and actual contact force; it then computes the desired trajectory for the robot.