A Novel Virtual Sensor for Estimating Robot Joint Total Friction Based on Total Momentum

Robot joint friction is an important and complicated issue in improving robot control performance. In this paper, a virtual sensor based on the total generalized momentum concept is proposed to estimate the total friction torque, including both the motor-side and link-side friction, of robot joints without joint torque sensors. The proposed algorithm only requires a robot joint dynamics model and not a complex friction model dependent on factors such as time and velocity. By compensating for the estimated friction torque with a robot joint controller, the trajectory tracking performance of the controller, especially the velocity tracking performance, can be improved. To verify the effectiveness of the developed algorithm, 2-DOF planar manipulator simulations and single-joint system experiments are conducted. The simulation and experimental results show that the designed virtual sensor can effectively estimate the total joint friction disturbance and that the controller trajectory tracking performance is improved after observed friction compensation. However, the position tracking performance improvement of the controller is less than that for the velocity tracking performance improvement during the experiments. In addition, the velocity step response ability and velocity tracking performance of the controller are improved more at low velocities than that at high velocities in the experiments. The proposed algorithm has engineering and theoretical significance for estimating robot joint friction and improving the performance of robot joint controllers.


Introduction
In recent years, robotic intelligent control technology has been rapidly developed. The effects of robot joint friction can strongly influence the system control performance, and friction identification and compensation techniques play important roles in robot control applications [1][2][3]. Friction can result in 50% errors for some heavy industrial manipulators [4]. Therefore, to achieve a good control performance and high position and velocity tracking accuracy, the friction torque must be adequately determined, and a compensation technique must be employed.
Friction identification and compensation are basic issues in motion control, so there is a large body of literature on these topics, only a small part of which is cited here. Some static friction model methods have been proposed, such as the classical Coulomb and viscous model [5][6][7]. The main idea of the model is that friction opposes motion and that its magnitude is independent of velocity and contact area. Another classical static model is the Stribeck method [8], in which friction decreases with the increase of velocity in the low-velocity status. When velocity exceeds a threshold, friction will increase with the velocity. Besides, some modified Stribeck methods, such as Armstrong's model [9], have also been proposed. However, these static models have all failed to describe the dynamic properties of friction.
For this reason, some dynamic friction models were proposed, such as the Dahl model [10,11], Bristle model [12,13], and LuGre model [14][15][16]. Although these models can describe the dynamic properties of friction, the Dahl model cannot describe the static friction and Stribeck effects. Besides, the Bristle model is complex and is inefficient in simulations due to its complexity. Furthermore, it is difficult to identify the friction parameters of the LuGre model. In addition, some friction models that consider temperature have been proposed in [17][18][19]. Although these models can describe some features of friction to a certain extent, unknown friction models are extremely complex because friction is related to many factors, such as the relative velocity, displacement, temperature, and material properties of the contact surfaces. Therefore, these model-based methods, both static friction models and dynamic friction models, are relatively inaccurate since they cannot describe the complete friction characteristics.
In addition to those friction model-based methods, Proportion-Differentiation control which does not rely on the specific friction models is the earliest way to solve the friction effects [20]. However, high gain coefficients will result in system instability. Besides, some adaptive algorithms [21,22] and sliding mode control techniques [23,24] have been used to cope with problems related to friction variations with time, system operating conditions, and other factors. These approaches seem to provide appropriate solutions, but there are two main problems [25] that should be considered. First, some friction parameters in these algorithms are difficult to determine. Second, some system dynamics that depend on the unknown parameters noted above are not measurable. To solve the first problem, an adaptive parameter estimation method [26] was proposed. Recently, reinforcement learning [27,28], repetitive control [29,30], fuzzy control [31][32][33], and neural network techniques [34][35][36] have been applied for friction estimation to identify and compensate for friction by training models based on massive amounts of data, such as joint velocity and acceleration data. However, the real-time performance of such intelligent methods is usually bad and it is difficult to implement them in real applications. In addition, computationally expensive calculations that require extensive and long hours of training can increase the burden on the controller. Furthermore, the fuzzy rules are usually difficult to obtain and fuzzy control effects are not ideal. Recently, torque sensor-based methods [37][38][39] have been used to solve the problem of robot joint friction. In these methods, torque sensors are fixed at the robot joints to measure torque. The torque sensor reading data contain friction torque and friction does then not need to be considered in the robot dynamics equations. Although this method does not need to consider a friction model and has good control effects, the cost of torque sensors is expensive and it is also difficult to fix these sensors in a robot. Besides, it can also increase the difficulty of robot wiring. Disturbance observers [40][41][42], which are also not based on a particular friction model, have been typically used in robotics control and have generally displayed a good practical performance in recent years. The principle of the disturbance observer is to establish the nominal model of the robot object, and various disturbance torques, including friction, are then obtained from the output residual between the actual model and the nominal model. Specifically, in [40], a friction observer was designed that was inspired by momentum-based collision detection algorithms [43][44][45]. In the friction observers, friction is regarded as an external disturbance. However, this approach only considers the motor momentum and the motor-side friction, and the relation between link-side momentum and link-side friction is not taken into account. In addition, joint torque sensing devices are needed in the aforementioned friction observer. Recently, a sensorless friction observer based on generalized momenta was proposed for an elastic joint robot [46]. However, this approach also failed to consider the link-side momentum and link-side friction.
In this paper, a virtual sensor is developed to estimate the total friction torque of robot joints, which is based on the concept of total momentum considering both motor momentum and link momentum without joint torque sensors. The advantages of this method are that a complicated friction model is not required and only a joint dynamics model is needed. In addition, this approach does not require the acceleration signals and does not need to solve the inverse of the inertia matrix. Moreover, there is only one simple diagonal gain coefficient matrix to adjust in this algorithm, thereby avoiding excessive and complex parameter adjustment and yielding a practical method. The main contributions of this paper are as follows: (1) To the knowledge of the authors, it is the first study to introduce the total momentum concept to estimate the total joint friction, including both the motor-side friction and link-side friction; (2) a simple and fast manual tuning rule is introduced to adjust the gain coefficient of virtual sensors during the experiments; and (3) the joint torque sensors in the proposed algorithm are not needed because the motor torque is estimated by the current in our developed driver.
The paper is organized as follows. Section 2 describes the theoretical derivation process of the virtual observer for robot joints and proves the whole system stability. Section 3 sets up a 2-DOF planar manipulator simulation, and the simulation results are analyzed in detail. In Section 4, velocity step experiments, sinusoidal trajectory tracking experiments, and payload experiments are conducted to verify the effectiveness of the proposed algorithm for a single-joint system. Finally, the discussion and conclusions are given in Section 5.

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: where q ∈ n×1 are the generalized coordinates used to uniquely determine the positions of links, θ ∈ n×1 are the generalized coordinates associated with the positions of motors, M(q) ∈ n×n is the symmetric and positive-definite inertia matrix of links, C q, . q ∈ n×n is the centripetal and Coriolis matrix of links, G(q) ∈ n×1 is the gravity vector of links, and B ∈ n×n is the diagonal positive-definite motor inertia matrix. On the right-hand side of Equations (1) and (2), τ J ∈ n×1 is the joint torque, τ M ∈ n×1 is the active motor torque, τ f ,l ∈ n×1 is the friction torque acting on the link side of the joints, and τ f ,m ∈ n×1 denotes the friction torque acting on the joint motors. β ∈ n×n is the diagonal positive-definite reduction radio matrix. Equations (1) and (2) can be combined to obtain the following expression: where B = βB, τ M = βτ M , and τ f ,tot = βτ f ,m + τ f ,l . In the dynamic system described by Equation (3), the total friction τ f ,tot ∈ n×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, τ 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 ∈ n×1 is given by q , which is equivalent to the following identity: 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: To observe the disturbance friction torque τ f ,tot and estimate the total joint friction torque, the virtual sensor algorithm is designed as follows: .
where µ ∈ n×1 is the monitoring signal for estimating the total joint friction torque with the initial value µ(t) = 0 and K µ = diag k µ,i > 0 is the diagonal gain matrix. Equation (8) indicates that a virtual sensor or friction observer is essentially a stable, linear, and decoupled first-order filter. For the convenience of programming and reducing the cumulative error, the iterative form of Equation (7) is given as follows: with η q, q. In this equation, T is the sampling time, i and i + 1 denote the ith time and (i + 1)th time, respectively.
, which is equivalent to the following identity: Based on the expression of the dynamics of the actual total momentum tot p , and combining Equations (3) and (5), the time evolution of tot p with friction is as follows: To observe the disturbance friction torque , f tot  and estimate the total joint friction torque, the virtual sensor algorithm is designed as follows: where 1 n    is the monitoring signal for estimating the total joint friction torque with the initial (8) indicates that a virtual sensor or friction observer is essentially a stable, linear, and decoupled first-order filter. For the convenience of programming and reducing the cumulative error, the iterative form of Equation (7) is given as follows: In this equation, △T is the sampling time, i and i + 1 denote the ith time and (i + 1)th time, respectively.  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.

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  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.

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 Appl. Sci. 2019, 9, 3344 5 of 20 where H(q) = M(q) + βB has the same symmetric and positive-definite property as M(q) [47]. The control law without friction compensation is shown below: where K p and K d are diagonal positive-definite gain matrices. e = q d − q, 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 Combining (10) with (12), (10) can be modified as ..
Due to H(q) being invertible, (13) can be modified as By using .
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] e /2 + e T K p e /2.
Then, Equation (18) can be modified as Combining Equations (15) and (19) can be rewritten as Substituting . e = .. 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 e, . e = (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].

