Robot friction compensation and external force estimation method based on ANFIS

By combining the Stribeck friction model based on ANFIS with a generalized momentum observer, the shortcomings of traditional robot external force estimation and friction compensation are solved, achieving high-precision external force estimation and real-time collision detection, simplifying the hardware structure, and improving the safety and accuracy of robot operations.

CN121879115APending Publication Date: 2026-04-17NANJING UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NANJING UNIV OF SCI & TECH
Filing Date
2025-12-15
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Traditional methods for estimating external forces and compensating for friction in robots are insufficient to meet the requirements of high-precision operations. They suffer from incomplete friction modeling, inadequate parameter identification, poor signal processing, large collision detection errors, and a lack of systematic optimization.

Method used

A Stribeck friction model is constructed using an ANFIS-based approach. By combining a generalized momentum observer and combined filtering techniques, friction compensation and external force estimation are performed. Through data preprocessing, model training, signal filtering, and collision detection threshold setting, stable external force estimation and real-time collision detection are achieved across the entire speed range.

Benefits of technology

It reduces modeling errors across the entire speed range, improves the accuracy of external force estimation, reduces noise interference, enhances the sensitivity and reliability of collision detection, simplifies the hardware structure, and provides high-precision external force information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121879115A_ABST
    Figure CN121879115A_ABST
Patent Text Reader

Abstract

The invention discloses a robot friction compensation and external force estimation method based on an ANFIS, and the method comprises the steps: enabling a joint to walk through a static friction-Stribeck-viscous friction full speed range in a controlled environment, collecting the angular speed and motor torque, carrying out the preprocessing, training an ANFIS model, and obtaining a friction torque estimation value which can be output in real time; introducing the estimated value as feed-forward compensation into a generalized momentum observer, and calculating an external torque initial value; denoising is carried out through median filtering and Butterworth low-pass filtering, and a clean external torque signal is obtained; and finally, establishing an AR (1) noise model under the working condition of no external force, setting a dynamic collision threshold value by using the variance and the safety margin, and judging the collision if the signal exceeds the threshold value. Only a joint encoder and motor current are used in the whole process, an additional force sensor is not needed, and accurate and real-time external force sensing and collision protection can be provided for dragging teaching and man-machine cooperation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for robot friction compensation and external force estimation based on ANFIS. Background Technology

[0002] With the continuous development of industrial robot technology, interactive operation scenarios such as drag teaching and human-robot collaboration place higher demands on the robot's external force perception accuracy and safety collision detection capabilities. During robot movement, joint friction is a key interference factor affecting the accuracy of external force estimation. It has significant nonlinear characteristics, encompassing various manifestations such as low-speed static friction, specific effects, and high-speed viscous friction. If friction is ignored or simplified in dynamic modeling, it will directly lead to large errors in external force calculation. At the same time, robot external force estimation also relies on accurate dynamic model construction, effective signal and noise suppression, and reliable parameter identification methods. Generalized momentum observers, as commonly used external force calculation tools, are greatly affected by the matching degree of model parameters. While the fusion technology of fuzzy systems and neural networks provides an effective path for nonlinear system modeling, how to deeply integrate it with friction characteristics and dynamic models to achieve stable external force estimation under all working conditions remains a key area for breakthrough in the field. In addition, the dynamic changes in robot operating speed and load state in industrial scenarios further require external force estimation methods to have good adaptability and real-time performance to meet the needs of high-precision operations such as precision assembly and flexible handling.

[0003] Traditional methods for estimating external forces and compensating friction in robots have several limitations, making it difficult to meet the demands of high-precision operation scenarios. In the friction modeling stage, traditional friction models often fail to fully cover the characteristics of the robot joints across the entire velocity range, only representing friction under certain motion states. This leads to significantly increased modeling errors during speed transitions or extreme conditions. Regarding parameter identification, traditional algorithms often lack systematic optimization strategies and verification mechanisms, making them prone to overfitting or underfitting during model training. They also exhibit insufficient generalization ability, with large differences in error between the training and test sets, making it difficult to guarantee parameter accuracy under different working conditions. Furthermore, in the application of generalized momentum observers, the transmission... Traditional methods often fail to incorporate effective friction compensation terms or optimize parameter selection for joint motion direction characteristics, resulting in severe friction interference in the initial calculation of external torque and a significant decrease in accuracy. In the signal processing stage, a single filtering method is difficult to simultaneously suppress impulse noise and smooth high-frequency noise, and it is prone to introducing phase distortion, leading to a reduction in the signal-to-noise ratio. Collision detection thresholds often use fixed values, which cannot adapt to the noise variation patterns under different motion conditions, easily leading to misjudgments or omissions, affecting the safety of robot operation. In addition, traditional methods do not form a systematic optimization system of modeling-identification-filtering-detection, with each stage operating independently, further amplifying the overall error. Summary of the Invention

