# A Novel Virtual Sensor for Estimating Robot Joint Total Friction Based on Total Momentum
## 2 Design of a Virtual Sensor for Estimating Joint Friction  
### Design of a Virtual Sensor  
It is assumed that robots have n rigid joints, and motor-side dynamics which include motor inertia, motor-side friction, and so on are also considered here. Therefore, the link dynamics and motor dynamics can be described as follows:  
\[M(q)\ddot{q}+C\Big{(}q,\dot{q}\Big{)}\dot{q}+G(q)=\tau_{J}-\tau_{fJ}, \tag{1}\]  
\[B\ddot{\theta}=\tau_{M}-\tau_{f,m}-\tau_{I}/\beta, \tag{2}\]  
where \(q\in\Re^{n\times 1}\) are the generalized coordinates used to uniquely determine the positions of links, \(\theta\in\Re^{n\times 1}\) are the generalized coordinates associated with the positions of motors, \(M(q)\in\Re^{n\times n}\) is the symmetric and positive-definite inertia matrix of links, \(C\Big{(}q,\dot{q}\Big{)}\in\Re^{n\times n}\) is the centripetal and Coriolis matrix of links, \(G(q)\in\Re^{n\times 1}\) is the gravity vector of links, and \(B\in\Re^{n\times n}\) is the diagonal positive-definite motor inertia matrix. On the right-hand side of Equations (1) and (2), \(\tau_{J}\in\Re^{n\times 1}\) is the joint torque, \(\tau_{M}\in\Re^{n\times 1}\) is the active motor torque, \(\tau_{fJ}\in\Re^{n\times 1}\) is the friction torque acting on the link side of the joints, and \(\tau_{f,m}\in\Re^{n\times 1}\) denotes the friction torque acting on the joint motors. \(\beta\in\Re^{n\times n}\) is the diagonal positive-definite reduction radio matrix. Equations (1) and (2) can be combined to obtain the following expression:  
\[M(q)\ddot{q}+\overline{B}\ddot{\theta}+C\Big{(}q,\dot{q}\Big{)}\dot{q}+G(q)= \overline{\tau}_{M}-\tau_{f,tot}, \tag{3}\]  
where \(\overline{B}=\beta B\), \(\overline{\tau}_{M}=\beta\tau_{M}\), and \(\tau_{f,tot}=\beta\tau_{f,m}+\tau_{fJ}\). In the dynamic system described by Equation (3), the total friction \(\tau_{f,tot}\in\Re^{n\times 1}\) is the main dissipative torque (because not all dissipative torque is introduced in the dynamic equations above), without considering the external contact torque. Therefore, if the total friction torque is not considered in the robot dynamics model, it can be regarded as an external disturbance or an external collision torque. In addition, \(\tau_{J}\), which is usually estimated or obtained from joint torque sensors, is eliminated. Therefore, the designed virtual sensor is independent of the joint torque sensors. The structure of the virtual sensor for joint friction observations (Figure 1) is inspired by the total momentum-based collision detection algorithms developed in [43], in which similar sensors are used to detect the external disturbance torques that influence robot dynamics. Here, the algorithm is modified to detect the total friction torque, which constitutes a disturbance. The robot total momentum \(p_{tot}\in\Re^{n\times 1}\) is given by  
\[p_{tot}=M(q)\dot{q}+\overline{B}(\theta)\dot{\theta}. \tag{4}\]A basic property of robot dynamics is the skew symmetry of matrix \(\dot{M}(q)-2C\big{(}q,\dot{q}\big{)}\), which is equivalent to the following identity:  
\[\dot{M}(q)=C\big{(}q,\dot{q}\big{)}+C^{\mathrm{T}}\big{(}q,\dot{q}\big{)}. \tag{5}\]  
Based on the expression of the dynamics of the actual total momentum \(p_{tot}\), and combining Equations (3) and (5), the time evolution of \(p_{tot}\) with friction is as follows:  
\[\dot{p}_{tot}=\overline{\tau}_{M}-\tau_{f,tot}-G(q)+C^{\mathrm{T}}\big{(}q, \dot{q}\big{)}\dot{q}. \tag{6}\]  
To observe the disturbance friction torque \(\tau_{f,tot}\) and estimate the total joint friction torque, the virtual sensor algorithm is designed as follows:  
\[\mu=K_{\mu}[p_{tot}(t)-p_{tot}(0)-\int_{0}^{t}\big{(}\overline{\tau}_{M}-G(q)+ C^{\mathrm{T}}\big{(}q,\dot{q}\big{)}\dot{q}+\mu\big{)}dt], \tag{7}\]  
\[\dot{\mu}=K_{\mu}\big{(}\tau_{f,tot}-\mu\big{)}, \tag{8}\]  
where \(\mu\in\Re^{n\times 1}\) is the monitoring signal for estimating the total joint friction torque with the initial value \(\mu(t)=0\) and \(K_{\mu}=diag\big{[}k_{\mu,\dot{q}}\big{]}>0\) is the diagonal gain matrix.