Simulation Setup
To verify the performance of the algorithm proposed above, a 2 degrees of freedom (DOF) planar manipulator with gravity is simulated. A schematic diagram of the manipulator is shown in Figure 2. It is assumed that the mass of every rod is at the center of each link, and links have a weight of 0.5 kg and lengths of 1 m and 0.8 m for link 1 and 2, respectively. The reduction radio is β 1 = β 2 = 1. The rotor inertia of motors is J 1 = J 2 = 10 −4 kg·m 2 . The moment of inertia of the links relative to the Z-axis at the centers of mass (COM) is set as I 1 = 0.15 kg·m 2 and I 2 = 0.1 kg·m 2 , respectively. Each joint of the simulated robot is controlled by classical inverse dynamics control. A diagram of the manipulator model is shown in Figure 2. The dynamics of the robots with friction disturbances are described as follows: where τ M is known and calculated by the controller noted above. The PD coefficients in Figure 1 are manually tuned to K p1 = 100, K p2 = 100, K d1 = 5, and K d2 = 5.
Appl. Sci. 2019, 9, x FOR PEER REVIEW 6 of 21 joint of the simulated robot is controlled by classical inverse dynamics control. A diagram of the manipulator model is shown in Figure 2. The dynamics of the robots with friction disturbances are described as follows: where M  is known and calculated by the controller noted above. The PD coefficients in Figure 1 are manually tuned to To verify the ability of the algorithm to estimate the total friction torque, a desired friction disturbance torque is needed. Therefore, the classic and complex Stribeck friction model is selected as the desired disturbance:

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 disturbance curves of joint 1 and 2 for different values of K μ 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 To verify the ability of the algorithm to estimate the total friction torque, a desired friction disturbance torque is needed. Therefore, the classic and complex Stribeck friction model is selected as the desired disturbance:

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 Appl. Sci. 2019, 9, 3344 7 of 20 disturbance curves of joint 1 and 2 for different values of K µ 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. 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. The virtual sensor, which is essentially a first-order low-pass filter, can suppress the high-frequency measurement noise signal, but not the low-frequency dynamic model errors signal [43]. Therefore, the performance of the designed virtual sensor for estimating the joint friction torque strongly depends on the dynamic model accuracy.   1 The root mean squared errors (RMSE) of estimated friction torque errors. T represents a transpose. To verify the accuracy of the estimated friction torque from the observer and the performance improvement in controller trajectory tracking based on the observed friction compensation, we performed another simulation in which the observed friction was compensated for by the robot controller. Then, we analyzed and compared the simulated trajectory tracking results for each robot joint. The input position for the simulation was a cosine curve: qd = −cos(πt) + 1. The desired velocity was the derivative of this desired position. The desired friction disturbance, controller parameters, and robot dynamic inertia parameters are given above. The diagonal gain matrix K μ of the observer was selected as [360 0; 0 260]. The joint position and velocity tracking errors before and after friction compensation are shown in Figure 4. To save space, only the curves of joint 1 are given. Figure 4a,b illustrate that the friction disturbance affects the joint motion performance. The blue curves show that the RMSE of position error is 3.3 × 10 −2 rad and the RMSE of velocity error is 4.5 × 10 −2 rad/s for joint 1 without friction torque compensation. To eliminate the effects of the friction disturbance and achieve a better motion control performance, the friction observed by the virtual sensor is compensated for by the controller. The results after compensation are the red curves shown in Figure 4.
Notably, the RMSE of position error reduces to 1.7 × 10 −2 rad, and the RMSE of velocity error reduces to 2.2 × 10 −2 rad/s for joint 1 with friction torque compensation. Compared with the case with no friction torque compensation for the controller, the position and velocity tracking performance of joint 1 significantly improve. More error data have been presented in Table 2, which shows that the RMSE of position error decreases by 48.5% and the RMSE of velocity error is reduced by 51.1% in the simulations due to friction torque compensation. Therefore, it can be concluded that the estimated total friction torque is sufficiently accurate and that the joint trajectory tracking performance of the controller is enhanced by compensating for the observed friction torque in the controller.

