An Adaptive Torque Observer Based on Fuzzy Inference for Flexible Joint Application

: Torque observation techniques have been widely employed to estimate the load torque of ﬂexible joints driven by a permanent magnet synchronous machine (PMSM). However, the performance of the observer degrades signiﬁcantly when the position and orientation of the robot continuously changes, resulting in substantial irregular load variations. In this paper, an adaptive torque observer based on fuzzy inference is proposed to overcome this issue. Instead of relying on theoretical or numerical derivation, the relationship between the load inertia and the closed-loop poles of the torque observer is expressed by fuzzy inference. This approach enables the ﬂexible conﬁguration of the poles based on the load inertia, allowing for automatic tuning of the gain matrix. Consequently, the observer can ensure robustness and maintain superior performance under varying load conditions. The effectiveness of the proposed observer is validated through simulation and experimental results. It shows that compared to the classical Luenberger observer, the proposed adaptive torque observer can achieve more accurate observation results and exhibits a more dynamic response in the presence of varying load inertia.


Introduction
Collaborative robots driven by a permanent magnet synchronous machine (PMSM) are now widely used in various applications, particularly in industrial automation. To achieve superior external force control and motion control performance while ensuring the safety of human-robot collaboration, the utilization of joint torque feedback (JTF) technology is crucial and has gained significant recognition in the robotics community [1][2][3]. Real-time measurement or estimation of the joint load torque is necessary in order to achieve precise JTF control performance.
Currently, torque sensors based on strain gauges [4], optical sensors [5], or encoders [6] are commonly employed to measure joint torque. However, the use of torque sensors unavoidably increases the size, weight, and cost of the joints, while also reducing their reliability and maintainability. Furthermore, the inclusion of torque sensors introduces an additional elastic chain that affects the accuracy of joint control.
To tackle this issue, the industry has shifted its research focus towards torque observation techniques, which have emerged as an important research direction due to their efficiency, cost-effectiveness, and convenience in obtaining the joint load torque with minimal mechanical modifications. Several torque observation techniques have been proposed to estimate the load torque of flexible joints, such as a disturbance observer [7], sliding mode observer [8], Kalman filter [9], and Luenberger observer [10].
Due to its simplicity in parameter selection and flexibility in implementation, the Luenberger observer is widely used in industrial applications. However, it lacks sufficient robustness against measurement noise and parameter mismatch. Achieving proper performance requires a suitable selection of the observer gain matrix, which becomes challenging under various load conditions. Researchers have conducted exploratory research to address these issues. In [11], the left-shifting pole-placement method, which is widely used, is implemented. The observer gain matrix is considered as a general function to satisfy multiple conditions. However, it lacks analysis and comparison of the observer performance in the full-speed region. In [12], the gain matrix is derived at a specific rotational speed and scaled linearly with the speed as it varies. But this approach may cause instability due to the high imaginary part of observer poles. Thus, the root locus for the entire speed range is used to optimize the pole assignment, considering the trade-off between response time and robustness. In [13], an adaptive law is deduced based on adaptive control theory by correcting the error between the adjustable model and the reference model. Consequently, the gain matrix of the observer can be calculated accordingly. In [14], the observer gain matrix is calculated through a series of numerical equations derived by adopting a proportional and integral adaptive scheme. Additionally, some scholars have employed optimization algorithms to design the Luenberger observer gain matrix, for instance, the grey wolf optimizer algorithm [15], the numerically nonlinear least squares algorithm [16], and the H ∞ optimization algorithm [17].
The fuzzy system is recognized for its ability to express complex relationships that are not easily captured by classical logic. It is particularly suitable for situations involving significant uncertainties or unknown variations in plant parameters and structures [18][19][20][21]. In this paper, the relationship between the load and the closed-loop poles of the torque observer is expressed by using fuzzy inference, rather than relying on theoretical or numerical derivation. Thus, an adaptive load torque observer is proposed and implemented, demonstrating its capability to ensure robustness and maintain superior performance across various load conditions. The paper is organized as follows. In Section 2, the dynamic model of the flexible joint is presented. Then, in Section 3, the shortcoming of the classical Luenberger torque observer under load variations are presented. In Section 4, to address the shortcoming, an adaptive torque observer-which is based on the classical Luenberger observer structure, combining the fuzzy inferencer and online inertia identification technique-is proposed and theoretically explained. Finally, the proposed observer is validated through simulations and experiments, consistently demonstrating superior performance under wide load variations, as shown in Section 5. Figure 1 exhibits a typical transmission model of the flexible joint driven by a PMSM for the use of the cooperative robot, which is mainly composed of a servo motor, a controller, a harmonic drive, a brake, and two encoders. In this model, the harmonic drive is equivalent to the damper-spring system with the stiffness K s , the damping D s , the transmission ratio N, and the backlash b. The electromagnetic torque T M and the shaft torque T s act together on the motor, whose moment of inertia is J M and friction torque coefficient is D M , to decide the motor speed ω M . Meanwhile, the load torque T L and the shaft torque T s act together on the joint, whose moment of inertia is J L and friction torque coefficient is D L , to decide the load speed ω L . The system dynamic model of the flexible joint is depicted in Figure 2. Since the collaborative robot joints utilize a harmonic drive with a relatively large transmission ratio to maximize torque density, the transmission backlash can be neglected. As a result, the mathematical model of the system can be derived as Equations (1)-(5):

