# A Novel Virtual Sensor for Estimating Robot Joint Total Friction Based on Total Momentum
## 2 Design of a Virtual Sensor for Estimating Joint Friction
### System Stability Analysis  
The system stability analysis is summarized here for the case of exact friction compensation because of the passivity property of the friction compensation [40]. According to Equation (3), the robot system formula is written as  
\[H(q)\ddot{q}+C\big{(}q,\dot{q}\big{)}\dot{q}+G(q)=\overline{\tau}_{M}-\tau_{ f,tot}, \tag{10}\]  
Figure 1: Diagram of a virtual sensor for estimating joint friction torque. The dotted box on the left represents the inverse dynamics controller algorithm, in which the input is the link desired trajectory and the output is the command torque. The dotted box on the right represents the proposed virtual sensor for estimating the total joint friction torque, in which the input is the actual position and velocity of the link and motor, and the output is the estimated joint total friction torque, which is finally compensated for by the controller to improve the controller performance, especially the that of the velocity.  
where \(H(q)=M(q)+\beta\overline{B}\) has the same symmetric and positive-definite property as \(M(q)\)[47].  
The control law without friction compensation is shown below:  
\[\tau_{M}=\Big{[}H\Big{(}\ddot{q}_{d}+K_{p}e+K_{d}\dot{e}\Big{)}+C\dot{q}+G\Big{]} /\beta, \tag{11}\]  
where \(K_{p}\) and \(K_{d}\) are diagonal positive-definite gain matrices. \(e=q_{d}-q\), \(\dot{e}=\dot{q}_{d}-\dot{q}\), and \(\ddot{e}=\ddot{q}_{d}-\ddot{q}\) are the position error, velocity error, and acceleration error, respectively. After the observed friction torque is incorporated into the controller, the new control law is  
\[\tau_{M}=\Big{[}H\Big{(}\ddot{q}_{d}+K_{p}e+K_{d}\dot{e}\Big{)}+C\dot{q}+G+\tau _{f,tot}\Big{]}/\beta. \tag{12}\]  
Combining (10) with (12), (10) can be modified as  
\[H(q)\ddot{q}=H(q)\Big{[}\ddot{q}_{d}+K_{p}e+K_{d}\dot{e}\Big{]}. \tag{13}\]  
Due to \(H(q)\) being invertible, (13) can be modified as  
\[\ddot{q}=\ddot{q}_{d}+K_{p}e+K_{d}\dot{e}. \tag{14}\]  
By using \(\ddot{e}=\ddot{q}_{d}-\ddot{q}\), Equation (14) can be modified as  
\[\ddot{e}+K_{p}e+K_{d}\dot{e}=0. \tag{15}\]  
It can be seen that the system described by (10) is equivalent to the linear system described by (15) by using (12), thus the Lyapunov function can be designed as [47]  
\[V=\Big{(}\dot{e}^{T}\dot{e}\Big{)}/2+\Big{(}\dot{e}^{T}K_{p}e\Big{)}/2. \tag{16}\]  
Then, the time derivative of the Lyapunov function is deduced below:  
\[\dot{V}=\Big{(}\ddot{e}^{T}\dot{e}+\dot{e}^{T}\ddot{e}\Big{)}/2+\Big{(}\dot{e} ^{T}K_{p}e+e^{T}K_{p}\dot{e}\Big{)}/2. \tag{17}\]  
By using \(\ddot{e}^{T}\dot{e}=\dot{e}^{T}\ddot{e}\), \(\dot{e}^{T}K_{p}e=\dot{e}^{T}K_{p}\dot{e}\)[48], (17) becomes  
\[\dot{V}=\dot{e}^{T}\ddot{e}+\dot{e}^{T}K_{p}e. \tag{18}\]  
Then, Equation (18) can be modified as  
\[\dot{V}=\dot{e}^{T}\Big{(}\ddot{e}+K_{p}e\Big{)}. \tag{19}\]  
Combining Equations (15) and (19) can be rewritten as  
\[\dot{V}=-\dot{e}^{T}K_{d}\dot{e}\leq 0. \tag{20}\]  
Substituting \(\dot{e}=\ddot{e}=0\) into (15), it can be obtained that \(K_{p}e=0\). Then, from the reversibility of \(K_{p}\), it can be known that \(e\) is zero. Therefore, from the LaSalle theorem, it can be known that \(\Big{(}e,\dot{e}\Big{)}=(0,0)\) is the global asymptotically stable equilibrium point of the robot system. More similar stability proof details can also be found in [40, 47, 48].