Experiment and Analysis
To verify the accuracy of the proposed algorithm, experiments without payload were firstly performed using the single-joint platform shown in Figure 5. Then, experiments with link payload after the gearbox were conducted. The brushless motor was a Maxon EC-4pole 30 and the gearbox type was Maxon GP 42C. The related motor and gearbox parameters are listed in Table 3. The driver  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 µ . When the value of K µ is large, the virtual sensor error is low. In contrast, the estimated error increases as K µ 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 µ can change the filtering performance and estimated accuracy. However, a large K µ value is not always adequate because too large a value will increase the amount of observed noise. Conversely, a small K µ value generates large estimation errors, and the observed results are smooth at the cost of some delay. Therefore, the selection of K µ 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 µ1 = 360 and K µ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. The virtual sensor, which is essentially a first-order low-pass filter, can suppress the high-frequency measurement noise signal, but not the low-frequency dynamic model errors signal [43]. Therefore, the performance of the designed virtual sensor for estimating the joint friction torque strongly depends on the dynamic model accuracy.
To verify the accuracy of the estimated friction torque from the observer and the performance improvement in controller trajectory tracking based on the observed friction compensation, we performed another simulation in which the observed friction was compensated for by the robot controller. Then, we analyzed and compared the simulated trajectory tracking results for each robot joint. The input position for the simulation was a cosine curve: q d = −cos(πt) + 1. The desired velocity was the derivative of this desired position. The desired friction disturbance, controller parameters, and robot dynamic inertia parameters are given above. The diagonal gain matrix K µ of the observer was selected as [360 0; 0 260]. The joint position and velocity tracking errors before and after friction compensation are shown in Figure 4. To save space, only the curves of joint 1 are given. Figure 4a,b illustrate that the friction disturbance affects the joint motion performance. The blue curves show that the RMSE of position error is 3.3 × 10 −2 rad and the RMSE of velocity error is 4.5 × 10 −2 rad/s for joint 1 without friction torque compensation. To eliminate the effects of the friction disturbance and achieve a better motion control performance, the friction observed by the virtual sensor is compensated for by the controller. The results after compensation are the red curves shown in Figure 4.
Notably, the RMSE of position error reduces to 1.7 × 10 −2 rad, and the RMSE of velocity error reduces to 2.2 × 10 −2 rad/s for joint 1 with friction torque compensation. Compared with the case with no friction torque compensation for the controller, the position and velocity tracking performance of joint 1 significantly improve. More error data have been presented in Table 2, which shows that the RMSE of position error decreases by 48.5% and the RMSE of velocity error is reduced by 51.1% in the simulations due to friction torque compensation. Therefore, it can be concluded that the estimated total friction torque is sufficiently accurate and that the joint trajectory tracking performance of the controller is enhanced by compensating for the observed friction torque in the controller.