[0004] The present invention provides a robot friction compensation and external force estimation method based on ANFIS to solve the problems existing in the prior art.

[0005] The technical solutions adopted in this invention are as follows:

[0006] A method for robot friction compensation and external force estimation based on ANFIS includes the following steps:

[0007] S1: Drive the robot joints in a controlled environment to cover the full speed range of angular velocity motion, including static friction switching, Stribeck effect and viscous friction characteristics. Simultaneously collect the joint angular velocity and motor output torque, perform outlier removal and statistical averaging preprocessing on the collected data, and divide it into training set and test set.

[0008] S2: Construct an ANFIS model with joint angular velocity as input and friction torque as output. Use the training set to train the ANFIS model to identify the nonlinear characteristics of the Stribeck friction model. The Stribeck friction model is used to characterize static friction, Coulomb friction, viscous friction and Stribeck effect, and obtain the estimated value of friction torque.

[0009] S3: Establish a robot dynamics model for estimating external torque based on the Lagrange method, and define generalized momentum as the product of the inertia matrix and the joint angular velocity; introduce the estimated friction torque as a feedforward compensation term into the generalized momentum observer to calculate the preliminary estimated value of external torque;

[0010] S4: Perform median filtering and Butterworth low-pass filtering on the preliminary estimate of the external torque in sequence to obtain the filtered external torque signal;

[0011] S5: Under the condition of no external force, a noise statistical model is established based on the filtered external torque signal. The dynamic collision detection threshold is set according to the variance of the noise statistical model and in combination with the safety margin. When the amplitude of the filtered external torque signal exceeds the dynamic collision detection threshold, a collision event is determined to have occurred.

[0012] Furthermore, in S1, the full speed range is ±[0.01,1.0] rad / s.

[0013] Furthermore, in S1, outlier removal adopts the 3σ criterion, and the statistical average is calculated as the arithmetic mean of multiple sets of sampled data for each velocity point. The ratio of the training set to the test set is 7:3.

[0014] Furthermore, in S2, the expression for the Stribeck friction model is:

[0015] ,

[0016] in, Let be the frictional torque of the i-th joint. Indicates the direction of velocity. Represents an exponential function. Let be the joint angular velocity of the i-th joint. Let be the static friction coefficient of the i-th joint. Let be the viscous friction coefficient of the i-th joint. For the i-th Stribeck velocity coefficient, This is the attenuation coefficient of the Stribeck curve.

[0017] Furthermore, in S2, the ANFIS model adopts a Takagi-Sugeno fuzzy inference structure, the input variable is the joint angular velocity, each input dimension is divided into 5 Gaussian fuzzy subsets, and the consequent of each fuzzy rule is a linear function of the joint angular velocity;

[0018] Furthermore, in S3, the observation gain matrix of the generalized momentum observer is set independently for two adjacent joints of the robot that are close to the base. The rotary joint directly connected to the robot base is the first joint, and the joint adjacent to the first joint is the second joint.

[0019] Furthermore, in S3, when the absolute values ​​of the angular velocities of the first and second joints are less than 0.01 rad / s, the sign function is smoothly switched to avoid sudden changes in friction torque at the zero-crossing point of velocity.

[0020] Furthermore, in S5, the dynamic collision detection threshold is 20 N·m in the first joint and 15 N·m in the second joint.

[0021] Furthermore, in S4, the window length of the median filter is 5; the Butterworth low-pass filter adopts a forward-backward implementation method, with a passband boundary frequency of 5Hz, a stopband boundary frequency of 10Hz, a maximum passband attenuation of 1dB, and a minimum stopband attenuation of 40dB.