System Modeling of Flexible Joint
θ L (5) It is assumed that the load torque T L = 0 Nm, the transfer function between motor speed ω M , and motor electromagnetic torque T M can be derived as Equation (6): Assuming that the system damping D M , D S , and D L is neglected, the eigenvalues λ p that determine the behavior of the joint model shown in Equation (6) are provided by:

Observer Design
Based on the system dynamic model described in Equations (1)-(5), the state space equations of the flexible joint can be written as: where x is the state vector, A is the state matrix, B is the control matrix, C is the output matrix, u is the input signal matrix, and y is the output signal matrix. The full-order Luenberger observer for state variables x can be defined by the state equations shown below: where T , u = T M , and y = ω M . The state matrix A, control matrix B, output matrix C, and gain matrix L of the Luenberger observer are provided as follows: The symbolˆdenotes the estimated value of the state variable, and L is the observer gain matrix designed to achieve the required performance of the observer. Since both the matrixes [B AB A 2 B A 3 B] and [C CA CA 2 CA 3 ] are full rank, the plant system is controllable and observable.
The estimation error of state variables is e = x −x. To ensure that the observation error of the state variables converges to zero, the observer gain matrix needs to be reasonably designed. As we know, the pole placement method is a well-established method for gain matrix design. According to this method, the closed-loop poles λ P of the observer should be configured in the negative half-axis region, that is Re[λ (A-LC) ] < 0, to make the state matrix (A-LC) of the observer asymptotic stable. Thus, the observer gain matrix L can be solved according to Equation (12). To reduce matrix operation and improve the DSP calculation efficiency of the servo driver, the poles of the observer are usually configured at the same point on the negative half-axis. As a result, it can be obtained that: According to Equation (12), the gain matrix L can be computed as follows: The aforementioned equations enable the closed-loop poles of the observer to be placed in desired positions. However, it is important to consider the distance between the pole configuration and the origin of the observer. If the distance is less than that of the plants, the observer will be unable to accurately capture the real-time response of the system state. On the other hand, if the observer pole configuration is too large, it will amplify measurement noise, leading to erroneous observation results. Therefore, it is necessary to allocate the observer poles to account for parameter variations while maintaining performances. Furthermore, it is crucial to note that both measurement noise and parameter mismatches significantly impact the stability and effectiveness of the pole configuration. In other words, the key aspect of designing the torque observer for the flexible joint lies in the reasonable allocation of closed-loop poles considering parameter variations.