Experiment and Analysis
To verify the accuracy of the proposed algorithm, experiments without payload were firstly performed using the single-joint platform shown in Figure 5. Then, experiments with link payload after the gearbox were conducted. The brushless motor was a Maxon EC-4pole 30 and the gearbox type was Maxon GP 42C. The related motor and gearbox parameters are listed in Table 3. The driver and controller were developed by the authors in DSP and PC. The developed driver consisted of a TI DRV8301-HC-EVM board attached to a microcontroller unit TMS320F28035. The communication mode between the driver and the controller was the serial communication. The supply voltage was 24 volts. The controller algorithm was classical inverse dynamics control. It should be known that the gravity term should be ignored in the controller when there is no payload. The control and sampling periods were set to 1 ms. Two types of experiments, a velocity step experiment and a sinusoidal trajectory tracking experiment, were conducted. The velocity step experiment was performed to determine the appropriate gain coefficient K µ because the actual friction disturbance was not known. In addition, the velocity step experiment was conducted to verify that the observed friction disturbance compensation improved the ability of the controller to obtain a better velocity step response. The sinusoidal trajectory tracking experiment was used to validate that the observed friction torque compensation by the controller can be used to improve the trajectory tracking accuracy. Furthermore, to observe the effects of the velocity magnitude and payload on the observed friction torque and the effects of friction compensation on the trajectory tracking performance, motor low-and high-velocity motion experiments, without payload and with payload experiments, were performed. It should be noted that, when there is no payload, the gravity, centripetal, and Coriolis terms should be ignored in (9) in the single-joint system. When the payload is added, only the centripetal and Coriolis terms should be ignored. All the simulations and experiments data are available at the link in the supplementary materials below. mode between the driver and the controller was the serial communication. The supply voltage was 24 volts. The controller algorithm was classical inverse dynamics control. It should be known that the gravity term should be ignored in the controller when there is no payload. The control and sampling periods were set to 1 ms. Two types of experiments, a velocity step experiment and a sinusoidal trajectory tracking experiment, were conducted. The velocity step experiment was performed to determine the appropriate gain coefficient K μ because the actual friction disturbance was not known. In addition, the velocity step experiment was conducted to verify that the observed friction disturbance compensation improved the ability of the controller to obtain a better velocity step response. The sinusoidal trajectory tracking experiment was used to validate that the observed friction torque compensation by the controller can be used to improve the trajectory tracking accuracy. Furthermore, to observe the effects of the velocity magnitude and payload on the observed friction torque and the effects of friction compensation on the trajectory tracking performance, motor low-and high-velocity motion experiments, without payload and with payload experiments, were performed. It should be noted that, when there is no payload, the gravity, centripetal, and Coriolis terms should be ignored in (9) in the single-joint system. When the payload is added, only the centripetal and Coriolis terms should be ignored. All the simulations and experiments data are available at the link in the supplementary materials below.

Motor Low-Velocity Experiment
The desired low-velocity step sent to the controller was 346 rad/s. The experimental results are shown in Figures 6-8. Figure 6a shows that the velocity step response time required to reach the desired velocity is different for different K μ . When there is no friction compensation, the step response is the slowest and the time is 0.051 s. When K μ is 50, the step response is the fastest (0.041 s) and the step response performance improves by 19.6%. Although the velocity step response performance can also be improved with no friction compensation when K μ is 10 or 100, it is not better than that when

