Search

CN-122008192-A - General mechanical arm inverse kinematics solving method and system based on contrast learning

CN122008192ACN 122008192 ACN122008192 ACN 122008192ACN-122008192-A

Abstract

The invention provides a general mechanical arm inverse kinematics solving method and a general mechanical arm inverse kinematics solving system based on contrast learning, which relate to the technical field of mechanical arm kinematics and artificial intelligence, and the method comprises the steps of constructing a geometric diagram representation model of a mechanical arm; the method comprises the steps of constructing a two-stage graph neural network model, inputting training data sets into a momentum key encoder and a query encoder respectively, executing first-stage comparison training on the two-stage graph neural network model until a comparison training loss function value is smaller than a preset comparison training loss function value, inputting output vectors of the training data sets and the pre-training query encoder into the conditional graph decoder, executing second-stage decoding training on the two-stage graph neural network model until a reconstruction loss function value is smaller than a preset reconstruction loss function value, acquiring target mechanical arm structural parameters, inputting the target mechanical arm structural parameters into the trained two-stage graph neural network model, and outputting joint angles.

Inventors

  • Zou Changdi
  • DUAN JINGLIANG
  • WU JIANG
  • WANG HONGDA
  • XU HAOYUAN
  • MA FEI

Assignees

  • 北京科技大学

Dates

Publication Date
20260512
Application Date
20260112

Claims (10)

  1. 1. The utility model provides a general mechanical arm inverse kinematics solving method based on contrast learning, which is characterized by comprising the following steps: S1, acquiring mechanical arm structural parameters; S2, constructing a geometric diagram representation model of the mechanical arm based on the mechanical arm structural parameters; S3, constructing a training data set based on structural parameters of the mechanical arm with various configurations; S4, constructing a two-stage graph neural network model based on the characteristics of the geometric graph representation model, wherein the two-stage graph neural network model comprises a query encoder, a momentum key encoder and a conditional graph decoder; S5, respectively inputting the training data set into the momentum key encoder and the query encoder, and executing first-stage contrast training on the two-stage graph neural network model until the contrast training loss function value is smaller than a preset contrast training loss function value; S6, inputting the training data set and the output vector of the pre-training query encoder to the conditional graph decoder, and executing second-stage decoding training on the two-stage graph neural network model until the reconstruction loss function value is smaller than a preset reconstruction loss function value; S7, acquiring structural parameters of a target mechanical arm; s8, inputting the structural parameters of the target mechanical arm into the trained two-stage graph neural network model, and outputting joint angles.
  2. 2. The general mechanical arm inverse kinematics solution based on contrast learning according to claim 1, wherein the mechanical arm structural parameters include joint and link information; the joint and connecting rod information specifically comprises joint type, joint movement range and connecting rod geometric information.
  3. 3. The method for solving inverse kinematics of a universal manipulator based on contrast learning according to claim 1, wherein S2 specifically comprises: s201, defining joints of a mechanical arm as nodes and connecting rod connection relations as edges; S202, determining an end effector of the mechanical arm; s203, acquiring target pose data of the end effector based on the mechanical arm structure parameters; s204, converting the target pose data into a vector form through a lie algebra mapping algorithm; S205, broadcasting the converted target pose vector to all nodes; S206, fusing the converted target pose vector with the inherent feature vector of each node to form a plurality of enhanced node features; s207, combining the nodes, the edges and the reinforced node characteristics to construct a geometric diagram representation model of the mechanical arm.
  4. 4. The method for solving inverse kinematics of a universal manipulator based on contrast learning according to claim 1, wherein S3 specifically comprises: s301, acquiring joint and connecting rod information in structural parameters of mechanical arms of various configurations; S302, based on the joint movement range in the joint and connecting rod information, generating joint angle configuration by randomly sampling a joint space formed by the joint movement range; s303, performing forward kinematics calculation on the joint angle configuration, and determining the pose and the connecting rod position of the end effector; s304, encoding the joints, the connecting rod information, the joint angle configuration, the end effector pose and the connecting rod position into a geometric figure data object; And S305, constructing the training data set based on the geometric figure data object.
  5. 5. The method for solving inverse kinematics of a universal manipulator based on contrast learning according to claim 1, wherein S5 specifically comprises: S501, constructing a complete geometric figure and a partial geometric figure based on the training data set; s502, inputting the complete geometric figure into the momentum key encoder to generate a key vector; S503, inputting the partial geometric figure into the query encoder to generate a query vector; S504, determining positive sample pairs according to the key vectors and the query vectors; S505, calculating sine and cosine similarity of the positive sample pair; S506, acquiring a negative sample queue generated in the training process, wherein the negative sample queue comprises a plurality of normalized key vectors; s507, respectively calculating the sine and cosine similarity of the query vector and each normalized key vector; s508, determining InfoNCE-form contrast training loss functions based on the sine and cosine similarity and the sine and cosine similarity; S509, according to the contrast training loss function, updating the weight of the momentum key encoder through a momentum synchronization mechanism; And S510, repeating the steps S502 to S509 until the contrast training loss function value is smaller than the preset contrast training loss function value, and completing the first-stage contrast training.
  6. 6. The method for solving inverse kinematics of a universal manipulator based on contrast learning according to claim 1, wherein S6 specifically comprises: S601, freezing all parameters of the query encoder and the momentum key encoder; s602, inputting the partial geometric figures to a pre-training query encoder to obtain output vectors, wherein the output vectors are specifically conditional hidden vectors; s603, inputting the conditional hidden vector and the partial geometric figure to the conditional figure decoder, and outputting predicted joint coordinates; s604, calculating a reconstruction loss function value between the predicted joint coordinates and real joint coordinates corresponding to the predicted joint coordinates; And S605, iteratively updating parameters of the conditional graph decoder until the reconstruction loss function value is smaller than the preset reconstruction loss function value, and completing the second-stage decoding training.
  7. 7. The method for solving inverse kinematics of a universal manipulator based on contrast learning according to claim 6, wherein S604 specifically comprises: s6041, defining mask functions of anchor joints and non-anchor joints of end effectors in the mechanical arm; S6042, screening anchor joint errors and non-anchor joint errors based on the mask function and combining the mean square error of the predicted joint coordinates and the real joint coordinates; and S6043, weighting the anchor joint error and the non-anchor joint error, and determining the reconstruction loss function value.
  8. 8. The method for solving inverse kinematics of a universal manipulator based on contrast learning according to claim 1, wherein the step S8 specifically comprises: s801, constructing a target part geometric figure based on the target mechanical arm structural parameters and the corresponding target pose data of the end effector; s802, inputting the target part geometric figure into a trained query encoder, and outputting a target condition hidden vector; S803, randomly perturbing the target condition hidden vector for a plurality of times based on a preset scale parameter to generate a plurality of differential condition hidden vectors; s804, pairing the target part geometric figures with the differential condition hidden vectors respectively to obtain a plurality of groups of decoding input pairs; S805, sequentially inputting each decoding input pair into a trained condition diagram decoder to obtain a plurality of joint coordinate prediction results; S806, converting all joint coordinate prediction results into physically feasible joint angles, and outputting the joint angles.
  9. 9. A general mechanical arm inverse kinematics solving system based on contrast learning is characterized by comprising: A processor; A memory having stored thereon computer readable instructions that, when executed by the processor, implement the contrast learning based universal robotic inverse kinematics solution as claimed in any one of claims 1 to 8.
  10. 10. A readable storage medium, wherein a program or instructions is stored on the readable storage medium, which when executed by a processor, implements the steps of the contrast learning based general purpose mechanical arm inverse kinematics solution method according to any of claims 1 to 8.

