# A Novel Virtual Sensor for Estimating Robot Joint Total Friction Based on Total Momentum
## 3 Simulation and Analysis
### Simulation Results and Analysis  
The simulation sampling time was 1 ms and the total simulation time was 15 s. In order to increase the reliability of the simulation results, sinusoidal position noise and velocity noise were added to the measurement. The position noise amplitude and frequency were set as 0.005 rad and 100 Hz, and the velocity noise amplitude and frequency were set as 0.01 rad/s and 100 Hz, respectively. Besides, a 2 ms torque delay was also added in the simulation. To assess the trajectory tracking performance, a cosine trajectory was used. The simulation results are shown below. The desired and estimated friction torque  
Figure 2: Link model of the 2-DOF planar manipulator. disturbance curves of joint 1 and 2 for different values of \(K_{\mu}\) are illustrated in Figure 3. A comparison of the position and velocity tracking errors with and without friction compensation is shown in Figure 4, and the root mean squared errors (RMSE) of estimated friction torque error data are given in Table 1.  
As shown in Figure 3, certain errors exist between the desired friction torque and the friction torque estimated by the virtual sensor for joints 1 and 2. Notably, the performance of the observer varies with different values of \(K_{\mu}\). When the value of \(K_{\mu}\) is large, the virtual sensor error is low. In contrast, the estimated error increases as \(K_{\mu}\) decreases because the designed virtual sensor is essentially a first-order low-pass filter, as shown in Equation (8), and the friction torque disturbance is associated with low-frequency information. Therefore, adjusting the value of \(K_{\mu}\) can change the filtering performance and estimated accuracy. However, a large \(K_{\mu}\) value is not always adequate because too large a value will increase the amount of observed noise. Conversely, a small \(K_{\mu}\) value \begin{table}
\begin{tabular}{c c c} \hline \hline \(K_{\mu}\) & **RMSE of Joint 1 [N-m] 1** & **RMSE of Joint 2 [N-m]** \\ \hline \(K_{\mu}=[10;5]^{\text{ T}}\) & 1.23 & 0.57 \\ \(K_{\mu}=[360,260]^{\text{ T}}\) & 0.25 & 0.09 \\ \(K_{\mu}=[800,750]^{\text{ T}}\) & 0.40 & 0.13 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The estimated friction torque errors for different gain coefficients (\(K_{\mu}\)). Figure 4: Comparison of the position and velocity tracking performance of joint 1 with and without friction compensation in the controller. (**a**) Position tracking error without friction compensation (NC) and with friction compensation (WC). (**b**) Velocity tracking error without friction compensation (NC) and with friction compensation (WC). Figure 3: The desired and estimated friction torque disturbance curves of joints 1 and 2 for different values of gain coefficients (\(K_{\mu}\)). (**a**) Joint 1 curves. (**b**) Joint 2 curves. generates large estimation errors, and the observed results are smooth at the cost of some delay. Therefore, the selection of \(K_{\mu}\) should be based on simultaneously obtaining both a high estimation accuracy and limited noise. Figure 3a,b show that the RMSE of estimated friction torque and noise are relatively small at \(K_{\mu 1}\) = 360 and \(K_{\mu 2}\) = 260 for joints 1 and 2, respectively. The RMSE of estimated friction torque are 0.25 N-m and 0.09 N-m for joints 1 and 2, respectively. It should be noted that the estimated errors for joints 1 and 2 are maximum at zero time because the absolute values of the desired static friction torque are [2, 0.3] N-m, but the values of the observer are [0, 0] N-m at zero time. More observed friction errors data can be found in Table 1. The simulations are performed under the conditions based on an exact dynamics model with some position and velocity measurement noise and current delay. However, model uncertainties, more noise, and more communication delays can lead to a poorer observation performance and larger estimation errors, especially dynamic modeling errors, in real applications.