Observer Performance Analysis
The torque observer utilized in the flexible joint demonstrates reasonable robustness, as discussed in Section 3.1. However, parameter mismatches can lead to an unstable dynamic response. The stiffness K s of the harmonic drive, the moment of inertia J M , and the friction torque coefficient D M can be accurately obtained from the manufacturer datasheet. Nevertheless, in many applications, the load of the joint varies greatly, which can significantly degrade the performance of the torque observer. If the gain matrix of the observer remains fixed, the performance cannot be guaranteed when the load inertia of the flexible joint is substantially higher than the original inertia. The following provides a quantitative explanation, as derived from Equation (2): where ∆J L = J L −Ĵ L is the difference between the nominal and actual load inertias, and ∆D L = D L −D L is the difference between the nominal and the actual load friction torque coefficients. It is important to note that when there are differences between the nominal and actual parameters, the estimated load torque will be contaminated by inaccurate system parameters. An offline parameter identification method is used to calibrate the load friction torque coefficients. The result of the calibration test is provided in Figure 3. According to the test result, the viscous friction torque coefficient of the joint is 5.5 × 10 −4 Nm·s/rad and the Coulomb torque friction coefficient is 0.0435 Nm. The speed and friction torque correspondence table can be used to compensate for torque observation error caused by the mismatch of friction coefficients.
It should be noted that during the operation of the cooperative robot, the position and orientation of the robot arm continuously changes. Thus, the equivalent load inertia and load torque of each joint also undergo constant variations. Therefore, the offline parameter identification method is not suitable in this scenario.
Subsequently, simulation and experimental results are used to estimate the influence of load inertia mismatch on observer performance. The specification of the flexible joint is presented in Table 1. In the simulation, a constant load is applied to the flexible joint at time t = 0 s, with the load torque T L = 43 Nm and the load inertia J L = 2 kg·m 2 . Band-limited white noises are introduced to the measurement signal of motor speed ω M and motor current I M , simulating the measurement noise from encoders and current sensors.  When the closed-loop poles of the torque observer are configured at λ P = −50, the load torque can be accurately estimated within 0.4 s if there is no parameters mismatch of load inertia J L , as depicted by the solid line in Figure 4a. The dotted line and dashed line in Figure 4a represent the simulation results when the load inertia is changed to 0.2 times and 5 times, respectively. It can be seen that when there is a load inertia mismatch (J set = 0.2 J L ), the observer torque exhibits a larger overshoot and takes longer to reach a steady state. Conversely, if the load inertia of the torque observer is set to a value greater than the actual inertia (J set = 5 J L ), the observer torque curve remains similar, although the estimated torque error is larger. While the poles of the observer are set at λ P = −200, as illustrated in Figure 4b, the load torque is accurately estimated within 0.1 s, which is significantly faster than the poles are configured at λ P = −50. This is because placing the poles farther results in a larger gain matrix for the observer, leading to a faster response. However, it should be noted that when the load inertia of the torque observer is set to a value greater than the actual inertia (J set = 5 J L ), a considerably higher estimated torque error occurs, primarily due to measurement noise.
To verify the simulation results in Figure 4, experimental results are presented under the same load inertia variations in Figure 5. In the experiment, the sampling periods for the position-loop and speed-loop are 200 µs, while the sampling period of the current-loop is 100 µs. The joint is operated in position control mode to keep the load test tooling in a horizontal position while a 7.5 kg mass disc is mounted on it, of which the load torque T L = 43.6 Nm and the load inertia J L = 2.15 kg·m 2 . When the poles of the observer are configured at λ P = −50, it can be observed from Figure 5a that the estimated load torque requires over 6 s oscillations to stabilize when J set = 0.2 J L . This is due to the relatively small observer gain in this pole configuration, resulting in a long stabilization time. However, for J set = J L and J set = 5 J L , the observer gain is appropriate without amplifying the measurement noise. On the other hand, when the observer poles are set at λ P = −200, as shown in Figure 5b, the estimated load torque stabilizes within approximately 0.1 s, which is much faster compared to the configuration with λ P = −50 when J set = 0.2 J L and J set = J L . However, when J set = 5 J L , the large observer gain leads to an overshoot of nearly 100% and significantly amplifies the measurement noise. The simulation and experimental results demonstrate that the classical Luenberger torque observer, with a fixed gain matrix L, exhibits deteriorated performance when there are significant variations in the load inertia. Consequently, to achieve more accurate load torque observation results, it is necessary to identify the load inertia and employ an adaptive pole placement strategy. By adopting the observer poles configuration based on the varying load inertia, it becomes possible to enhance the performance and obtain more precise estimations of the load torque.

Fuzzy Inference-Based Torque Observer
As discussed in Section 3.2, the pole placement method is utilized for designing the gain matrix of the torque observer. Based on control theory, the poles of the observer are typically selected to converge 10 times faster than those of the plant system, striking a tradeoff between responsiveness and stability [22]. In this section, an adaptive load torque observer is proposed, as shown in Figure 6. The main difference between the proposed torque observer and the classical Luenberger torque observer is that the gain matrix L can be autotuned online as the load varies. For the classical Luenberger torque observer, the gain matrix L is derived theoretically or numerically at rated condition. For the proposed observer, the relationship between the load and the gain matrix L is expressed by using the fuzzy inferencer with online inertia identification. This approach enables the establishment of a practical performance relationship between the closed-loop poles λ P and the load inertia J L . By leveraging expert knowledge derived from simulation and experimental results, the adaptive observer can ensure superior performance across various load conditions. The fuzzy inference method is chosen for its effective handling of nonlinear control tasks and suitability for modeling and controlling complex, ill-defined dynamic processes [23,24].

