Impulse neural network-based robot arm torque compensation method and device
Patent Information
- Application Number
- CN202611175437.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-04
- Publication Date
- 2026-10-30
AI Technical Summary
[0004]本申请提供一种基于脉冲神经网络的机械臂力矩补偿方法及装置,以解决相关技术未能充分利用SNN对时序动态信息的建模能力,导致对机械臂复杂非线性动力学特性的表征不足,控制信息表达不充分,从而使得控制精度降低,并影响控制过程中的动态响应性能与稳定性的问题
[0023]本申请附加的方面和优点将在下面的描述中部分给出,部分将从下面的描述中变得明显,或通过本申请的实践了解到。
Smart Images

Figure CN123000808A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of robotic arm technology, and in particular to a method and device for torque compensation of a robotic arm based on a pulse neural network. Background Technology
[0002] Among related technologies, SNN (Spiking Neural Network) models temporal information by simulating the spiking mechanism of biological neurons and utilizing the dynamic evolution of neuronal membrane potential. It has strong spatiotemporal feature expression capabilities and low theoretical power consumption, and can provide certain state modeling and decision support for highly time-series tasks such as robotic arm motion control.
[0003] However, in the application of related technologies in robotic arm control, the ability of SNN to model temporal dynamic information has not been fully utilized. Information loss occurs in the pulse coding, state representation and output mapping processes, resulting in insufficient ability of the control system to characterize the complex nonlinear dynamic characteristics of the robotic arm. This leads to low control accuracy and lag and instability in the dynamic response process, resulting in poor overall dynamic performance. Summary of the Invention
[0004] This application provides a method and apparatus for torque compensation of a robotic arm based on a spiking neural network, in order to solve the problem that related technologies fail to fully utilize the modeling capability of SNN for time-series dynamic information, resulting in insufficient characterization of the complex nonlinear dynamic characteristics of the robotic arm, inadequate expression of control information, thereby reducing control accuracy and affecting the dynamic response performance and stability during the control process.
[0005] The first aspect of this application provides a method for torque compensation of a robotic arm based on a spiking neural network, comprising the following steps: acquiring the joint positions and joint velocities of the robotic arm; encoding the joint positions and joint velocities into a joint position error pulse sequence and a joint velocity error pulse sequence, and determining the planned position and actual position of at least one joint of the robotic arm based on the joint position pulse sequence; inputting the joint position error pulse sequence, the planned position, and the actual position into a pre-trained gravity compensation network, calculating the cell membrane potential to output the gravity compensation torque of at least one joint, and determining the control torque of at least one joint based on the gravity compensation torque, the joint position error pulse sequence, and the joint velocity error pulse sequence.
[0006] By using the above techniques, pulse coding is performed on joint position and joint velocity to obtain joint position error pulse sequences and joint velocity error pulse sequences. Then, a gravity compensation network is used to learn the nonlinear mapping relationship between joint state and gravity compensation torque. This can fully explore the temporal correlation characteristics and dynamic properties in the joint motion state, achieve accurate compensation of the gravity term of the robotic arm, thereby reducing the impact of gravity disturbance on the motion control of the robotic arm, improving the trajectory tracking accuracy, dynamic response performance, control stability and anti-disturbance capability of the robotic arm under complex working conditions.
[0007] Optionally, in one embodiment of this application, the encoding formulas for joint position and velocity errors are as follows: , , in, For random variables, The pulse train that provides feedback on the joint position error. The pulse train that provides feedback on joint velocity error. These are the position and velocity error limits for each joint. The planned and actual positions of each joint. The planned speed and actual speed for each joint.
[0008] By employing the above techniques, the planned and actual positions of each joint, as well as the planned and actual velocities of each joint, are encoded to obtain joint position error pulse sequences and joint velocity error pulse sequences. This process converts continuous joint motion states into event-driven information with temporal characteristics, fully preserving the dynamic changes in joint position and velocity errors. This provides more accurate temporal input for the subsequent gravity compensation network, thereby improving the network's ability to model the complex nonlinear dynamics of the robotic arm and further enhancing the accuracy of gravity compensation, as well as the stability and anti-disturbance capability of the robotic arm's motion control.
[0009] Optionally, in one embodiment of this application, the gravity compensation network includes an encoding module, a recurrent fully connected module, a decoding module, and a PC (Population Coding) module. The process of inputting the joint position error pulse sequence, the planned position, and the actual position into a pre-trained gravity compensation network to calculate the cell membrane potential and output the gravity compensation torque for at least one joint includes: based on the encoding module, converting the joint position error pulse sequence, the planned position, and the actual position into a pulse sequence that meets preset standard conditions; based on the recurrent fully connected module, performing membrane potential accumulation and recursive state update processing on the pulse sequence to obtain a membrane potential state sequence of the pulse sequence; based on the decoding module, determining the cell membrane potential based on the membrane potential state sequence; and based on the PC module, performing piecewise averaging processing on the cell membrane potential to determine the gravity compensation torque.
[0010] By using the above technical means, the gravity compensation torque is determined based on the encoding module, the cyclic fully connected module, the decoding module, and the PC module. This fully leverages the ability of the spiking neural network to model time-series dynamic information, enabling nonlinear modeling and adaptive compensation of the gravity term of the robotic arm. This improves the accuracy of gravity compensation and reduces the impact of model errors on control performance.
[0011] Optionally, in one embodiment of this application, before inputting into the pre-trained gravity compensation network, the method further includes: generating training data for the robotic arm based on the dynamic model of the robotic arm, wherein the training data includes data pairs consisting of each joint position corresponding to the joint end pose and the corresponding gravity compensation torque; and training an initial gravity compensation network using the training data until the preset network conditions are met, thereby establishing the gravity compensation network.
[0012] By using the above technical means, training data can be constructed based on joint positions and gravity compensation torques, providing high-quality training samples for the gravity compensation network. This enables the network to accurately learn the gravity torque variation patterns under different postures of the robotic arm, thereby improving the accuracy of gravity compensation torque prediction. This provides accurate feedforward compensation for subsequent torque feedback control, further enhancing the precision, stability, and anti-disturbance capability of the robotic arm's motion control.
[0013] Optionally, in one embodiment of this application, the robotic arm torque compensation method based on spiking neural networks further includes: Noise is added to the gravity compensation torque, where the formula for adding noise is: , , , , , in, To add a gravity-compensated torque to reduce noise, This refers to the joint position. This is the gravity compensation torque.
[0014] By using the above techniques to add noise to the gravity compensation torque, the distribution range of the training data can be expanded, allowing the training samples to cover measurement errors, modeling errors, and environmental disturbances, thereby improving the noise resistance and generalization performance of the gravity compensation network and enhancing its stability and accuracy in actual control processes.
[0015] A second aspect of this application provides a robotic arm torque compensation device based on a spiking neural network, comprising: an acquisition module for acquiring the joint positions and joint velocities of the robotic arm; an encoding module for encoding the joint positions and joint velocities into a joint position error pulse sequence and a joint velocity error pulse sequence, and determining the planned position and actual position of at least one joint of the robotic arm based on the joint position pulse sequence; and a compensation module for inputting the joint position error pulse sequence, the planned position, and the actual position into a pre-trained gravity compensation network, calculating the cell membrane potential to output the gravity compensation torque of at least one joint, and determining the control torque of at least one joint based on the gravity compensation torque, the joint position error pulse sequence, and the joint velocity error pulse sequence.
[0016] Optionally, in one embodiment of this application, the encoding formulas for joint position and velocity errors are as follows: , , in, For random variables, The pulse train that provides feedback on the joint position error. The pulse train that provides feedback on joint velocity error. These are the position and velocity error limits for each joint. The planned and actual positions of each joint. The planned speed and actual speed for each joint.
[0017] Optionally, in one embodiment of this application, the gravity compensation network includes an encoding module, a cyclic fully connected module, a decoding module, and a PC module. The compensation module includes: a conversion unit, used to convert the joint position error pulse sequence, the planned position, and the actual position into a pulse sequence that meets preset standard conditions based on the encoding module; an accumulation unit, used to perform membrane potential accumulation and recursive state update processing on the pulse sequence based on the cyclic fully connected module to obtain a membrane potential state sequence of the pulse sequence; an output unit, used to determine the cell membrane potential based on the membrane potential state sequence based on the decoding module; and an averaging unit, used to perform piecewise averaging processing on the cell membrane potential based on the PC module to determine the gravity compensation torque.
[0018] Optionally, in one embodiment of this application, the robotic arm torque compensation device based on a spiking neural network further includes: a generation module, used to generate training data for the robotic arm based on the dynamic model of the robotic arm, wherein the training data includes data pairs consisting of each joint position corresponding to the joint end pose and the corresponding gravity compensation torque; and an establishment module, used to train an initial gravity compensation network using the training data until a preset network condition is met, thereby establishing a gravity compensation network.
[0019] Optionally, in one embodiment of this application, the robotic arm torque compensation device based on a spiking neural network further includes: Noise is added to the gravity compensation torque, where the formula for adding noise is: , , , , , in, To add a gravity-compensated torque to reduce noise, This refers to the joint position. This is the gravity compensation torque.
[0020] A third aspect of this application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the mechanical arm torque compensation method based on a spiking neural network as described in the above embodiments.
[0021] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for compensating the torque of a robotic arm based on a spiking neural network.
[0022] A fifth aspect of this application provides a computer program product, including a computer program that, when executed, is used to implement the above-described method for compensating the torque of a robotic arm based on a spiking neural network.
[0023] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0024] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 This is a flowchart of a robotic arm torque compensation method based on a spiking neural network according to an embodiment of this application; Figure 2 This is a schematic diagram illustrating the principle of a gravity compensation network according to an embodiment of this application; Figure 3 This is a schematic diagram of a test trajectory according to an embodiment of this application; Figure 4 This is a block diagram of a robotic arm torque compensation device based on a spiking neural network according to an embodiment of this application; Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application.
[0025] Figure label: 10-A torque compensation device for a robotic arm based on a spiking neural network; 100-Acquisition module, 200-Encoding module, 300-Compensation module; 501-Memory, 502-Processor, 503-Communication interface. Detailed Implementation
[0026] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0027] The following description, with reference to the accompanying drawings, illustrates a method and apparatus for manipulating arm torque compensation based on a spiking neural network (SNN). Addressing the technical problem mentioned in the background art—that insufficient utilization of the SNN's modeling capabilities for temporal dynamic information leads to inadequate representation of the complex nonlinear dynamic characteristics of the manipulating arm, insufficient expression of control information, resulting in reduced control accuracy and affecting dynamic response performance and stability during control—this application provides a manipulating arm torque compensation method based on a spiking neural network. This method aims to achieve high-precision estimation and compensation of the manipulating arm's gravity term by pulse coding of joint state information and combining it with a gravity compensation network for temporal modeling, thereby improving the accuracy of manipulating arm motion control, dynamic response performance, and anti-disturbance capability.
[0028] Before describing the torque compensation method for robotic arms based on spiking neural networks in this application, the system structure involved in this application will be described first.
[0029] In the task of tracking and controlling the trajectory of a robotic arm, for a A robotic arm with degrees of freedom, control torque in joint space Decomposed into using the inverse dynamics model The decoupled linear equations are as follows: , in, These are the input control variables to be designed. It is The inertia matrix, It is The Coriolis force and centrifugal force matrix, It is The gravity compensation vector.
[0030] The main challenges in motion control of rigid robotic arms lie in uncertainty and the complexity of dynamics. Uncertainty can be categorized into structured and unstructured uncertainty. Structured uncertainty refers to the imprecise understanding of dynamic parameters; for example, the rigid body of the robotic arm link may not be a regular shape due to design limitations, which leads to variations in the inertia matrix in the model. and gravity compensation vector This may not be sufficient to accurately describe the dynamic characteristics of the linkage; unstructured uncertainties arise from issues such as the flexibility of joints and linkages, actuator dynamics, friction, sensor noise, and unknown environmental dynamics. Therefore, this application proposes a manipulator torque compensation method based on a spiking neural network, which leverages the generalization performance of the neural network to reduce uncertainties and dynamic complexity regarding the gravity compensation vector. This will improve control accuracy.
[0031] Specifically, Figure 1This is a flowchart illustrating a method for compensating the torque of a robotic arm based on a spiking neural network, provided in an embodiment of this application.
[0032] like Figure 1 As shown, the robotic arm torque compensation method based on spiking neural networks includes the following steps: In step S101, the joint position and joint speed of the robotic arm are obtained.
[0033] Joint positions can be used to characterize the robot arm's posture and to calculate posture-related gravity compensation torques and dynamic parameters; joint velocities can be used to provide feedback on the robot arm's motion state, characterizing the changing trends of joint motion, thereby dynamically correcting the joint control torques to improve system stability, response speed, and anti-oscillation capability. Joint positions can include actual positions and planned positions, and joint velocities can include actual velocities and planned velocities.
[0034] The embodiments of this application can collect the current position information of each joint by setting angle encoders, rotary transformers or other position detection devices on each joint of the robotic arm to determine the joint position; and directly obtain the joint speed according to the speed sensor, or calculate the position change rate between adjacent sampling times based on the continuously collected joint positions to determine the joint speed.
[0035] In step S102, the joint position and joint velocity are encoded into a joint position error pulse sequence and a joint velocity error pulse sequence, and the planned position and actual position of at least one joint of the robotic arm are determined based on the joint position pulse sequence.
[0036] In the embodiments of this application, the encoding methods include, but are not limited to, rate encoding, time encoding, and pulse interval encoding. The rate encoding method can be used to map the amplitude of joint position error to the pulse firing frequency per unit time. The time encoding method can be used to map joint state information to the pulse firing time delay or firing moment. The pulse interval encoding method can be used to characterize the amplitude of joint state change by the time interval between adjacent pulses, thereby converting continuous joint state information into discrete pulse sequences and inputting them into a spiking neural network for time-series modeling.
[0037] The planned position describes the joint target state in the expected execution trajectory of the robotic arm, while the actual position describes the real joint state of the robotic arm at the current moment. The difference between the two can constitute joint position error information, which is used by the pulse coding module to generate input pulse sequences for the spiking neural network to perform time-series modeling and control torque prediction.
[0038] As a specific example, the encoding formulas for joint position and velocity errors are as follows: , , in, For random variables, The pulse train that provides feedback on the joint position error. The pulse train that provides feedback on joint velocity error. These are the position and velocity error limits for each joint. The planned and actual positions of each joint. The planned speed and actual speed for each joint.
[0039] It can be explained that, , It can be used in feedback control to construct torque-level closed-loop regulation signals. By jointly characterizing the tracking error and motion trend information of the robotic arm, the spiking neural network can generate corresponding joint torque corrections, thereby improving the dynamic response performance and anti-disturbance capability of the system.
[0040] In step S103, the joint position error pulse sequence, the planned position, and the actual position are input into a pre-trained gravity compensation network to calculate the cell membrane potential, so as to output the gravity compensation torque of at least one joint, and the control torque of at least one joint is determined based on the gravity compensation torque, the joint position error pulse sequence, and the joint velocity error pulse sequence.
[0041] The gravity compensation network can be a network model composed of SNNs. SNNs can perform pulse coding on the input joint state information and, based on the accumulation and recursive dynamic update mechanism of neuronal membrane potential, nonlinearly model and learn the gravitational torque of the robotic arm, thereby outputting a gravity compensation torque corresponding to the joint position. Cell membrane potential refers to the internal state quantity of a spiking neuron formed through the dynamic process of membrane potential accumulation and leakage after receiving an input pulse sequence; it is used to characterize the neuron's comprehensive response to the input temporal information.
[0042] In some cases, in SNN networks, neurons via pulse train To achieve information flow, it is described as follows: , in, It is the pulse sequence number.
[0043] An input current signal generated by a series of pulses acting on a neuron It can be described as: , in, It is the synaptic time constant. In current research, many spiking neuron models have been proposed. The input current to the neuron causes the neuronal membrane potential. The changes satisfy the following relation: , in, It is the cell membrane time constant. It is the electrical potential after the neuron is repositioned. It is the external current that drives the neural state. It is the first The input current of each synapse It is the first The strength of each synapse, This represents synaptic resistance.
[0044] Therefore, the working process of a neuron can be explained as follows: When the cell membrane potential exceeds the excitation threshold Afterward, the neuron sends a pulse, which is manifested as follows: , in , Then the cell membrane potential is reset to When the cell membrane potential is below a threshold, the neuron does not send pulses.
[0045] Currently, a wealth of research on training Artificial Neural Networks (ANNs) based on backpropagation has resulted in a mature theoretical and tool system. However, since the impulses between SNN neurons are not differentiable, directly calculating their gradients may lead to network instability. This application's embodiment uses the gradient of an approximate function instead of the impulse gradient during backpropagation. This method allows for convenient transfer of the ANN framework to SNNs for network training.
[0046] In neural networks, training typically involves updating the connection weights between neurons using gradient descent. It's implemented. For a single-layer neural network, ,in , in, It is the total input of a neuron. It is the first The output of each neuron It's the learning rate. This is the loss function. Similarly, in multi-layer neural networks, gradient descent is often expressed as backpropagation. For the th... Layered network: ,in , in, It is the derivative of the activation function. This is the error in the output of the last layer of neurons. A common practice for approximating the gradient is to use the activation function described above during forward propagation. During backpropagation, however, the following method is used: Instead That is to say This is a substitute function for the activation function. Usually a shape and Similar but smooth and continuous functions. In the embodiments of this application, the approximate gradient function is defined as: , in, .
[0047] Furthermore, embodiments of this application can construct a gravity compensation network based on the aforementioned SNN neuron structure and training method. Wherein, and The actual inputs that can be combined to generate a gravity compensation network ,Right now: , This application embodiment can obtain the cell membrane potential of the output layer neurons through the dynamic accumulation of membrane potential and recursive state update of the gravity compensation network, and calculate the gravity compensation torque corresponding to each joint based on the cell membrane potential, thereby realizing the nonlinear modeling and compensation of the gravity term of the robotic arm. Subsequently, the gravity compensation torque can be corrected based on the joint position error feedback to obtain the final output torque for torque-level closed-loop control, thereby improving the accuracy and anti-disturbance capability of the robotic arm motion control.
[0048] As one possible implementation, the gravity compensation network includes an encoding module, a recurrent fully connected module, a decoding module, and a PC module. The network inputs a joint position error pulse sequence, the planned position, and the actual position into a pre-trained gravity compensation network to calculate the cell membrane potential and output the gravity compensation torque for at least one joint. This includes: based on the encoding module, converting the joint position error pulse sequence, the planned position, and the actual position into a pulse sequence that meets preset standard conditions; based on the recurrent fully connected module, performing membrane potential accumulation and recursive state update processing on the pulse sequence to obtain a membrane potential state sequence; based on the decoding module, determining the cell membrane potential based on the membrane potential state sequence; and based on the PC module, performing piecewise averaging processing on the cell membrane potential to determine the gravity compensation torque.
[0049] Preset standard conditions can include a uniform encoding time window, a fixed time step, a fixed pulse firing frequency range, a uniform pulse amplitude, and encoding rules corresponding to joint states, so as to ensure that the input information of different joints has a consistent pulse representation, which is convenient for spiking neural networks to perform time-series modeling.
[0050] Membrane potential accumulation refers to the weighted accumulation of neuronal membrane potentials based on the input pulse sequence and the corresponding synaptic connection weights; recursive state update refers to the dynamic update of neuronal membrane potentials at the current moment based on the neuronal membrane potential state at the previous moment and the current input pulse, in order to retain historical temporal information; membrane potential state sequence refers to the sequence of membrane potential changes formed by the accumulation and recursive state update of the neuron over multiple consecutive time steps, which is used to characterize the temporal response characteristics of the neuron to the input pulse sequence and serves as the input to the decoding module.
[0051] Specifically, such as Figure 2 As shown, the gravity compensation network mainly consists of four modules: encoding, cyclic fully connected layers, decoding, and PC. In the encoding module, The input is connected to 1024 spiking neurons using fully connected connections. Then, in the recurrent fully connected module, the outputs of the first layer of 1024 spiking neurons are fully connected to the neurons in the next layer, and the outputs of the neurons in that layer are also fully connected to themselves as additional inputs. The outputs of the second layer of 1024 neurons are fully connected to the neurons in the next layer, and the outputs of the neurons in that layer are connected to themselves as additional inputs. The next two layers each contain 1024 neurons, connected in the same way as the second layer of neurons in the recurrent fully connected module. In the decoding module, the outputs of the last layer of 1024 neurons in the recurrent fully connected module are fully connected to... A non-sparking spiking neuron. A non-sparking spiking neuron is one that has a firing threshold... A spiking neuron set to infinite size outputs the cell membrane potential, denoted as . The outputs of these 1792 neurons will be input into the PC module for computation, defined as: , This refers to the gravity compensation torque of each joint output by the network. The neurons and training parameters used in this gravity compensation network are shown in Table 1.
[0052] Table 1
[0053] This application embodiment uses a gravity compensation network based on a spiking neural network to perform pulse coding and timing modeling on joint position error signals and joint state information, and outputs the corresponding cell membrane potential. Then, through mapping processing, the gravity compensation torque of each joint is determined, which can improve the gravity compensation accuracy and the dynamic control performance and anti-disturbance capability under complex working conditions.
[0054] Optionally, in one embodiment of this application, before inputting into the pre-trained gravity compensation network, the method further includes: generating training data for the robotic arm based on the dynamic model of the robotic arm, wherein the training data includes data pairs consisting of each joint position corresponding to the joint end pose and the corresponding gravity compensation torque; and training an initial gravity compensation network using the training data until the preset network conditions are met, thereby establishing the gravity compensation network.
[0055] In the embodiments of this application, the gravity compensation network is trained using supervised learning; therefore, the embodiments of this application can generate training data through the dynamic model of the robotic arm. It is assumed that the workspace at the end of the robotic arm is... Within this polar coordinate range, the trajectory of the final position is defined as: , right Sampling is performed at intervals of 0.1. interval Sampling is performed on the sample. interval Sampling yields 7956 data points as the end-effector position sequence. Next, as shown in Table 2, this embodiment repeats the above operation under 14 postures to obtain a total of 111384 data points for the joint end-effector pose set. Subsequently, this embodiment calculates the inverse kinematics to obtain the corresponding joint trajectory set. The gravity compensation torque corresponding to each joint position in this set is obtained through robotic arm dynamics calculations, denoted as... The embodiments of this application can obtain ( , The set of data pairs is used as training data. This indicates the joint position.
[0056] Table 2
[0057] As one possible approach, the spiking neural network-based robotic arm torque compensation method also includes adding noise to the gravity compensation torque, wherein the noise addition formula is: , , , , , in, To add a gravity-compensated torque to reduce noise, This refers to the joint position. This is the gravity compensation torque.
[0058] To improve the generalization ability and robustness of the gravity compensation network, embodiments of this application can introduce random noise perturbations into the gravity compensation torque calculated based on the dynamic model, constructing a training dataset containing perturbation characteristics under different working conditions to expand the sample distribution range, thereby enhancing the adaptability and anti-interference ability of the spiking neural network to gravity compensation of the robotic arm under complex working conditions. Therefore, embodiments of this application can obtain ( , The set of data pairs is used as training data. During the training process, Input directly into the gravity compensation network.
[0059] In this embodiment, the gravity compensation network constructed based on the spiking neural network is trained with the training data to optimize the parameters and obtain a converged gravity compensation network. This network is able to perform nonlinear modeling of state information such as joint position and joint velocity, and output the corresponding cell membrane potential and gravity compensation torque, thereby achieving adaptive compensation of the gravity term of the robotic arm and improving control accuracy and anti-disturbance capability.
[0060] The following examples illustrate the superiority of the torque compensation method for robotic arms based on spiking neural networks through simulation experiments. All simulations were conducted on a laptop equipped with an NVIDIA GeForce RTX 5070ti graphics card and an AMD Ryzen AI 9 HX CPU. The simulation environment was Pybullet, the simulation language was Python, the deep learning framework was PyTorch, the spiking neural network framework was SpikingJelly, and the robotic arm simulation model was the Rizon 4s from Flexiv. The simulation time step was set to 1ms, and the control cycle was 1kHz. The experiments in this embodiment employ proportional control-based torque-level feedback control, defined as: , in, , , Plan the trajectory for each joint. For gravity compensation torque, and Set to respectively and .
[0061] As shown in Table 4, the experimental design of this application embodiment includes four parts. In the first step, this application embodiment will conduct experiments using Model-based sampling control and ANN sampling control as baselines, and SNN sampling control as the target method. Specifically, gravity compensation torque will be generated through a dynamic model, an ANN neural network, and the spiking neural network-based robotic arm torque compensation method proposed in this application. The sampling is controlled via feedback. The baseline ANN network design is shown in Table 3, and the dynamic model used here is exactly the same as the dynamic model used to generate the training data described above.
[0062] Table 3
[0063] This application embodiment will measure the gravity compensation effect of the three methods by using the RMSE (Root Mean Square Error) of the joint space planned trajectory and the actual trajectory. The RMSE values shown in Table 4 are defined as follows: , in, The six test location trajectories are shown in Table 5. The six test postures are shown in Table 5. For the length of each test trajectory, Let be the root mean square error at each control time.
[0064] Table 4
[0065] The six test trajectories are defined as follows: , , , , , The Minjerk trajectory was generated using MATLAB, and its z-direction component was obtained through... The command generates the xy-plane components using the `minjerkpolytraj(waypoints,tpts, num_samples)` command. , , , , The lengths of the vertical circle, horizontal circle, oblique circle, and figure-eight trajectories are 4000, while the lengths of the petal-shaped and Minjerk trajectories are 5000. The parameters of the corresponding trajectories are shown in Table 6.
[0066] Table 5
[0067] Table 6
[0068] In the second part, to analyze the reasons for the advantage of SNN in tracking accuracy, this embodiment of the application will analyze the absolute value of the correlation coefficient between the input and output data of the SNN network and compare it with the ANN baseline. The absolute value of this correlation coefficient is defined as: , in, The six test location trajectories are shown in Table 5. The six test postures are shown in Table 5. This represents the correlation coefficient between the neural network input and output under each combination of test position trajectory and posture.
[0069] In the third part, this application embodiment will add Gaussian noise with a mean of 0 to the feedback signal and the gravity compensation output signal, and analyze the increase in RMSE of joint position and velocity under this noise condition to illustrate the advantages of the pulse coding proposed in the manipulator torque compensation method based on spiking neural networks. The signal-to-noise ratio is... Defined as: , in, The amplitude of the original noise-free signal. This represents the noise amplitude.
[0070] In Part Four, the embodiments of this application will illustrate the advantages of the proposed robotic arm torque compensation method based on spiking neural networks through differences in coding efficiency, specifically in three indicators: joint position and speed RMSE within the same coding time, and coding time within the same error. The feedback control method for the encoded input is as defined above; In a single coded input, feedback control is defined as: .
[0071] in, , , . Defined as: , in
[0072] Plan the trajectory for each joint. Set as and .
[0073] As shown in Table 7, in the embodiments of this application, compared with using a dynamic model to provide gravity compensation torque, both ANN and SNN significantly improve the position tracking accuracy when calculating gravity compensation torque, with SNN showing a more significant improvement. For example, in terms of joint position RMSE and end-effector attitude RMSE, ANN reduces them by 1.22% and 1.62%, while SNN reduces them by 3.12% and 1.82%. Furthermore, in terms of velocity tracking accuracy, SNN shows a significant improvement, while ANN's improvement is not significant compared to SNN, and even shows a slight decrease. For example, in terms of end-effector linear velocity RMSE, SNN improves by 3.2%, while ANN only improves by 0.059%; in terms of joint velocity RMSE and end-effector angular velocity RMSE, SNN improves by 0.31% and 0.63%, while ANN actually decreases by 0.26% and 0.37%. In summary, the robotic arm torque compensation method based on spiking neural networks proposed in this application significantly improves upon traditional model-based methods in six aspects of control accuracy, and is superior to ANN methods that also use neural networks.
[0074] Table 7
[0075] As shown in Table 8, to analyze the reasons for the advantage of SNN in tracking accuracy, the embodiments of this application illustrate the relationship between the absolute values of the correlation coefficients between the input and output signals of ANN and SNN networks. It can be seen that the correlation coefficient between the input and output signals of the SNN network is much higher than that of the ANN network, for example... Between the input pulse and the output pulse, joints 1, 3, and 6 improved by 11.87%, 12.43%, and 69.76%, respectively. Between the input and output pulses, and between joints 1, 3, and 6, the torque compensation was improved by 34.85%, 34.90%, and 8.09%, respectively. This indicates that the torque compensation method for the robotic arm based on spiking neural networks can more quickly capture changes in the planned trajectory and tracking error compared to the ANN baseline. When the error increases, the network is more inclined to increase or decrease the output according to the different trajectories to reduce the error; when the planned trajectory changes, the network is also more inclined to increase or decrease the output according to the different trajectories to respond to the changes in the planned trajectory.
[0076] Table 8
[0077] As shown in Table 9, the embodiments of this application demonstrate the relative increase in joint position and velocity RMSE of the three methods compared to the noise-free condition after adding noise to the feedback signal and gravity compensation output signal. It can be seen that, under any noise conditions, pulse coding can significantly reduce the impact of noise. For example, when noise is added to both the feedback and output, the joint position RMSE of all three methods decreases by 2%-3%, while the joint velocity RMSE decreases by more than 20%. Furthermore, among the three methods, the spiking neural network-based robotic arm torque compensation method proposed in this application has the smallest increase in joint position and velocity RMSE under noise conditions, regardless of whether continuous or pulse input is used. For example, when using continuous input and adding noise to both the feedback and gravity compensation output, the increase in joint position and velocity RMSE of the spiking neural network-based robotic arm torque compensation method is 16.49% and 87.14%, respectively, compared to 18.71% and 88.9% for the model-based method and 18.17% and 89.08% for the ANN-based method. In summary, the results in this table demonstrate that the torque compensation method for robotic arms based on spiking neural networks is better able to resist noise interference.
[0078] Table 9
[0079] As shown in Table 10, the embodiments of this application demonstrate direct use. Encode for gravity compensation calculation and use , The table shows the difference in computational efficiency resulting from encoding the gravity compensation calculations separately. It can be seen that, regardless of the model, ANN, or the spiking neural network-based robotic arm torque compensation method, under the same encoding time, the encoding method using the spiking neural network-based method reduces the joint position RMSE by approximately 15% and the joint velocity RMSE by approximately 45%. Furthermore, to ensure that both methods produce the same joint position and velocity RMSE, the encoding method using the spiking neural network-based method requires a 48.44% reduction in encoding time. In conclusion, the results in this table demonstrate that the spiking neural network-based robotic arm torque compensation method has higher computational efficiency.
[0080] Table 10
[0081] According to the robotic arm torque compensation method based on spiking neural networks proposed in this application, joint position and joint velocity are encoded into joint position error pulse sequences and joint velocity error pulse sequences, respectively, and input into a gravity compensation network for time-series modeling to obtain the gravity compensation torque of each joint. Then, based on the gravity compensation torque and combined with the joint position error pulse sequences and joint velocity error pulse sequences, a feedback correction term is constructed to dynamically correct the gravity compensation torque, resulting in the final joint torque output. This method can achieve the fusion of feedforward compensation and feedback control, improving the accuracy, stability, and anti-disturbance capability of robotic arm motion control. At the same time, by adopting an error-driven pulse coding strategy to express the joint state in an event-based manner, the temporal dynamic characteristics and abrupt change information during joint movement can be more fully preserved, enhancing the network's ability to represent long-term dependencies and nonlinear dynamic characteristics, thereby further improving the modeling accuracy and control performance of the gravity compensation network.
[0082] Next, referring to the accompanying drawings, a mechanical arm torque compensation device based on a spiking neural network, according to an embodiment of this application, is described.
[0083] Figure 4 This is a block diagram of a robotic arm torque compensation device based on a spiking neural network according to an embodiment of this application.
[0084] like Figure 4 As shown, the robotic arm torque compensation device 10 based on a spiking neural network includes: an acquisition module 100, an encoding module 200, and a compensation module 300.
[0085] The acquisition module 100 is used to acquire the joint position and joint speed of the robotic arm. The encoding module 200 is used to encode joint positions and joint velocities into joint position error pulse sequences and joint velocity error pulse sequences, and to determine the planned position and actual position of at least one joint of the robotic arm based on the joint position pulse sequences. The compensation module 300 is used to input the joint position error pulse sequence, the planned position and the actual position into a pre-trained gravity compensation network, calculate the cell membrane potential, output the gravity compensation torque of at least one joint, and determine the control torque of at least one joint based on the gravity compensation torque, the joint position error pulse sequence and the joint velocity error pulse sequence.
[0086] Optionally, in one embodiment of this application, the encoding formulas for joint position and velocity errors are as follows: , , in, For random variables, The pulse train that provides feedback on the joint position error. The pulse train that provides feedback on joint velocity error. These are the position and velocity error limits for each joint. The planned and actual positions of each joint. The planned speed and actual speed for each joint.
[0087] Optionally, in one embodiment of this application, the gravity compensation network includes an encoding module, a cyclic fully connected module, a decoding module, and a PC module, wherein the compensation module 300 includes: a conversion unit, an accumulation unit, an output unit, and an averaging unit.
[0088] The conversion unit is used to convert the joint position error pulse sequence, the planned position, and the actual position into a pulse sequence that meets preset standard conditions based on the encoding module. The accumulation unit is used to perform membrane potential accumulation and recursive state update processing on the pulse sequence based on the cyclic fully connected module to obtain the membrane potential state sequence of the pulse sequence. The output unit is used to determine the cell membrane potential based on the membrane potential state sequence using the decoding module. The averaging unit is used to perform piecewise averaging of cell membrane potential based on the PC module to determine the gravity compensation torque.
[0089] Optionally, in one embodiment of this application, the robotic arm torque compensation device 10 based on a spiking neural network further includes a generation module and a creation module.
[0090] The generation module is used to generate training data for the robotic arm based on the dynamic model of the robotic arm. The training data includes data pairs consisting of each joint position corresponding to the end-effector pose and the corresponding gravity compensation torque. A module is established to train an initial gravity compensation network using training data until the preset network conditions are met, thus establishing the gravity compensation network.
[0091] Optionally, in one embodiment of this application, the robotic arm torque compensation device 10 based on a spiking neural network further includes: Noise is added to the gravity compensation torque, where the formula for adding noise is: , , , , , in, To add a gravity-compensated torque to reduce noise, This refers to the joint position. This is the gravity compensation torque.
[0092] It should be noted that the foregoing explanation of the embodiment of the robotic arm torque compensation method based on spiking neural networks also applies to the robotic arm torque compensation device based on spiking neural networks in this embodiment, and will not be repeated here.
[0093] According to the embodiment of this application, the mechanical arm torque compensation device based on a spiking neural network encodes the joint position and joint velocity into joint position error pulse sequences and joint velocity error pulse sequences, respectively, and inputs them into a gravity compensation network for timing modeling to obtain the gravity compensation torque of each joint. Then, based on the gravity compensation torque and combined with the joint position error pulse sequence and joint velocity error pulse sequence, a feedback correction term is constructed to dynamically correct the gravity compensation torque and obtain the final joint torque output. This can realize the fusion of feedforward compensation and feedback control, and improve the accuracy, stability and anti-disturbance capability of the mechanical arm motion control.
[0094] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device may include: The memory 501, the processor 502, and the computer program stored on the memory 501 and capable of running on the processor 502.
[0095] When the processor 502 executes the program, it implements the mechanical arm torque compensation method based on spiking neural network provided in the above embodiments.
[0096] Furthermore, electronic devices also include: Communication interface 503 is used for communication between memory 501 and processor 502.
[0097] The memory 501 is used to store computer programs that can run on the processor 502.
[0098] Memory 501 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0099] If the memory 501, processor 502, and communication interface 503 are implemented independently, then the communication interface 503, memory 501, and processor 502 can be interconnected via a bus to complete communication between them. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 5 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0100] Optionally, in a specific implementation, if the memory 501, processor 502, and communication interface 503 are integrated on a single chip, then the memory 501, processor 502, and communication interface 503 can communicate with each other through an internal interface.
[0101] Processor 502 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.
[0102] This embodiment also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for compensating the torque of a robotic arm based on a spiking neural network.
[0103] This application also provides a computer program product, including a computer program that can run computer instructions. When the computer instructions are executed by a processor, they implement the robotic arm torque compensation method based on a spiking neural network provided in this application.
[0104] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0105] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0106] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or N executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.
[0107] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.
[0108] It should be understood that the various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, the N steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, it can be implemented using any one or more of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0109] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0110] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0111] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.
Claims
1. A method for torque compensation of a robotic arm based on a spiking neural network, characterized in that, Includes the following steps: Obtain the joint positions and joint velocities of the robotic arm; The joint position and the joint velocity are encoded into a joint position error pulse sequence and a joint velocity error pulse sequence, and the planned position and actual position of at least one joint of the robotic arm are determined based on the joint position pulse sequence. The joint position error pulse sequence, the planned position, and the actual position are input into a pre-trained gravity compensation network to calculate the cell membrane potential, so as to output the gravity compensation torque of at least one of the joints, and the control torque of at least one of the joints is determined based on the gravity compensation torque, the joint position error pulse sequence, and the joint velocity error pulse sequence.
2. The method according to claim 1, characterized in that, The encoding formulas for the joint position and the velocity error are as follows: , , in, For random variables, The pulse train that provides feedback on the joint position error. The pulse train that provides feedback on joint velocity error. These are the position and velocity error limits for each joint. The planned and actual positions of each joint. The planned speed and actual speed for each joint.
3. The method according to claim 1, characterized in that, The gravity compensation network includes an encoding module, a recurrent fully connected module, a decoding module, and a PC module. The step of inputting the joint position error pulse sequence, the planned position, and the actual position into the pre-trained gravity compensation network to calculate the cell membrane potential and output the gravity compensation torque for at least one of the joints includes: Based on the encoding module, the joint position error pulse sequence, the planned position, and the actual position are converted into pulse sequences that meet preset standard conditions; Based on the aforementioned fully connected cyclic module, the pulse sequence is processed by membrane potential accumulation and recursive state update to obtain the membrane potential state sequence of the pulse sequence. Based on the decoding module, the cell membrane potential is determined according to the membrane potential state sequence; Based on the PC module, the cell membrane potential is segmented and averaged to determine the gravitational compensation torque.
4. The method according to claim 1, characterized in that, Before being input into the pre-trained gravity compensation network, the following is also included: Based on the dynamic model of the robotic arm, training data for the robotic arm is generated, wherein the training data includes data pairs consisting of each joint position corresponding to the end-effector pose and the corresponding gravity compensation torque; The initial gravity compensation network is trained using the training data until the preset network conditions are met, thus establishing the gravity compensation network.
5. The method according to claim 4, characterized in that, Also includes: Noise is added to the gravity compensation torque, wherein the formula for adding the noise is: , , , , , in, To add a gravity-compensated torque to reduce noise, This refers to the joint position. This is the gravity compensation torque.
6. A torque compensation device for a robotic arm based on a spiking neural network, characterized in that, Includes the following steps: The acquisition module is used to acquire the joint positions and joint velocities of the robotic arm; The encoding module is used to encode the joint position and the joint velocity into a joint position error pulse sequence and a joint velocity error pulse sequence, and to determine the planned position and actual position of at least one joint of the robotic arm based on the joint position pulse sequence. The compensation module is used to input the joint position error pulse sequence, the planned position, and the actual position into a pre-trained gravity compensation network, calculate the cell membrane potential, output the gravity compensation torque of at least one of the joints, and determine the control torque of at least one of the joints based on the gravity compensation torque, the joint position error pulse sequence, and the joint velocity error pulse sequence.
7. The apparatus according to claim 6, characterized in that, The encoding formulas for the joint position and the velocity error are as follows: , , in, For random variables, The pulse train that provides feedback on the joint position error. The pulse train that provides feedback on joint velocity error. These are the position and velocity error limits for each joint. The planned and actual positions of each joint. The planned speed and actual speed for each joint.
8. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and capable of running on the processor, the processor executing the program to implement the robotic arm torque compensation method based on a spiking neural network as described in any one of claims 1-5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, The program is executed by the processor to implement the spiking neural network-based robotic arm torque compensation method as described in any one of claims 1-5.
10. A computer program product, comprising a computer program, characterized in that, The computer program is executed to implement the robotic arm torque compensation method based on a spiking neural network as described in any one of claims 1-5.