[0022] Furthermore, in S5, the noise statistical model is a first-order autoregressive AR1 model.

[0023]

[0024] in, for Observed external torque at time t, for Observed external torque at time 10:00 The observation gain matrix, Torque noise; The sampling period.

[0025] The present invention has the following beneficial effects:

[0026] (1) Static friction, Stribeck and viscous friction are modeled in a unified manner by using ANFIS, which reduces the modeling error caused by segment switching in the full speed range.

[0027] (2) Introducing friction torque feedforward compensation into the generalized momentum observer can directly reduce the interference of friction on the external force channel and improve the accuracy of external force estimation.

[0028] (3) The median filter and Butterworth low-pass filter are cascaded to suppress pulses and high-frequency noise while maintaining no significant phase lag, thereby improving the signal-to-noise ratio.

[0029] (4) Use the AR1 noise model under no external force conditions to set a dynamic threshold so that the collision detection threshold changes with the actual noise level, thereby reducing the risk of false alarms and missed alarms.

[0030] (5) The method relies only on the joint encoder and motor current, without the need for additional force sensors, and can provide real-time external force information for drag teaching and flexible collision protection, simplifying the hardware structure. Attached Figure Description

[0031] Figure 1 This is a flowchart illustrating the implementation of the method of the present invention;

[0032] Figure 2 To simplify the model diagram of the two-bar robot;

[0033] Figure 3 A friction model diagram of the robot Stribeck;

[0034] Figure 4 This is a diagram of the antecedent network structure;

[0035] Figure 5 This is a diagram of the consequent network structure;

[0036] Figure 6 This is a schematic diagram of the friction identification experimental setup;

[0037] Figure 7 Error curves are trained based on ANFIS, FNN, PSO, and least squares method;

[0038] Figure 8a The identification curve for the first joint;

[0039] Figure 8b The identification curve for the second joint;

[0040] Figure 9 This is a five-fold cross-validation diagram;

[0041] Figure 10 Diagram of the friction compensation experimental setup;

[0042] Figure 11 Here is a graph showing the friction compensation curve for joint 1.

[0043] Figure 12 This is a graph showing the friction compensation curves for two joints.

[0044] Figure 13a The graph shows the impact of different observation gains and fixed torque noise on torque observation results.

[0045] Figure 13b A graph showing the effect of fixed observation gain and different torque noise on torque observation results;

[0046] Figure 14a The original signal curves of external torques for joints 1 and 2 are shown.

[0047] Figure 14b The signal curves after filtering the external torques of joints 1 and 2 are shown.

[0048] Figure 15 Diagram of the robot body and control cabinet;

[0049] Figure 16 This is a structural diagram of the robot control system;

[0050] Figure 17 A direct teaching diagram for joints 1 and 2;

[0051] Figure 18 The graph shows the observed external torque values ​​of joint 1 under friction compensation.

[0052] Figure 19 The graph shows the observed external torque values ​​of joint 1 under frictionless compensation.

[0053] Figure 20 The graph shows the observed external torque values ​​of joint 2 under friction compensation.

[0054] Figure 21 The graph shows the observed external torque values ​​of joint 2 under frictionless compensation.

[0055] Figure 22 This is a schematic diagram of a collision detection experiment between joint 1 and joint 2.

[0056] Figure 23a A graph showing the observed values ​​of the interaction torque at joint 1;

[0057] Figure 23b This is a graph showing the observed values ​​of the interaction torques at the two joints.

[0058] Figure 24a This is a schematic diagram for verifying the external torque of the force sensor at joint 1.

[0059] Figure 24bThis is a schematic diagram for verifying the external torque of the force sensor at joint 2.

[0060] Figure 25a This is a schematic diagram showing the performance prediction of external forces on joint 1.

[0061] Figure 25b This is a schematic diagram of the performance prediction of external force on joint 2. Detailed Implementation

[0062] The invention will now be further described with reference to the accompanying drawings.

[0063] like Figure 1 This invention presents a method for robot friction compensation and external force estimation based on ANFIS. It establishes a nonlinear dynamic friction Stribeck friction model and identifies the friction model parameters through a fuzzy neural network based on the Takagi-Sugeno model of fuzzy systems. At the same time, based on the idea of ​​friction compensation, the external torque observer based on friction compensation is improved by using a generalized momentum observer, which can effectively reduce the joint torque estimation error.