Motor Low-Velocity Experiment
The desired low-velocity step sent to the controller was 346 rad/s. The experimental results are shown in Figures 6-8. Figure 6a shows that the velocity step response time required to reach the desired velocity is different for different K µ . When there is no friction compensation, the step response is the slowest and the time is 0.051 s. When K µ is 50, the step response is the fastest (0.041 s) and the step response performance improves by 19.6%. Although the velocity step response performance can also be improved with no friction compensation when K µ is 10 or 100, it is not better than that when K µ is 50. Therefore, the system can display a better velocity step response performance when an observed friction disturbance is compensated for by the controller. In addition, the observed friction disturbance is more reasonable when K µ is 50 because the controller displays a better velocity step response ability than at other K µ values. However, we should not fully determine the appropriate gain coefficient by only considering this one result. Therefore, next, we analyzed the actual motor torque curve and observed the total friction disturbance curve to confirm the choice of K µ . It should be noted that all the actual step velocities stabilized after reaching the desired velocity. More data are listed in Table 4.
Appl. Sci. 2019, 9, x FOR PEER REVIEW 10 of 21 Kμ is 50. Therefore, the system can display a better velocity step response performance when an observed friction disturbance is compensated for by the controller. In addition, the observed friction disturbance is more reasonable when Kμ is 50 because the controller displays a better velocity step response ability than at other Kμ values. However, we should not fully determine the appropriate gain coefficient by only considering this one result. Therefore, next, we analyzed the actual motor torque curve and observed the total friction disturbance curve to confirm the choice of Kμ. It should be noted that all the actual step velocities stabilized after reaching the desired velocity. More data are listed in Table 4.
(a) (b) As shown in Figure 7, large values of Kμ result in large motor peak torques. When Kμ is 100, the motor torque reaches the largest peak torque of 0.1 N·m at time 0.003 s and −0.1 N·m at time 0.206 s, respectively. As shown in Figure 8, large values of Kμ generate more observed noise and large observed friction torques, which increase the motor peak torque after compensation by the controller. However, the safe torque limit of the motor is set to ± 0.1 N·m, so Kμ cannot be set to 100. Therefore, we conclude that the best Kμ is 50 among these three values. It should be noted that we did not find the best Kμ from 10 to 100 here, but just investigated how to determine the appropriate Kμ and provided the method for selecting this value. The two observed friction torque mutations in Figure 8 occur because the positive motor acceleration generates a negative friction torque from 0 s to 0.025 s and negative motor deceleration generates a positive friction torque from approximately 0.2 s to 0.22 s. This phenomenon is the same as that illustrated in the actual motor torque curve and is reasonable. It should be noted that when the motor velocity decreases to zero, the observed friction torque does not reach zero and ranges from −0.0058 to 0.0096 N m when Kμ is 50 because static friction exists in the single joint system.

Low-Velocity Step Response Time [s] High-Velocity Step Response Time [s]
No compensation 0.051 0.051  As shown in Figure 7, large values of K µ result in large motor peak torques. When K µ is 100, the motor torque reaches the largest peak torque of 0.1 N·m at time 0.003 s and −0.1 N·m at time 0.206 s, respectively. As shown in Figure 8, large values of K µ generate more observed noise and large observed friction torques, which increase the motor peak torque after compensation by the controller. However, the safe torque limit of the motor is set to ± 0.1 N·m, so K µ cannot be set to 100. Therefore, we conclude that the best K µ is 50 among these three values. It should be noted that we did not find the best K µ from 10 to 100 here, but just investigated how to determine the appropriate K µ and provided the method for selecting this value. The two observed friction torque mutations in Figure 8 occur because the positive motor acceleration generates a negative friction torque from 0 s to 0.025 s and negative motor deceleration generates a positive friction torque from approximately 0.2 s to 0.22 s. This phenomenon is the same as that illustrated in the actual motor torque curve and is reasonable. It should be noted that when the motor velocity decreases to zero, the observed friction torque does not reach zero and ranges from −0.0058 to 0.0096 N m when K µ is 50 because static friction exists in the single joint system.

Motor High-Velocity Experiment
The desired motor high-velocity step sent to the controller was 691 rad/s. As shown in Figure 6b and Table 4, the motor exhibits a better velocity step response performance when K µ is 50 and the velocity is high, similar to the results at low velocities. Additionally, the velocity step response performance is improved by 5.9%. Figure 9 shows that the actual motor torque exceeds the safety limit ± 0.1 N·m when K µ is 100 because the large K µ generates a large observed output, as shown in Figure 10. In addition, the actual motor torque includes more noise at high velocities compared to that at low velocities. Therefore, K µ equal to 50 yields a better gain coefficient than 10 or 100, and it is reasonable to conclude that the observed friction torque is more accurate when K µ is 50 than when K µ is 10 or 100. Therefore, 50 is selected as the final gain coefficient for both low-velocity and high-velocity motion in the experiments without payload.    The low-velocity and high-velocity step experiments indicated that the proposed algorithm can be effectively applied in different motion experiments. In addition, the controller velocity step response performance can be improved by compensating for the friction observed by the designed virtual sensor. Moreover, we give a simple and fast manual tuning rule for determining an appropriate observer gain coefficient for the problem of unknown priori knowledge of actual friction disturbance in robot joints.

Motor Low-Velocity Experiment
The desired low-velocity sinusoidal position trajectory was 16 πsin (0.8πt), and its first derivative was the desired velocity. Using the observer described in Section 2.1 and setting K μ to 50, the observed friction in the single-joint system is shown in Figure 11a. To observe the relationship between the actual motor velocity and estimated friction, we normalized these two variables in the range of −1 to 1 and show them together in Figure 11b.
The trend of the observed friction torque is always the opposite of that of the actual motor velocity. Furthermore, the observed friction torque abruptly changes when the actual motor velocity reaches zero. This phenomenon is consistent with the actual friction characteristics. In addition, it should be explained here that all the initial peak values and errors occurring from 0 s to 0.1 s in the figures below are caused by dynamic tracking of the controller, and it is more reasonable to only consider the static errors after 0.1 s. After compensation of the observed friction torque, the RMSE of motor trajectory tracking static errors were obtained and are listed in Table 5 and shown in Figure  11c  The low-velocity and high-velocity step experiments indicated that the proposed algorithm can be effectively applied in different motion experiments. In addition, the controller velocity step response performance can be improved by compensating for the friction observed by the designed virtual sensor. Moreover, we give a simple and fast manual tuning rule for determining an appropriate observer gain coefficient for the problem of unknown priori knowledge of actual friction disturbance in robot joints.

