A hardware adaptive robot control calibration method based on neural network
By adopting a hardware adaptive robotic arm control method based on neural networks, the accuracy problem of traditional robotic arm control when hardware changes is solved, and rapid adaptation and high-precision robotic arm calibration are achieved.
Patent Information
- Application Number
- CN202311114446.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-31
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2043-08-31
AI Technical Summary
Traditional robotic arm control methods cannot guarantee control accuracy when the hardware mechanical structure changes, and environmental uncertainties lead to performance degradation, requiring recalibration.
A hardware adaptive robotic arm control method based on neural networks is adopted. By training a servo signal generation neural network and a robotic arm pose prediction neural network, and using the gradient descent algorithm to adjust parameters, the robotic arm can achieve rapid adaptive calibration.
It can quickly adapt to situations such as deformation of the robotic arm, replacement of camera components, or aging of servo motors, reducing after-sales debugging costs and improving control precision.
Smart Images

Figure CN117047770B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of robotic arm control, and more specifically, to a hardware adaptive robotic arm control calibration method based on neural networks. Background Technology
[0002] Traditional robotic arm control methods are primarily based on mathematical models, physical principles, and control algorithms, such as PID control, kinematic and dynamic control. When using these methods to control a robotic arm, if the robotic arm's hardware structure undergoes changes such as bending, stretching, or compression, the accuracy of continued control cannot usually be guaranteed, requiring recalibration or retraining. In some cases, the complexity of the robotic arm and the uncertainty of the environment can also lead to a decline in the performance of traditional methods. Summary of the Invention
[0003] The purpose of this invention is to provide a hardware-adaptive robotic arm control calibration method that can adapt to the calibration of different models of robotic arms with only one training of the neural network.
[0004] The technical solution of this invention is: to provide a hardware adaptive robotic arm control calibration method based on neural networks, wherein the robotic arm consists of at least two servo motors and at least two forearms, and a camera is set in each of the six directions (up, down, left, right, front, and back) to capture images of the robotic arm; the method includes:
[0005] S1. During the training phase, randomly generated servo angle data and their corresponding XYZ coordinate data of the robotic arm end effector are used as training sets to train the servo signal generation neural network and the robotic arm pose prediction neural network based on meta-learning, respectively. The parameters of the two neural networks are adjusted according to the gradient descent algorithm. The output layer of the servo signal generation neural network is connected to the input layer of the robotic arm pose prediction neural network to realize gradient concatenation. The gradient concatenated neural network is trained using randomly generated servo angle data and their corresponding XYZ coordinate data of the robotic arm end effector, and the parameters of the servo signal generation neural network are adjusted according to the backpropagation algorithm. The training is completed after a predetermined number of iterations.
[0006] S2. During the usage phase, the parameters of the trained servo signal generation neural network are synchronized to the servo signal generation neural network of the robotic arm to be shipped out, and then the robotic arm is shipped out. After the user specifies the target coordinates of the end effector of the robotic arm, the robotic arm obtains the target angle of the servo through the servo signal generation neural network, which drives the robotic arm to work.
[0007] In any of the above technical solutions, the number of servo motors and forearms of the robotic arm are both N, where N is a positive integer greater than or equal to 2. The training phase includes the following steps:
[0008] S11. Randomly generate the arm length and bending arc of each of the N forearms of the robotic arm, and input the data into the robotic arm simulation software;
[0009] S12. Randomly generate M N-dimensional angle vectors, where M is a positive integer greater than or equal to 2. Input the generated N-dimensional vectors into the robotic arm simulation software. The N elements of each N-dimensional vector are used as the angles of the N servo motors of the robotic arm to obtain M XYZ coordinates of the robotic arm end and represent them as M 3-dimensional coordinate vectors.
[0010] S13. Normalize each element of all vectors generated in step S12, and concatenate the first M-1 N-dimensional angle vectors and the first M-1 3-dimensional coordinate vectors after normalization to generate M-1 N+3-dimensional vectors.
[0011] S14. After concatenating the M-1 N+3 dimensional vectors generated in step S13 in sequence, the Mth 3 dimensional vector is concatenated at the end to generate a (M-1)(N+3)+3 dimensional vector. This (M-1)(N+3)+3 dimensional vector is used as the training set and input into the servo signal generation neural network. The servo signal generation neural network outputs an N dimensional vector representing the predicted servo angle of the Mth robotic arm. This N dimensional vector is compared with the normalized Mth N dimensional vector generated in step S12. The loss value is calculated using the L1 Loss loss function, and the parameters of the servo signal generation neural network are adjusted using the gradient descent algorithm.
[0012] S15. Concatenate the M-1 N+3 dimensional vectors generated in step S13 in sequence, and then concatenate the Mth N-dimensional vector at the end to generate a (M-1)(N+3)+N dimensional vector. Use this (M-1)(N+3)+N dimensional vector as the training set input to the robotic arm pose prediction neural network. The robotic arm pose prediction neural network outputs a 3-dimensional vector representing the predicted XYZ coordinates of the end of the Mth robotic arm. Compare this 3-dimensional vector with the normalized Mth 3-dimensional vector generated in step S12, calculate the loss value using the L1Loss loss function, and adjust the parameters of the robotic arm pose prediction neural network using the gradient descent algorithm.
[0013] S16. Repeat steps S11 to S15 several times to train the servo signal generation neural network and the robotic arm pose prediction neural network.
[0014] In any of the above technical solutions, the robotic arm further comprises four servo motors and four forearms, and the training phase includes the following steps:
[0015] S11. Randomly generate the arm length and bending arc of each of the four forearms of the robotic arm, and input the data into the robotic arm simulation software;
[0016] S12. Randomly generate 7 4-dimensional angle vectors. Input the generated 4-dimensional vectors into the robotic arm simulation software. The 4 elements of each 4-dimensional vector are used as the angles of the 4 servo motors of the robotic arm to obtain the 7 XYZ coordinates of the robotic arm end and represent them as 7 3-dimensional coordinate vectors.
[0017] S13. Normalize each element of all vectors generated in step S12, and concatenate the first 6 normalized 4-dimensional angle vectors and the first 6 normalized 3-dimensional coordinate vectors to generate 6 7-dimensional vectors.
[0018] S14. After concatenating the six 7-dimensional vectors generated in step S13 in sequence, concatenate the seventh 3-dimensional vector at the end to generate a 45-dimensional vector. Use this 45-dimensional vector as the training set and input it into the servo signal generation neural network. The servo signal generation neural network outputs a 4-dimensional vector representing the predicted servo angle of the seventh robotic arm. Compare this 4-dimensional vector with the normalized seventh 4-dimensional vector generated in step S12, calculate the loss value using the L1Loss loss function, and adjust the parameters of the servo signal generation neural network using the gradient descent algorithm.
[0019] S15. Concatenate the six 7-dimensional vectors generated in step S13 in sequence, and then concatenate the seventh 4-dimensional vector at the end to generate a 46-dimensional vector. Use this 46-dimensional vector as the training set and input it into the robotic arm pose prediction neural network. The robotic arm pose prediction neural network outputs a 3-dimensional vector representing the predicted XYZ coordinates of the end of the seventh robotic arm. Compare this 3-dimensional vector with the normalized seventh 3-dimensional vector generated in step S12, calculate the loss value using the L1Loss loss function, and adjust the parameters of the robotic arm pose prediction neural network using the gradient descent algorithm.
[0020] S16. Repeat steps S11 to S15 several times to train the servo signal generation neural network and the robotic arm pose prediction neural network.
[0021] In any of the above technical solutions, the 4-dimensional angle vector generated in step S12 has a value range between 0 and 180.
[0022] In any of the above technical solutions, further, all elements of the 4-dimensional angle vector are divided by 180 to complete normalization, and all elements of the 3-dimensional coordinate vector are divided by the sum of the arm lengths of the four forearms of the robotic arm generated in step S11 to complete normalization.
[0023] In any of the above technical solutions, the training phase further includes the following steps:
[0024] S17. Repeat steps S11 to S13 once. After generating a 45-dimensional vector input to the servo signal generation neural network in the manner of step 14 and obtaining a 4-dimensional vector as the output result, generate a 46-dimensional vector input to the robotic arm pose prediction neural network in the manner of step 15 and output the result. The last 4 elements of the 46-dimensional vector are replaced with the 4 elements of the 4-dimensional vector output by the servo signal generation neural network in this step.
[0025] In steps S18 and 17, the robotic arm pose prediction neural network outputs a 3D vector representing the predicted XYZ coordinates of the end effector of the 7th robotic arm. This 3D vector is compared with the normalized 7th 3D vector generated in step S17. The loss value is calculated using the L1Loss loss function, and the parameters of the servo signal generation neural network are corrected using the backpropagation algorithm.
[0026] S19. Repeat steps S17 to S18 several times to further train the servo signal generation neural network.
[0027] In any of the above technical solutions, the steps in the usage phase further include:
[0028] S21. Set a target object at the end of the robotic arm that can be visually detected and located by a camera.
[0029] S22. Randomly generate 6 4-dimensional angle vectors, and use these 6 4-dimensional angle vectors to make the robotic arm work in sequence. Record the XYZ coordinates of the target object after the robotic arm works 6 times. Represent the XYZ coordinates of the target object as 6 3-dimensional coordinate vectors. Concatenate the 6 4-dimensional angle vectors and the 6 3-dimensional coordinate vectors to generate 6 7-dimensional vectors.
[0030] S23. After concatenating the six 7-dimensional vectors generated in step S22 in sequence, add the three elements (XYZ) of the end coordinates of the robotic arm specified by the user to the end to generate a 45-dimensional vector. Normalize each element of the 45-dimensional vector and input it into the servo signal to generate a neural network to obtain a 4-dimensional vector output by the neural network. After inverse normalizing each element of the 4-dimensional vector, use it as the target angle of the four servos of the robotic arm. The robotic arm works according to the target angle of the four servos.
[0031] In any of the above technical solutions, the XYZ coordinates of the target object are further recorded using camera positioning. One camera can locate two coordinates in the XYZ coordinates of the target object. The six cameras obtain a total of four X coordinates, four Y coordinates and four Z coordinates. The average value of each coordinate is used as the XYZ coordinates of the target object for output.
[0032] The beneficial effects of this invention are:
[0033] 1. In the technical solution proposed in this invention, the inputs of the servo signal generation neural network and the robotic arm pose prediction neural network include several hardware feature samples (6 sets of generated random samples) and the inverse kinematics XYZ coordinate system target (the 7th set of robotic arm end XYZ coordinates) or servo target angle (the 7th set of servo angles). Compared with the conventional neural network model that only inputs the inverse kinematics XYZ coordinate system target, it can quickly adapt itself in the case of robotic arm deformation, camera component replacement, servo aging, etc., reducing after-sales debugging costs.
[0034] 2. In this invention, after the servo signal generation neural network and the robotic arm pose prediction neural network each complete a round of training independently, the output layer of the servo signal generation neural network and the input layer of the robotic arm pose prediction neural network are connected in series for another round of training. In this round of training, only the parameters of the servo signal generation neural network are adjusted, which can accelerate the convergence speed of the servo signal generation neural network and improve the final control accuracy. Attached Figure Description
[0035] The advantages of the above and additional aspects of the present invention will become apparent and readily understood in the description of the embodiments in conjunction with the following drawings, wherein:
[0036] Figure 1 This is a schematic diagram of the algorithm of a hardware adaptive robotic arm control calibration method based on a neural network according to an embodiment of the present invention;
[0037] Figure 2 This is a schematic diagram of a robotic arm structure according to an embodiment of a hardware adaptive robotic arm control calibration method based on a neural network according to an embodiment of the present invention.
[0038] Figure 3 This is a schematic diagram of the servo signal generation neural network of a hardware adaptive robotic arm control calibration method based on a neural network according to an embodiment of the present invention.
[0039] Figure 4 This is a schematic diagram of the structure of the robotic arm pose prediction neural network in a hardware adaptive robotic arm control calibration method based on a neural network according to an embodiment of the present invention.
[0040] Figure 5 This is a schematic diagram of a robotic arm using a hardware adaptive robotic arm control calibration method based on a neural network according to an embodiment of the present invention. Detailed Implementation
[0041] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments of the present invention and the features thereof can be combined with each other.
[0042] In the following description, many specific details are set forth in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.
[0043] like Figure 1 As shown, this embodiment provides a hardware adaptive robotic arm control calibration method based on neural networks, which includes:
[0044] S1. During the training phase, random data is used to train the servo signal generation neural network and the robotic arm pose prediction neural network based on meta-learning.
[0045] S2. During the usage phase, the trained servo signal generation neural network parameters are synchronized to the servo signal generation neural network of the robotic arm. After the user specifies the target coordinates at the end of the robotic arm, the robotic arm obtains the target angle of the servo through the servo signal generation neural network and performs its work.
[0046] like Figure 2 As shown, in this embodiment, the robotic arm consists of four servo motors (M0 to M3) and four forearms (L0 to L3), wherein the servo motor M0 is connected to the base; in addition, a camera is set in each of the six directions of the robotic arm to capture images of the robotic arm.
[0047] like Figure 3 and Figure 4 As shown, both the servo signal generation neural network and the robotic arm pose prediction neural network are constructed based on a 3-layer fully connected linear layer. In this embodiment, the input layer and intermediate layer of both neural networks use the ReLU activation function, while the output layer does not use an activation function.
[0048] ReLU (Rectified Linear Unit) is a commonly used activation function in neural networks and deep learning models. It is usually represented as ReLU(x) = max(0,x). It returns the input value when the input value to the ReLU activation function is greater than or equal to zero, and returns zero otherwise.
[0049] The input layer of the neural network for predicting the pose of a robotic arm receives a 46-dimensional vector, and the output layer outputs a 3-dimensional vector representing the XYZ coordinates of the robotic arm's end effector.
[0050] The input layer of the servo signal generation neural network receives a 45-dimensional vector, and the output layer outputs a 4-dimensional vector representing the angles of the four servos of the robotic arm.
[0051] The training steps for the robotic arm pose prediction neural network and the servo signal generation neural network include:
[0052] S11. Randomly generate the arm length and bending arc of each of the four forearms of the robotic arm, and input the data into the robotic arm simulation software.
[0053] The robotic arm simulation software outputs the XYZ coordinates of the end effector after inputting the arm length, bending arc of each forearm, and the angle of each servo motor. The robotic arm simulation software only needs to have a custom robotic arm model and coordinate positioning function, such as CoppeliaSim and Adams.
[0054] S12. Randomly generate 7 4-dimensional vectors, where the random range of each element of the vector is between 0 and 180 (inclusive). Input the generated 4-dimensional vectors into the robotic arm simulation software in sequence as the angles of the 4 servo motors of the robotic arm, and obtain the XYZ coordinates of the 7 robotic arm end points and represent them as 7 3-dimensional vectors.
[0055] S13. Normalize each element of the 7 four-dimensional vectors and 7 three-dimensional vectors generated in step S12, and concatenate the first 6 four-dimensional vectors and the first 6 three-dimensional vectors after normalization to generate 6 seven-dimensional vectors.
[0056] Specifically, the 4-dimensional vector is normalized by dividing all elements by 180, and the XYZ coordinates are normalized by dividing them by the maximum length of the sum of the four forearms. The 7-dimensional vector generated in step S13 can be represented as [Servo1,Servo2,Servo3,Servo4,X,Y,Z], where Servo1 to Servo4 represent the four servo angles after normalization.
[0057] S14. Concatenate the six 7-dimensional vectors generated in step S13 in sequence, and then concatenate the seventh 3-dimensional vector at the end to generate a 45-dimensional vector. Use this 45-dimensional vector as the training set and input it into the servo signal generation neural network. The servo signal generation neural network outputs a 4-dimensional vector representing the predicted servo angle of the seventh robotic arm. Compare this 4-dimensional vector with the normalized seventh 4-dimensional vector generated in step S12, calculate the loss value using the L1 Loss loss function, and adjust the parameters of the servo signal generation neural network using the gradient descent algorithm.
[0058] Specifically, the L1 loss function is a commonly used loss function for regression problems. Its result is the average of the absolute differences between the predicted and actual values, often expressed as... Where n is the number of samples, y pred For the predicted value, y true For the true value, y pred,i y is the predicted value of the i-th sample. true,iIt is the true value of the i-th sample; gradient descent is a commonly used optimization algorithm used to adjust model parameters to minimize the loss function. It calculates the gradient of the loss function with respect to the parameters, and then adjusts the parameters in the direction of the gradient to reduce the value of the loss function.
[0059] S15. Concatenate the six 7-dimensional vectors generated in step S13 in sequence, and then concatenate the seventh 4-dimensional vector at the end to generate a 46-dimensional vector. Use this 46-dimensional vector as the training set and input it into the robotic arm pose prediction neural network. The robotic arm pose prediction neural network outputs a 3-dimensional vector representing the predicted XYZ coordinates of the end effector of the seventh robotic arm. Compare this 3-dimensional vector with the normalized seventh 3-dimensional vector generated in step S12, calculate the loss value using the L1 Loss loss function, and adjust the parameters of the robotic arm pose prediction neural network using the gradient descent algorithm.
[0060] Specifically, in steps S14 and S15, the six 7-dimensional vectors are concatenated, and the concatenation result is represented as: [Simple1,Simple2,Simple3,Simple4,Simple5,Simple6], where Simple1 to 6 represent the six 7-dimensional vectors respectively.
[0061] The inputs to the two neural networks, namely the aforementioned 45-dimensional and 46-dimensional vectors, each include several hardware feature samples (six generated random samples) and an inverse kinematics XYZ coordinate system target (the XYZ coordinates of the robotic arm end effector in the 7th group) or a servo target angle (the servo angle in the 7th group). Compared to the conventional neural network model that uses only the inverse kinematics XYZ coordinate system target as input, this approach can quickly adapt to situations such as robotic arm deformation, camera component replacement, or servo aging. Furthermore, by keeping the inverse kinematics XYZ coordinate system target unchanged, changing the hardware feature samples can generate a new robotic arm bending scheme. For example, generating a scheme where the robotic arm bends to the left. If this scheme has potential collision problems, simply changing the hardware feature samples, i.e., the first 42 elements, will generate a robotic arm bending scheme that is different from the first scheme but has the same robotic arm end effector coordinates. This method allows for the search for schemes suitable for the user scenario.
[0062] S16. Repeat steps S11 to S15 several times to train the servo signal generation neural network and the robotic arm pose prediction neural network.
[0063] S17. Repeat steps S11 to S13 once, generate a 45-dimensional vector input servo signal generation neural network in the manner of step 14, and generate a 46-dimensional vector input robotic arm pose prediction neural network in the manner of step 15. Replace the last 4 elements of the 46-dimensional vector with the 4 elements of the 4-dimensional vector output by the servo signal generation neural network in this step.
[0064] In steps S18 and 17, the robotic arm pose prediction neural network outputs a 3D vector representing the predicted XYZ coordinates of the end effector of the 7th robotic arm. This 3D vector is compared with the normalized 7th 3D vector generated in step S17. The loss value is calculated using the L1Loss loss function, and the parameters of the servo signal generation neural network are corrected using the backpropagation algorithm.
[0065] Specifically, backpropagation is an optimization algorithm used to train neural networks. It updates network parameters by calculating the gradient of the loss function with respect to the network parameters. This algorithm allows the neural network to gradually adjust its weights and biases to make its output closer to the desired output, thereby improving network performance. In this embodiment, the PyTorch backpropagation mechanism is used to calculate the impact of each network parameter on the loss function through the chain rule. Starting from the output layer, the gradient is calculated layer by layer to understand how the parameters affect the loss. Based on the calculated gradient, gradient descent is used to update the network weights and biases to reduce the value of the loss function. The gradient indicates the direction of change of the loss function relative to the parameters and helps in parameter updating.
[0066] S19. Repeat steps S17 to S18 several times to further train the servo signal generation neural network.
[0067] The usage phase steps include:
[0068] S21. Set a target object at the end of the robotic arm that can be visually detected and located by a camera.
[0069] Specifically, such as Figure 5 As shown, the six cameras located in the six directions of the robotic arm (front, back, left, right, up, down) all have visual detection and positioning functions, which can capture and locate the coordinates of the target object in the image.
[0070] S22. Randomly generate 6 4-dimensional vectors, where the random range of each element of the vector is between 0 and 180 (inclusive). Use these 6 4-dimensional vectors to make the robotic arm work in sequence. Record the XYZ coordinates of the target object after the robotic arm works 6 times, which are represented as 6 3-dimensional vectors. Concatenate the 6 4-dimensional vectors and the 6 3-dimensional vectors to generate 6 7-dimensional vectors.
[0071] Specifically, the four elements of the 4D vector are used sequentially as the operating angles of the four servos to make the robotic arm work; one camera can locate two coordinates in the XYZ coordinates of the target object, and the six cameras obtain a total of four X coordinates, four Y coordinates and four Z coordinates, and the average value is used as the XYZ coordinates of the target object.
[0072] In addition, during step S22, when the robotic arm is working, if the staff finds that the forearm is about to collide during the movement of the robotic arm, they immediately stop the movement of the robotic arm and randomly generate a new 4-dimensional vector.
[0073] S23. Concatenate the six 7-dimensional vectors generated in step S22 in sequence, and then concatenate the three elements (XYZ) of the end coordinates of the robotic arm specified by the user at the end to generate a 45-dimensional vector. Normalize each element of the 45-dimensional vector and input it into the servo signal to generate a neural network to obtain a 4-dimensional vector output by it. After denormalizing each element of the 4-dimensional vector, it is used as the target angle of the four servos of the robotic arm in sequence. The robotic arm works according to the target angle of the four servos.
[0074] In another embodiment of the present invention, after the robotic arm is calibrated as described above at the factory, two target coordinates are randomly input, and the robotic arm is subjected to actual testing (all data are normalized):
[0075] The first input target is [-0.4241781532764435, -0.20932458341121674, 0.19367444515228271]. The control quantities obtained by the robotic arm are [0.13705816864967346, 0.6706700325012207, 0.3451088070869446, 0.36385]. [950446128845] After the robotic arm completes its movement, the actual coordinates of the robotic arm's end effector are [-0.4271441102027893, -0.20608479738235474, 0.200933735370636]. Calculations show that the error between the scheme generated by the robotic arm and the target in the XYZ directions is less than 1% (the denominator of the error calculation is the total length of the robotic arm).
[0076] The second target input is [0.10076187551021576, 0.03998235613107681, 0.41678675055503845], and the control quantities obtained from the robotic arm's operation are [0.09891268610954285, 0.35412952303886414, 0.6853660941123962, 0.87111306190490].
[72] After the robotic arm completes its movement, the actual coordinates of the robotic arm's end effector are [0.09768179059028625, 0.03535327622294426, 0.4035940754413605]. Calculations show that the second scheme generated by the robotic arm itself has an error of less than 1% in the XY directions and only about 1.3% in the Z direction compared to the target. This demonstrates that the calibration scheme provided by the present invention has high accuracy.
[0077] In summary, this invention proposes a hardware adaptive robotic arm control calibration method based on neural networks. This method includes a training phase and an application phase, specifically comprising:
[0078] During the training phase, randomly generated servo angle data and their corresponding XYZ coordinate data of the robotic arm end effector are used as training sets to train the servo signal generation neural network and the robotic arm pose prediction neural network based on meta-learning, respectively. The parameters of the two neural networks are adjusted according to the gradient descent algorithm. The output layer of the servo signal generation neural network is connected to the input layer of the robotic arm pose prediction neural network to realize gradient concatenation. The gradient concatenated neural network is trained using randomly generated servo angle data and their corresponding XYZ coordinate data of the robotic arm end effector, and the parameters of the servo signal generation neural network are adjusted according to the backpropagation algorithm.
[0079] During the usage phase, the parameters of the trained servo signal generation neural network are synchronized to the servo signal generation neural network of the robotic arm to be shipped out. After the user specifies the target coordinates of the end effector of the robotic arm, the robotic arm obtains the target angle of the servo through the servo signal generation neural network, which drives the robotic arm to work.
[0080] The steps in this invention can be adjusted, combined, or deleted according to actual needs.
[0081] The units in the device of the present invention can be merged, divided, or reduced according to actual needs.
[0082] Although the invention has been disclosed in detail with reference to the accompanying drawings, it should be understood that these descriptions are merely exemplary and not intended to limit the application of the invention. The scope of protection of the invention is defined by the appended claims and may include various modifications, alterations, and equivalents made to the invention without departing from the scope and spirit of the invention.
Claims
1. A hardware adaptive robotic arm control calibration method based on neural networks, wherein the robotic arm consists of at least two servo motors and at least two forearms, and the robotic arm is equipped with a camera in each of the six directions (up, down, left, right, front, and back) for capturing images of the robotic arm; the method includes: S1. During the training phase, randomly generated servo angle data and their corresponding XYZ coordinate data of the robotic arm end effector are used as training sets to train the servo signal generation neural network and the robotic arm pose prediction neural network based on meta-learning, respectively. The parameters of the two neural networks are adjusted according to the gradient descent algorithm. The output layer of the servo signal generation neural network is connected to the input layer of the robotic arm pose prediction neural network to realize gradient concatenation. The gradient concatenated neural network is trained using randomly generated servo angle data and their corresponding XYZ coordinate data of the robotic arm end effector, and the parameters of the servo signal generation neural network are adjusted according to the backpropagation algorithm. The training is completed after a predetermined number of iterations. The robotic arm has N servo motors and N forearms, where N is a positive integer greater than or equal to 2. The training phase includes the following steps: S11. Randomly generate the arm length and bending arc of each of the N forearms of the robotic arm, and input the data into the robotic arm simulation software; S12. Randomly generate M N-dimensional angle vectors, where M is a positive integer greater than or equal to 2. Input the generated N-dimensional angle vectors into the robotic arm simulation software. The N elements of each N-dimensional angle vector are used as the angles of the N servo motors of the robotic arm to obtain M XYZ coordinates of the robotic arm end and represent them as M 3D coordinate vectors. S13. Normalize each element of all vectors generated in step S12, and concatenate the first M-1 N-dimensional angle vectors and the first M-1 3-dimensional coordinate vectors after normalization to generate M-1 N+3-dimensional vectors. S14. After concatenating the M-1 N+3 dimensional vectors generated in step S13 in sequence, the Mth 3-dimensional coordinate vector is concatenated at the end to generate a (M-1)(N+3)+3 dimensional vector. This (M-1)(N+3)+3 dimensional vector is used as the training set and input into the servo signal generation neural network. The servo signal generation neural network outputs an N-dimensional angle vector representing the predicted servo angle value of the Mth robotic arm. This N-dimensional angle vector is compared with the normalized Mth N-dimensional angle vector generated in step S12. The loss value is calculated using the L1Loss loss function, and the parameters of the servo signal generation neural network are adjusted using the gradient descent algorithm. S15. Concatenate the M-1 N+3 dimensional vectors generated in step S13 in sequence, and then concatenate the Mth N-dimensional angle vector at the end to generate a (M-1)(N+3)+N dimensional vector. Use this (M-1)(N+3)+N dimensional vector as the training set input to the robotic arm pose prediction neural network. The robotic arm pose prediction neural network outputs a 3-dimensional coordinate vector representing the predicted XYZ coordinates of the end of the Mth robotic arm. Compare this 3-dimensional coordinate vector with the normalized Mth 3-dimensional coordinate vector generated in step S12, calculate the loss value using the L1Loss loss function, and adjust the parameters of the robotic arm pose prediction neural network using the gradient descent algorithm. S16. Repeat steps S11 to S15 several times to train the servo signal generation neural network and the robotic arm pose prediction neural network. S2. In the usage phase, the parameters of the trained servo signal generation neural network are synchronized to the servo signal generation neural network of the robotic arm to be shipped, and then the robotic arm is shipped out. After the user specifies the target coordinates of the end of the robotic arm, the robotic arm obtains the target angle of the servo through the servo signal generation neural network, and drives the robotic arm to work.
2. The hardware adaptive robotic arm control calibration method based on neural networks as described in claim 1, characterized in that, The robotic arm has four servo motors and four forearms. The training phase includes the following steps: S11. Randomly generate the arm length and bending arc of each of the four forearms of the robotic arm, and input the data into the robotic arm simulation software; S12. Randomly generate 7 4D angle vectors. Input the generated 4D angle vectors into the robotic arm simulation software. The 4 elements of each 4D angle vector are used as the angles of the 4 servo motors of the robotic arm to obtain the 7 XYZ coordinates of the robotic arm end and represent them as 7 3D coordinate vectors. S13. Normalize each element of all vectors generated in step S12, and concatenate the first 6 normalized 4-dimensional angle vectors and the first 6 normalized 3-dimensional coordinate vectors to generate 6 7-dimensional vectors. S14. After concatenating the six 7-dimensional vectors generated in step S13 in sequence, concatenate the seventh 3-dimensional coordinate vector at the end to generate a 45-dimensional vector. Use this 45-dimensional vector as the training set and input it into the servo signal generation neural network. The servo signal generation neural network outputs a 4-dimensional angle vector representing the predicted servo angle of the seventh robotic arm. Compare this 4-dimensional angle vector with the normalized seventh 4-dimensional angle vector generated in step S12, calculate the loss value using the L1 Loss loss function, and adjust the parameters of the servo signal generation neural network using the gradient descent algorithm. S15. Concatenate the six 7-dimensional vectors generated in step S13 in sequence, and then concatenate the seventh 4-dimensional angle vector at the end to generate a 46-dimensional vector. Use this 46-dimensional vector as the training set and input it into the robotic arm pose prediction neural network. The robotic arm pose prediction neural network outputs a 3-dimensional coordinate vector representing the predicted XYZ coordinates of the end of the seventh robotic arm. Compare this 3-dimensional coordinate vector with the normalized 7th 3-dimensional coordinate vector generated in step S12, calculate the loss value using the L1Loss loss function, and adjust the parameters of the robotic arm pose prediction neural network using the gradient descent algorithm. S16. Repeat steps S11 to S15 several times to train the servo signal generation neural network and the robotic arm pose prediction neural network.
3. The hardware adaptive robotic arm control calibration method based on neural networks as described in claim 2, characterized in that, The 4-dimensional angle vector generated in step S12 has a value range between 0 and 180.
4. The hardware adaptive robotic arm control calibration method based on neural networks as described in claim 2, characterized in that, The 4-dimensional angle vector is normalized by dividing all elements by 180, and the 3-dimensional coordinate vector is normalized by dividing all elements by the sum of the lengths of the four forearms of the robotic arm generated in step S11.
5. The hardware adaptive robotic arm control calibration method based on neural networks as described in claim 2, characterized in that, The training phase also includes the following steps: S17. Repeat steps S11 to S13 once. After generating a 45-dimensional vector input to the servo signal generation neural network in the manner of step 14 and obtaining a 4-dimensional angle vector as the output result, generate a 46-dimensional vector input to the robotic arm pose prediction neural network in the manner of step 15 and output the result. The last 4 elements of the 46-dimensional vector are replaced with the 4 elements of the 4-dimensional angle vector output by the servo signal generation neural network in this step. In steps S18 and 17, the robotic arm pose prediction neural network outputs a 3D coordinate vector representing the predicted XYZ coordinates of the end effector of the 7th robotic arm. This 3D coordinate vector is compared with the normalized 7th 3D coordinate vector generated in step S17. The loss value is calculated using the L1Loss loss function, and the parameters of the servo signal generation neural network are corrected using the backpropagation algorithm. S19. Repeat steps S17 to S18 several times to further train the servo signal generation neural network.
6. The hardware adaptive robotic arm control calibration method based on neural networks as described in claim 2, characterized in that, The steps in the usage phase include: S21. Set a target object at the end of the robotic arm that can be visually detected and located by a camera. S22. Randomly generate 6 4-dimensional angle vectors, and use these 6 4-dimensional angle vectors to make the robotic arm work in sequence. Record the XYZ coordinates of the target object after the robotic arm works 6 times. Represent the XYZ coordinates of the target object as 6 3-dimensional coordinate vectors. Concatenate the 6 4-dimensional angle vectors and the 6 3-dimensional coordinate vectors to generate 6 7-dimensional vectors. S23. After concatenating the six 7-dimensional vectors generated in step S22 in sequence, add the three elements (XYZ) of the end coordinates of the robotic arm specified by the user to the end to generate a 45-dimensional vector. Normalize each element of the 45-dimensional vector and input it into the servo signal to generate a neural network to obtain a 4-dimensional angle vector. After inverse normalizing each element of the 4-dimensional angle vector, use it as the target angle of the four servos of the robotic arm. The robotic arm works according to the target angle of the four servos.
7. The hardware adaptive robotic arm control calibration method based on neural networks as described in claim 6, characterized in that, The XYZ coordinates of the target object are recorded using the camera for positioning. One camera can locate two of the XYZ coordinates of the target object. The six cameras obtain a total of four X coordinates, four Y coordinates, and four Z coordinates. The average value of each coordinate is output as the XYZ coordinates of the target object.
Citation Information
Patent Citations
Mechanical arm inverse kinematics solving method based on neural network, electronic equipment and storage medium
CN113627584A