Online Inertia Identification
To mitigate the impact of load inertia mismatch, an online parameter identification method is necessary. In [25], an inertia identification method based on the speed response is presented which employs sinusoidal rotational speed as excitation. In [26], the researchers utilize a disturbance observer to estimate external disturbances and friction in the model, subsequently obtaining an estimate of inertia. Comparatively, the sliding mode observer offers advantages such as robustness against disturbances and low sensitivity to parameter variations throughout the system [27]. Additionally, the model reference adaptive method [28] and recursive least squares method [29] are viable options for online inertia identification in servo systems.
In this paper, the forgetting factor recursive least squares (FFRLS) method, which is straightforward to implement and avoids data saturation in the recursion process, is adopted to identify the load inertia. Given the sufficiently high sampling frequency of the servo driver, the inertia identification expression for the flexible joint, based on FFRLS, can be derived as follows: where t s is the sampling time. According to the FFRLS method design rules, Equations (19)- (23) can be obtained: where θ(n) is the estimated value of the parameters at n time, y(n) is the measured motor speed, ϕ(n) is the input matrix, P(n) is the covariance matrix, K(n) is the gain vector, and λ is the forgetting factor. The tracking ability and parameter fluctuation of FFRLS are greater with a smaller forgetting factor λ, while they decrease with a larger forgetting factor λ. It should be noted that the identified inertia, as stated in Equation (18), represents the total inertia of the flexible joint with the load. Once the motor inertia J M is obtained from the manufacturer datasheet, the load inertia J L can be calculated accordingly.

Adaptive Gain Matrix Design with Fuzzy Inference
A fuzzy inferencer is designed to describe the autotuning function for the configured poles. The fuzzy inferencer follows a Mamdani type, which has one input and one output. With the online inertia identification technique, the load inertia J L is achieved and used as the input of the fuzzy inferencer. The pole λ P is utilized as the output of the fuzzy inferencer.
By conducting simulation and experimental tests, the appropriate groups of membership functions and fuzzy rules are determined. Considering the load limit of the designed flexible joint, the range of J L satisfies J L < 5 kg·m 2 , and the corresponding fuzzy sets are denoted as S 0 , S 1 , S 2 , S 3 , S 4 , and S 5 . The fuzzy set of λ P can be chosen as S 0 , S 1 , S 2 , S 3 , S 4 , and S 5 , in which the range is −350 < λ P < −100. The membership functions for the input and output variables are represented by triangular membership functions. The locations of the fuzzy membership functions for both input and output, which are evaluated by testing and expert knowledge, are depicted in Figure 7. The fuzzy inference rules are as follows. If J L is S i , then λ P is S i (where i = 0, 1, 2, 3, 4, 5). For each input value, the rule base assigns the corresponding state, and the precise output value is calculated using the defuzzification process. The centroid method, a commonly used approach, is employed as the defuzzification strategy, ensuring both sensitivity and simplicity. The output value λ P is calculated as follows: where µ(λ P_i ) is the membership value for the point λ P_i in the universe of discourse.

Simulation Results
The specifications of the flexible joint are presented in Table 1. During the simulation, the joint is operated under constant speed conditions (ω L = 9.9 rpm), and the load torque is set as T L * = 43.6 × sin(πt/3) Nm at t = 0.5 s. The other simulation parameters remain consistent with those described in Section 3.2. The simulation result of online identification of load equivalent inertia based on FFRLS is depicted in Figure 8. It is shown that the inertia identification method (dash line) achieves a satisfactory estimation effect. However, it should be noted that a small forgetting factor λ leads to a rapid identification but compromises the algorithm s stability. By employing the fuzzy inferencer designed in Section 4.2, an adaptive pole placement configuration is implemented using online identification of load inertia as input. Initially, the pole location of the observer is set to λ P = −250, which yields good observer performance when the load inertia is J L = 2 kg·m 2 . Subsequently, the load inertia changes to J L = 0.05 kg·m 2 while maintaining the same load torque, and the estimated torque comparison between the classical Luenberger torque observer and proposed torque observer when load inertia varies are shown in Figure 9a. It can be found that with the fuzzy inference-based adaptive law, the configured closed-loop poles of the proposed observer λ P change from −250 to −329, resulting in the autotuning of the gain matrix. As a result, the proposed torque observer exhibits reduced overshoot and dynamic oscillation due to the variations in load inertia.
Similarly, the results observed when the load inertia changes to J L = 5 kg·m 2 , in addition to the estimated torque comparison, are presented in Figure 9b. The configured closed-loop poles of the proposed observer λ P change from −250 to −116, enabling the autotuning of the gain matrix. The conclusion remains consistent, indicating that the proposed torque observer achieves better performance with the adaptive law. Additionally, it should be noted that the presence of measurement noise leads to a smaller estimated error.