Motor Low-Velocity Experiment
The desired low-velocity sinusoidal position trajectory was 16 πsin (0.8πt), and its first derivative was the desired velocity. Using the observer described in Section 2.1 and setting K µ to 50, the observed friction in the single-joint system is shown in Figure 11a. To observe the relationship between the actual motor velocity and estimated friction, we normalized these two variables in the range of −1 to 1 and show them together in Figure 11b.
The trend of the observed friction torque is always the opposite of that of the actual motor velocity. Furthermore, the observed friction torque abruptly changes when the actual motor velocity reaches zero. This phenomenon is consistent with the actual friction characteristics. In addition, it should be explained here that all the initial peak values and errors occurring from 0 s to 0.1 s in the figures below are caused by dynamic tracking of the controller, and it is more reasonable to only consider the static errors after 0.1 s. After compensation of the observed friction torque, the RMSE of motor trajectory tracking static errors were obtained and are listed in Table 5 and shown in Figure 11c,d. The figures and table suggest that the position tracking performance of the controller with observed friction compensation did not obviously improve compared to the case without observed friction compensation. Specifically, the RMSE of static position tracking error decreased by 0.1% in Figure 11c. However, the velocity tracking performance of the controller with observed friction compensation considerably improved compared to the case without observed friction compensation, and the RMSE of static velocity tracking error decreased by 33.1%, as shown in Figure 11d.
Notably, friction disturbance torque acts inside the velocity loop, which results in friction disturbance torque having more effects on the performance of the velocity loop than that of the position loop. When friction disturbance torque is not compensated for by the controller, velocity errors will increase obviously because of the disturbance. However, the position loop is built on the velocity loop and position errors can be suppressed well by the position loop gain coefficient after velocity loop adjusting. After compensating for the observed friction torque, the velocity errors will be suppressed well. Then, the position loop can adjust the position errors more easily and position errors almost do not change compared with the no compensation condition. Therefore, the controller position tracking performance was not significantly improved; however, the controller velocity tracking performance was notably improved after observed friction torque compensation.
Appl. Sci. 2019, 9, x FOR PEER REVIEW 13 of 21 observed friction compensation did not obviously improve compared to the case without observed friction compensation. Specifically, the RMSE of static position tracking error decreased by 0.1% in Figure 11c. However, the velocity tracking performance of the controller with observed friction compensation considerably improved compared to the case without observed friction compensation, and the RMSE of static velocity tracking error decreased by 33.1%, as shown in Figure 11d. Notably, friction disturbance torque acts inside the velocity loop, which results in friction disturbance torque having more effects on the performance of the velocity loop than that of the position loop. When friction disturbance torque is not compensated for by the controller, velocity errors will increase obviously because of the disturbance. However, the position loop is built on the velocity loop and position errors can be suppressed well by the position loop gain coefficient after velocity loop adjusting. After compensating for the observed friction torque, the velocity errors will be suppressed well. Then, the position loop can adjust the position errors more easily and position errors almost do not change compared with the no compensation condition. Therefore, the controller position tracking performance was not significantly improved; however, the controller velocity tracking performance was notably improved after observed friction torque compensation.

Motor High-Velocity Experiment
The desired high-velocity sinusoidal position trajectory was 30 πsin (1.6πt), and its first derivative was the desired velocity. Compared with the low-velocity case above, the observed total friction torque mapped to the motor side at high velocities was slightly larger than that in Figure 11a and ranged from −6.4 × 10 −3 N·m to 2.2 × 10 −3 N·m, as shown in Figure 12a. In addition, the relationship between the actual motor velocity and estimated friction torque in Figure 12b was the same as in the low-velocity case. Moreover, the position tracking performance was improved less than that of the

Motor High-Velocity Experiment
The desired high-velocity sinusoidal position trajectory was 30 πsin (1.6πt), and its first derivative was the desired velocity. Compared with the low-velocity case above, the observed total friction torque mapped to the motor side at high velocities was slightly larger than that in Figure 11a and ranged from −6.4 × 10 −3 N·m to 2.2 × 10 −3 N·m, as shown in Figure 12a. In addition, the relationship between the actual motor velocity and estimated friction torque in Figure 12b was the same as in the low-velocity case. Moreover, the position tracking performance was improved less than that of the velocity by compensating for the observed friction torque, as shown in Table 5 and Figure 12c,d. The reason for this has been explained in the motor low-velocity experiment above. In addition, the velocity tracking performance at a high velocity was decreased compared with that under low-velocity conditions because more uncertainties, such as model uncertainties and noise, affected the performance of the observer and the estimated and compensated friction torque was then not accurate enough. Therefore, the velocity performance of the controller is improved more at low velocities than at high velocities.