Description

General mechanical arm inverse kinematics solving method and system based on contrast learning Technical Field The invention relates to the technical field of mechanical arm kinematics and artificial intelligence, in particular to a general mechanical arm inverse kinematics solving method and system based on contrast learning. Background The inverse kinematics solution is a core problem of mechanical arm motion planning and control, and aims to solve corresponding angles of joints of the mechanical arm according to target pose of an end effector. With the development of industrial production and intelligent control, mechanical arms with different degrees of freedom and different topological structures are widely applied, and higher requirements are put forward on the universality and suitability of an inverse kinematics solving method, so that an efficient solving scheme capable of adapting to mechanical arms with various configurations is needed. In the prior art, the inverse kinematics solving method mainly comprises an analysis method, a numerical method, an intelligent optimization algorithm and a neural network method. The analysis method has higher solving precision, the numerical method has stronger universality, the intelligent optimization algorithm realizes joint angle combination solving through iterative optimization, the neural network becomes a main stream research direction in recent years by virtue of strong nonlinear mapping capability, paired data are generated through a forward kinematic model to train, and diversified technical support is provided for precise control of the mechanical arm. However, there is still a limitation in the prior art, such as the model is often designed for a single-configuration mechanical arm, and the generalization capability is insufficient. The solving process is mostly dependent on the label data of the specific mechanical arm, and the data preparation cost is high. Part of methods are difficult to naturally generate a plurality of groups of feasible solutions, and complex scene requirements are difficult to meet. Disclosure of Invention In order to solve the technical problems that a model is often designed aiming at a single-configuration mechanical arm, generalization capability is insufficient, a solving process depends on label data of a specific mechanical arm, data preparation cost is high, a plurality of groups of feasible solutions are difficult to naturally generate by a part of methods, and complex scene requirements are difficult to meet, the invention provides a general mechanical arm inverse kinematics solving method and a general mechanical arm inverse kinematics solving system based on contrast learning. The technical scheme provided by the embodiment of the invention is as follows: The general mechanical arm inverse kinematics solving method based on contrast learning provided by the first aspect of the embodiment of the invention comprises the following steps: S1, acquiring mechanical arm structural parameters; S2, constructing a geometric diagram representation model of the mechanical arm based on mechanical arm structural parameters; S3, constructing a training data set based on structural parameters of the mechanical arm with various configurations; S4, constructing a two-stage graph neural network model based on the characteristics of the geometric graph representation model, wherein the two-stage graph neural network model comprises a query encoder, a momentum key encoder and a conditional graph decoder; s5, respectively inputting a training data set into a momentum key encoder and a query encoder, and executing first-stage contrast training on the two-stage graph neural network model until a contrast training loss function value is smaller than a preset contrast training loss function value; S6, inputting the training data set and the output vector of the pre-training query encoder to a conditional graph decoder, and executing second-stage decoding training on the two-stage graph neural network model until the reconstruction loss function value is smaller than a preset reconstruction loss function value; S7, acquiring structural parameters of a target mechanical arm; s8, inputting the structural parameters of the target mechanical arm into the trained two-stage graph neural network model, and outputting the joint angles. The second aspect of the embodiment of the invention provides a general mechanical arm inverse kinematics solving system based on contrast learning, which comprises: A processor; And a memory having stored thereon computer readable instructions which, when executed by the processor, implement the contrast learning based general purpose mechanical arm inverse kinematics solution method according to the first aspect. A third aspect of the embodiments of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method f