Experimental Results
To further evaluate the performance of the proposed observer, a test is conducted using the experimental platform depicted in Figure 10. The type of torque sensor is M2210C9. The joint is controlled by a servo drive, in which the DSP STM32F407ZET6 is utilized for implementation with a switching frequency of 10 kHz and a clock frequency of 168 MHz. The sampling periods for the position loop and speed loop are 200 us, and the sampling period of the current loop is 100 us. Two absolute encoders are employed to measure the position of the motor and the joint, with the motor encoder having a resolution of 17 bits and the joint encoder having a resolution of 18 bits. It should be noted that the torque sensor is utilized to obtain the actual value of load torque, which is then compared to the estimated torque. The joint specification remains the same as stated in Table 1, and other experimental parameters for the test align with those mentioned in Section 3.2. In the test scenario, a load mass disc is attached to the load test tooling through a bolted connection. The load test tooling is constructed from aluminum alloy and has a weight of 1.2 kg, with the distance from the barycenter to the flexible joint measuring 0.24 m. The combined weight of the bolt and nut is 0.9 kg with a distance of 0.5 m from the barycenter to the flexible joint. Figure 11 illustrates the experimental result of online inertia identification using different forgetting factors when the actual inertia of the system is 2.15 kg·m 2 . It shows that a small forgetting factor λ yields a real-time response. Although there exists a small error between the identified inertia and the actual inertia, it has minimal impact on the performance of the torque observer. This is because the proposed adaptive observer is less sensitive to variations in load inertia. Adopting the same test method as described in Section 3.2, the joint is operated in position control mode to maintain the horizontal position of the load test tooling with various mass discs attached to it. The results of the estimated load torque are presented in Table 2, while the actual load torque is directly measured by the torque sensor. In the experimental conditions, the flexible joint operates in constant speed mode (ω L = 9.9 rpm). At first, a 2.5 kg mass disc is attached, resulting in a load torque T L = 19.1 Nm. With the online inertia identification algorithm, the actual inertia of the load is determined to be J L = 0.9 kg·m 2 . The experimental performances comparison between a classical Luenberger torque observer and the proposed torque observer when load inertia varies are depicted in Figure 12a. The initial pole location of the classical Luenberger observer is λ P = −500, leading to significant measurement noise and estimated torque error. However, with the application of the adaptive law based on fuzzy inference, the configured poles λ P are adjusted to −305 of the proposed observer. Consequently, the estimated load torque T L_est = 18.5 Nm with an estimated error of 3.1%. The autotuning of the gain matrix prevents the amplification of measurement noise in the observation results.
Similarly, a test is conducted with a load of 7.5 kg, where the load torque T L = 43.6 Nm and the actual inertia J L = 2.15 kg·m 2 . The estimated torque comparison is shown in Figure 12b. The initial closed-loop poles location of the classical Luenberger observer is λ P = −30, resulting in a significant time delay in the observed torque. However, by employing an adaptive gain matrix L, the configured poles of the proposed observer λ P are adjusted to −235. As a result, the estimated load torque T L_est = 42.5 Nm with an estimated error of 2.5%, showcasing a considerable enhancement in the observer performance.
According to the simulation and experimental results, it can be concluded that the proposed adaptive torque observer for flexible joint exhibits superior dynamic performance across various load conditions.

Conclusions
The classical Luenberger observer has been proven to yield inaccurate observation results and poor dynamic response when confronted with variations in the load of flexible joints driven by a PMSM. To address this issue, an adaptive torque observer based on fuzzy inference is proposed and implemented in this paper. The approach leverages the FFRLS method for online identification of the load inertia J L , within the framework of the classical Luenberger observer. Subsequently, a fuzzy inference system is utilized to describe the relationship between the load inertia J L and the closed-loop poles λ P . This enables the flexible configuration of the gain matrix L of the observer in accordance with the load conditions. Consequently, the observer exhibits superior stability and dynamic performance across a wide range of load variations. Both simulation and experimental results confirm the robustness of the proposed torque observer in achieving more accurate observations and more dynamic responses, particularly in scenarios where the load inertia undergoes significant changes.

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