Motor Low-Velocity Experiment
The desired position trajectory was 24 πsin (0.6πt) in motor low-velocity experiments with payload, and its first derivative was the desired velocity. The experiment time was extended to 20 s to see whether accumulative errors of the observer exist. The K µ was tuned to 80 by using the tuning method described in Section 4.1. The quality of the link payload as shown in Figure 13 is m = 0.55 kg, the distance of link COM is r c = 0.18 m, and the moment of inertia of the link relative to the Z-axis at the COM is I = 6.1 × 10 −3 kg·m 2 , which was measured in SolidWorks.
The observed friction torque (red curve) is shown in Figure 14a. It can be seen that the changes of observed friction torque are stable and there is no obvious accumulative errors with the increase of time. However, larger model uncertainties and more measurement noise might result in more obvious accumulative errors because of the integral item in the proposed virtual sensor as time goes by. In this condition, more accurate dynamics model and filtering processing are needed. In addition, it should be explained here that all the initial peak errors occurring from 0 s to 1 s in the figures below are caused by dynamic tuning and tracking of the controller, and it is more reasonable to only consider the static errors after 1 s. After the controller compensates for the observed friction torque, the RMSE of motor trajectory tracking static errors are obtained. These values are listed in Table 6 and shown in Figure 14b,c. The figures and table suggest that the position tracking performance of the controller with observed friction compensation did not obviously improve compared with the case without observed friction compensation. However, the velocity tracking performance of the controller with observed friction compensation considerably improved compared with the case without observed friction compensation, and the RMSE of static velocity tracking error decreased by 9.8%. The reason for this is that the controller position tracking performance was not significantly improved, but the controller velocity tracking performance was notably improved, after compensating for the observed friction torque, as has been explained in Section 4.2.1.

Motor Low-Velocity Experiment
The desired position trajectory was 24 πsin (0.6πt) in motor low-velocity experiments with payload, and its first derivative was the desired velocity. The experiment time was extended to 20 s to see whether accumulative errors of the observer exist. The K μ was tuned to 80 by using the tuning method described in Section 4.1. The quality of the link payload as shown in Figure 13 is m = 0.55 kg, the distance of link COM is r c = 0.18 m, and the moment of inertia of the link relative to the Z-axis at the COM is I = 6.1 × 10 −3 kg·m 2 , which was measured in SolidWorks.
Link payload Figure 13. The motor with link payload after the gearbox.
The observed friction torque (red curve) is shown in Figure 14a. It can be seen that the changes of observed friction torque are stable and there is no obvious accumulative errors with the increase of time. However, larger model uncertainties and more measurement noise might result in more obvious accumulative errors because of the integral item in the proposed virtual sensor as time goes by. In this condition, more accurate dynamics model and filtering processing are needed. In addition, it should be explained here that all the initial peak errors occurring from 0 s to 1 s in the figures below are caused by dynamic tuning and tracking of the controller, and it is more reasonable to only consider the static errors after 1 s. After the controller compensates for the observed friction torque, the RMSE of motor trajectory tracking static errors are obtained. These values are listed in Table 6 and shown in Figure 14b,c. The figures and table suggest that the position tracking performance of the controller with observed friction compensation did not obviously improve compared with the case without observed friction compensation. However, the velocity tracking performance of the controller with observed friction compensation considerably improved compared with the case without observed friction compensation, and the RMSE of static velocity tracking error decreased by 9.8%. The reason for this is that the controller position tracking performance was not significantly improved, but the controller velocity tracking performance was notably improved, after compensating for the observed friction torque, as has been explained in Section 4.2.1. The observed friction torque (red curve) is shown in Figure 14a. It can be seen that the changes of observed friction torque are stable and there is no obvious accumulative errors with the increase of time. However, larger model uncertainties and more measurement noise might result in more obvious accumulative errors because of the integral item in the proposed virtual sensor as time goes by. In this condition, more accurate dynamics model and filtering processing are needed. In addition, it should be explained here that all the initial peak errors occurring from 0 s to 1 s in the figures below are caused by dynamic tuning and tracking of the controller, and it is more reasonable to only consider the static errors after 1 s. After the controller compensates for the observed friction torque, the RMSE of motor trajectory tracking static errors are obtained. These values are listed in Table 6 and shown in Figure 14b,c. The figures and table suggest that the position tracking performance of the controller with observed friction compensation did not obviously improve compared with the case without observed friction compensation. However, the velocity tracking performance of the controller with observed friction compensation considerably improved compared with the case without observed friction compensation, and the RMSE of static velocity tracking error decreased by 9.8%. The reason for this is that the controller position tracking performance was not significantly improved, but the controller velocity tracking performance was notably improved, after compensating for the observed friction torque, as has been explained in Section 4.2.1. The desired position trajectory was 24 πsin (2πt) in motor high-velocity experiments with payload, and its first derivative was the desired velocity. The observed friction torque (red curve) is shown in Figure 15a. It can be found that the changes of observed friction torque are stable and there are also no obvious accumulative errors with the increase of time. The RMSE of motor trajectory

Motor High-Velocity Experiment
The desired position trajectory was 24 πsin (2πt) in motor high-velocity experiments with payload, and its first derivative was the desired velocity. The observed friction torque (red curve) is shown in Figure 15a. It can be found that the changes of observed friction torque are stable and there are also no obvious accumulative errors with the increase of time. The RMSE of motor trajectory tracking static errors are listed in Table 6 and shown in Figure 15b,c. It can be found that the velocity tracking performance after friction compensation was reduced compared with no friction compensation in high-velocity conditions. This is because more model uncertainties caused by the link payload and more measurement noise make the performance of the observer bad in high-velocity conditions. Therefore, the estimated and compensated friction torque is inaccurate, which causes the velocity tracking performance to decrease.