[0064] This embodiment is based on the SCARA robot platform, and an experimental system for external force estimation and collision detection integrating a motion control card and a PC was built. A high-precision six-dimensional force sensor was used to verify the results. Through multiple sets of comparative experiments, the system compared the performance of traditional external force estimation methods with the external torque observer based on fuzzy neural network (ANFIS) friction compensation proposed in this invention in static external force estimation and dynamic collision detection tasks. Experimental results show that in both direct teaching and dynamic trajectory tracking scenarios, the ANFIS-GM method can accurately estimate the external torque and effectively identify collision events, with its estimation error significantly lower than the traditional generalized momentum (GM) method and other comparative methods. Quantitative analysis further demonstrates that the method proposed in this invention exhibits excellent performance in terms of external force estimation accuracy, collision detection sensitivity, and system robustness, providing a reliable solution for high-precision force perception and safe interaction in robots.

[0065] The steps of the present invention will be described in detail below with reference to the accompanying drawings:

[0066] This embodiment uses a SCARA robot as an experimental platform to perform the friction compensation and external force estimation method described in this invention on its rotary joints directly connected to the base (denoted as joint 1) and its adjacent rotary joints located in the same horizontal plane (denoted as joint 2). The method includes the following steps:

[0067] S1: Simplify the SCARA robot into a two-bar linkage mechanism, and construct the SCARA robot dynamic model using the Lagrange method, such as... Figure 2 As shown;

[0068] S2: Data Acquisition and Preprocessing: Full-Speed ​​Range Data Acquisition: The host computer controls robot joints 1 and 2 to run at preset speed gradients, synchronously acquiring the motor output torque. and joint angular velocity Each speed point runs for 3 seconds, collecting 200 sets of valid data (excluding 0.5 seconds of transition data during the start / stop phases), for a total of 20 × 200 = 4000 sets of raw data collected per joint;

[0069] Data preprocessing:

[0070] Outlier removal: using The criterion is to remove outliers in the torque data that deviate from the mean by more than three standard deviations (mainly pulse signals caused by electrical noise with an amplitude greater than 1 N·m).

[0071] Statistical averaging: The arithmetic mean of 200 sets of data for each velocity point is calculated to obtain 40 sets of standardized data (20 velocity points × 2 joints);

[0072] Dataset partitioning: The dataset is divided into a training set (28 sets / joints) and a test set (12 sets / joints) in a 7:3 ratio for training and validation of the ANFIS model.

[0073] S3: ANFIS Model Construction and Friction Parameter Identification:

[0074] (1) The expression for the Stribeck friction model is:

[0075]

[0076] in, Let be the frictional torque of the i-th joint. Indicates the direction of velocity. Represents an exponential function. Let be the joint angular velocity of the i-th joint. Let be the static friction coefficient of the i-th joint. Let be the viscous friction coefficient of the i-th joint. For the i-th Stribeck velocity coefficient, The attenuation coefficient for the Stribeck curve (set to 2). Figure 3 As shown.

[0077] ANFIS model structure design, such as Figure 4 Figure 5 As shown:

[0078] Input layer: Single input (Joint angular velocity);

[0079] Fuzzing layer: Each input dimension is divided into 5 fuzzy subsets (extremely slow, slow, medium speed, fast, and extremely fast);

[0080] Fuzzy rule layer: Total number of rules (Single input dimension × 5 fuzzy subsets), the first The rule is defined as: if yes ,but , For the linear parameters of the regular consequent, Joint angular velocity, This is the local output of this rule. This indicates the nth rule. The fuzzy subset to which it belongs.

[0081] Output layer: The final output is the predicted friction torque value, formula: ,in For the first The trigger strength of the rule, The final output of the predicted friction torque value is... The weighted average, The normalized trigger strength, for The membership degree (0~1) of this fuzzy subset. Represents the i-th joint enter.

[0082] Model training and parameter optimization

[0083] Error cost function: , The actual frictional torque obtained by separating the motor torque. The total number of samples in the training set. Indicates the total error;