Motor High-Velocity Experiment
The desired position trajectory was 24 πsin (2πt) in motor high-velocity experiments with payload, and its first derivative was the desired velocity. The observed friction torque (red curve) is shown in Figure 15a. It can be found that the changes of observed friction torque are stable and there are also no obvious accumulative errors with the increase of time. The RMSE of motor trajectory tracking static errors are listed in Table 6 and shown in Figure 15b,c. It can be found that the velocity tracking performance after friction compensation was reduced compared with no friction compensation in high-velocity conditions. This is because more model uncertainties caused by the link payload and more measurement noise make the performance of the observer bad in highvelocity conditions. Therefore, the estimated and compensated friction torque is inaccurate, which causes the velocity tracking performance to decrease.

Comparison with the Classical Friction Model
In order to compare the proposed algorithm with the other friction model, comparison experiments were conducted. The Coulomb and viscous friction model is classical and common in real applications. Furthermore, less friction parameters need to be identified in this model, so it is selected as the comparison friction model. The Coulomb and viscous fiction parameters were tuned manually to obtain smaller trajectory tracking errors as far as possible. Finally, the friction model was designed as where F c is the Coulomb friction coefficient and is tuned to 2.8 × 10 −3 Nm.s/rad, F v is the viscous friction coefficient and is tuned to 1.1 × 10 −3 Nm.s/rad, . θ is the motor velocity, and τ f ,m is the motor-side friction torque.
The estimated friction torque (blue curves) calculated by (23) is shown in Figures 14a and 15a under low-velocity and high-velocity conditions, respectively. The RMSE of motor trajectory tracking static errors are listed in Table 6 and shown in Figure 14b,c and Figure 15b,c under low-velocity and high-velocity conditions, respectively. It can be found that the RMSE of motor velocity tracking static errors, after compensating for the friction torque estimated by the proposed method, are always less than those after compensating for the friction torque estimated by the Coulomb and viscous friction model, no matter whether the motor is in low-velocity and high-velocity conditions. This shows that the friction torque estimated by the proposed method is more accurate than that estimated by the Coulomb and viscous friction model. Notably, the Coulomb and viscous friction model cannot describe the complete and complex friction properties. However, more accurate friction torque can be observed by the proposed observer. Therefore, the proposed friction observer exhibits more accurate friction estimation than the Coulomb and viscous friction model. Finally, it should be also noted that only one parameter K µ in the proposed method needs to be tuned; however, two parameters are needed in the classical Coulomb and viscous friction model.

Discussion and Conclusions
In this paper, the total generalized momentum concept was introduced for the first time to design a virtual sensor for observing robot joint total friction torque, including both motor-side and link-side friction, without joint torque sensors. The advantage of the proposed algorithm is that a complicated friction model is not needed, and only a robot joint dynamics model is needed. By compensating for the observed friction with the controller, the controller performance, especially the velocity performance, was improved in low-velocity conditions. To validate the proposed method, simulations with a 2-DOF manipulator and experiments based on a single-joint system were conducted. The simulation results show that the virtual sensor can accurately estimate the desired friction disturbance by selecting the appropriate gain coefficient K µ . A large K µ made the observed results more precise; however, a large K µ value is not appropriate under all conditions. Too large a K µ value can increase the amount of noise in an estimation and reduce the estimation accuracy.
The experimental results show that the velocity step response of the controller can be improved by 6-10 ms for low-velocity motion and 1-3 ms for high-velocity motion after observed friction compensation. In addition, an appropriate gain coefficient K µ can be obtained by comparing the velocity step response times in the experiments. The velocity tracking performances without payload were improved by up to 33.1% for low-velocity motion and −1.2% for high-velocity motion, respectively. When the link payload was considered, the velocity tracking performances were improved by up to 9.8% for low-velocity motion; however, they displayed a value of −3.0% for high-velocity motion because of inaccurate friction estimation and compensation. Besides, the improvement in the position tracking performance of the controller was less than that for the velocity tracking performance in the experiments and the explanation for this has been given above. In addition, the velocity step response and velocity tracking performance of the controller improved more at low velocities than at high velocities in the experiments because more uncertainties, such as model error and noise, affect the performance of the virtual sensor and controller at high velocities. Furthermore, the results of the comparison experiments show that the proposed method can obtain more accurate friction torque estimation than the classical Coulomb and viscous friction model. Finally, it should be noted that although the method is only simulated for a 2-DOF robot and tested based on a single-joint system, the proposed method can be extended to multi-joint robots.
The observed total friction torque in the algorithm is only compensated for by classical inverse dynamics control in this paper. However, impedance controllers have been increasingly used in cooperative robots and compliant motion control. Therefore, the trajectory performance might be improved and compliance guaranteed with an impedance controller by compensating for the total joint friction observed by the algorithm. In addition, the proposed method was only tested for a single-joint system. Therefore, we will apply the algorithm to multi-joint robots with impedance controllers developed by our laboratory in the future.

Conflicts of Interest:
The authors declare no conflicts of interest.