[0084] Parameter tuning strategy: Gradient descent method is used, and the tuning formula is as follows:

[0085] ,

[0086] in, The center value of the Gaussian membership function, The width of the Gaussian membership function. Indicates the number of iterations. The initial learning rate is 10%, which decreases by 10% every 20 iterations during the iteration process. The maximum number of iterations for the model is set to 100, and the batch size is 10.

[0087] Cross-validation: 5-fold cross-validation randomly divides the training set into 5 equal-sized subsets, using 4 subsets for training and 1 subset for validation in turn, ensuring that the error difference between the training set and the test set is consistent. (satisfy Requirements), such as Figure 9 As shown.

[0088] Through the constructed friction identification experimental platform, such as Figure 6 As shown, the identification results ultimately yield the Stribeck friction parameters of joints 1 and 2 of the SCARA robot, as well as the training error curves based on ANFIS, FNN, PSO, and least squares method, and the identification curves of joints 1 and 2, as shown below. Figure 7 , Figure 8a , Figure 8b As shown:

[0089]

[0090] S4: Establishment of the dynamic model and preliminary calculation of external torque:

[0091] The robot dynamics model is constructed based on the Lagrange method, establishing a three-level model:

[0092] Basic model without external force and friction: SCARA robots are configured horizontally, among which For the robot's gravity matrix;

[0093] Model with friction correction: , Stribeck friction torque identified for S3 Let the joint position vector be... The inertia matrix, The matrix represents the Coriolis force and the centripetal force. For acceleration, To control the overall input torque, the friction compensation experimental device is as follows: Figure 10 As shown.

[0094] Complete model including external forces (for deriving external torques): , The external torque to be estimated.

[0095] Design of a generalized momentum observer:

[0096] Generalized momentum definition: ,in Let be the generalized momentum vector of the system;

[0097] The observer formula for fused friction compensation is as follows: ;in This is an estimate of the generalized momentum. This is an estimate of the reciprocal of the generalized momentum. For the transpose of the estimated Coriolis force and centrifugal force matrices, For the estimated frictional force, The observation gain matrix (optimized through simulation, such as...) Figure 13a , 13b As shown, (Joint 1) (Joint 2) balances response speed and noise suppression;

[0098] Zero-crossing speed smoothing strategy: Set a speed threshold of 0.01 rad / s, when... Smooth switching To avoid sudden changes in torque.

[0099] Preliminary calculation of external torque:

[0100] Based on the derivation of the generalized rate of change of momentum, combined with the robot's dynamic characteristics ,simplify The final preliminary formula for external torque is:

[0101]

[0102] in, For the estimated external torque, For the generalized momentum derivative, This is the transpose of the Coriolis force and centrifugal force matrices.

[0103] The initial external torque signal (including pulse noise and high-frequency noise) is obtained through real-time calculation by the host computer, such as... Figure 11 , 12 The figure shows the friction compensation curves for joints 1 and 2.

[0104] S5: Combined Filtering and Signal Optimization

[0105] A combined strategy of median filtering and Butterworth low-pass filtering is adopted to eliminate noise and phase distortion;

[0106] Median filtering (impulse noise suppression):

[0107] formula: Total window length 5 This is the filtered joint torque signal. For the time point within the window, Indicates the window length;

[0108] Function: Removes transient impulse noise with a medium amplitude greater than 1 N·m without phase delay.

[0109] (2) Butterworth low-pass filter (high-frequency noise smoothing) - frequency response function: ;in Indicates the signal at frequency Power gain at that point Indicates the cutoff frequency. Indicates the filter order.

[0110] Filter parameter design:

[0111] Maximum passband attenuation Minimum stopband attenuation ;

[0112] passband boundary frequency Stopband boundary frequency ;

[0113] Minimum order calculation: ;

[0114] Cutoff frequency calibration: ;

[0115] Discretization implementation: using bilinear transformation, The digital transfer function is: Implement the difference equation: ,in, Represents a complex frequency variable. The sampling period is Represents the unit delay operator. For digital transfer functions, The denominator (feedback) coefficient, The filter coefficients are obtained from the numerator (forward) coefficients:

[0116]

[0117] Phase calibration: Forward-backward filtering ensures phase deviation ≤ 0.1ms and time alignment of all frequency components of the signal. Figure 14a , 14b The figure shows the curves of external torque before and after filtering for joints 1 and 2.

[0118] S6: Final External Force Estimation and Collision Detection

[0119] Through the construction of a robot experimental platform, such as Figure 15 , Figure 16 , Figure 17 As shown, the filtered signal is used as the final estimate of the external torque in the final external torque calculation: Butterworth filter output This represents the output value of the external torque signal after passing through the Butterworth low-pass filter at time 10:00. The external torque observation curve is shown in Figure 10. Figure 18 , 19 As shown in Figures 20 and 21.

[0120] Adaptive collision detection threshold setting:

[0121] Establish the AR1 model: , Where is the observed external torque value at time . The observation gain matrix, Torque noise;

[0122] Noise variance calculation: , The autocorrelation coefficient is... To observe the torque variance, This represents the torque noise variance.

[0123] Dynamic threshold formula: ,in For the detection threshold, The standard deviation of torque noise. For safety margin:

[0124] Threshold calculation results: Joint 1 is 20 N·m, Joint 2 is 15 N·m, as follows Figure 22 , 23a As shown in 23b.

[0125] Collision detection logic:

[0126] When a collision event is detected, the host computer immediately sends an emergency stop signal, and the robot stops moving.

[0127] If the instruction is determined to be normal or noise, the robot continues to record the trajectory.

[0128] Implementation effect verification:

[0129] The implemented feedforward compensation strategy resulted in maximum torque errors of only 0.263 Nm and 0.184 Nm for the two joints, respectively, significantly outperforming other alternative methods. By incorporating the identified friction model into a generalized momentum observer with median and Butterworth filtering, the proposed ANFIS-GM method reduced the root mean square error and maximum absolute error by 18.3% and 27.9%, respectively, while achieving a determination coefficient of 0.994. In collision detection tests, this method accurately identified impact events with a significantly reduced false alarm rate, providing an effective solution for high-precision force control in robotic applications.

[0130] The accuracy of external force estimation is evaluated using four defined metrics. The performance of external force prediction is shown in the table below, comparing the traditional generalized momentum observer (GM) with that of our method (ANFIS-GM).

[0131]

[0132] External force estimation and collision detection performance:

[0133] Based on a system comparison with the true values ​​of a six-dimensional force sensor, such as Figure 24a , 24b 25a Figure 25b As shown, among the two external force estimation methods, the ANFIS-GM method performs best, with the lowest RMSE (0.3089 N) and MAE (1.0496 N), representing significant improvements of 73.9% and 74.7% respectively compared to the traditional GM method. Furthermore, its coefficient of determination (R²) is as high as 0.9863, exhibiting a strong linear correlation with the true value, and the maximum error is also controlled to a minimum (1.0496 N). The experimental results fully demonstrate that the proposed ANFIS-Stribeck hybrid model combined with the generalized momentum observer can effectively compensate for nonlinear friction, providing an optimal solution for achieving low-cost, high-precision sensorless force control. It has outstanding application value in precision force control scenarios such as direct teaching and human-computer interaction.

[0134] This embodiment fully implements the ANFIS friction compensation + generalized momentum observer + combined filtering + adaptive collision detection technology to solve the friction interference and safe collision problems in SCARA robot interaction. Experimental results show that, compared with traditional methods, ANFIS significantly reduces identification errors and exhibits superior generalization performance. The implemented feedforward compensation strategy reduces the maximum torque errors of the two joints to only 0.263 N·m and 0.184 N·m, respectively, far exceeding the performance of other alternative methods. By integrating the identified friction model into a generalized momentum observer with median filtering and Butterworth filtering, the proposed ANFIS-GM method reduces the root mean square error and maximum absolute error by 18.3% and 27.9%, respectively, while achieving a determination coefficient of 0.994. In collision detection tests, this method can accurately identify impact events with a significantly reduced false alarm rate, providing an effective solution for high-precision force control in robot applications.

[0135] The above description is only a preferred embodiment of the present invention. It should be noted that those skilled in the art can make several improvements without departing from the principle of the present invention, and these improvements should also be considered within the scope of protection of the present invention.

Claims

1. A method for robot friction compensation and external force estimation based on ANFIS, characterized in that: Includes the following steps: S1: Drive the robot joints in a controlled environment to cover the full speed range of angular velocity motion, including static friction switching, Stribeck effect and viscous friction characteristics. Simultaneously collect the joint angular velocity and motor output torque, perform outlier removal and statistical averaging preprocessing on the collected data, and divide it into training set and test set. S2: Construct an ANFIS model with joint angular velocity as input and friction torque as output. Use the training set to train the ANFIS model to identify the nonlinear characteristics of the Stribeck friction model. The Stribeck friction model is used to characterize static friction, Coulomb friction, viscous friction and Stribeck effect, and obtain the estimated value of friction torque. S3: Establish a robot dynamics model for estimating external torque based on the Lagrange method, and define generalized momentum as the product of the inertia matrix and the joint angular velocity; introduce the estimated friction torque as a feedforward compensation term into the generalized momentum observer to calculate the preliminary estimated value of external torque; S4: Perform median filtering and Butterworth low-pass filtering on the preliminary estimate of the external torque in sequence to obtain the filtered external torque signal; S5: Under the condition of no external force, a noise statistical model is established based on the filtered external torque signal. The dynamic collision detection threshold is set according to the variance of the noise statistical model and in combination with the safety margin. When the amplitude of the filtered external torque signal exceeds the dynamic collision detection threshold, a collision event is determined to have occurred.

2. The robot friction compensation and external force estimation method based on ANFIS as described in claim 1, characterized in that: In S1, the full speed range is ±[0.01,1.0] rad / s.

3. The robot friction compensation and external force estimation method based on ANFIS as described in claim 1, characterized in that: In S1, outlier removal uses the 3σ criterion, and the statistical average is calculated as the arithmetic mean of multiple sets of sampled data for each velocity point. The ratio of the training set to the test set is 7:

3.

4. The robot friction compensation and external force estimation method based on ANFIS as described in claim 1, characterized in that: In S2, the expression for the Stribeck friction model is: , in, Let be the frictional torque of the i-th joint. Indicates the direction of velocity. Represents an exponential function. Let be the joint angular velocity of the i-th joint. Let be the static friction coefficient of the i-th joint. Let be the viscous friction coefficient of the i-th joint. For the i-th Stribeck velocity coefficient, This is the attenuation coefficient of the Stribeck curve.

5. The robot friction compensation and external force estimation method based on ANFIS as described in claim 1, characterized in that: In S2, the ANFIS model adopts the Takagi-Sugeno fuzzy inference structure, the input variable is the joint angular velocity, each input dimension is divided into 5 Gaussian fuzzy subsets, and the consequent of each fuzzy rule is a linear function of the joint angular velocity.

6. The robot friction compensation and external force estimation method based on ANFIS as described in claim 1, characterized in that: In S3, the observation gain matrix of the generalized momentum observer is set independently for two adjacent joints of the robot that are close to the base. The rotary joint directly connected to the robot base is the first joint, and the joint adjacent to the first joint is the second joint.

7. The robot friction compensation and external force estimation method based on ANFIS as described in claim 6, characterized in that: In S3, when the absolute values ​​of the angular velocities of the first and second joints are less than 0.01 rad / s, the sign function is smoothly switched to avoid sudden changes in friction torque at the zero-crossing point of velocity.

8. The robot friction compensation and external force estimation method based on ANFIS as described in claim 6, characterized in that: In S5, the dynamic collision detection threshold is 20 N·m in the first joint and 15 N·m in the second joint.

9. The robot friction compensation and external force estimation method based on ANFIS as described in claim 1, characterized in that: In S4, the window length of the median filter is 5; the Butterworth low-pass filter adopts a forward-backward implementation method, with a passband boundary frequency of 5Hz, a stopband boundary frequency of 10Hz, a maximum passband attenuation of 1dB, and a minimum stopband attenuation of 40dB.

10. The robot friction compensation and external force estimation method based on ANFIS as described in claim 1, characterized in that: In S5, the noise statistical model is a first-order autoregressive AR1 model.

11. Among them, for Observed external torque at time t, for Observed external torque at time 10:00 The observation gain matrix, Torque noise; The sampling period.