A robot cable operation method, device and storage medium based on large model
By training large models in a virtual environment and using RGB cameras to sense key point states, the gap between virtual and reality is corrected, precise control of real cables is achieved, and the problem of inability to effectively fit cable kinematics in the existing technology is solved. problem, improving the robot's ability to operate deformable linear objects.
Patent Information
- Application Number
- CN202310622993.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-30
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2043-05-30
AI Technical Summary
It is difficult for the existing technology to effectively fit the kinematic laws of cables, resulting in the inability to accurately capture the kinematic laws of real cables through simulated training data in a virtual environment, and to achieve precise control of real cables.
Using a large-model-based robot cable operation method, we create scenes in a virtual environment, generate kinematic data, train a model with very large parameters, and use RGB cameras to sense the status of key points, build a neural network model for online learning, and correct virtual and The gap between reality, get optimized control inputs for precise control of real cables.
It achieves precise deformation control of real cables, narrows the gap between virtual and real, and improves the robot's ability to operate deformable linear objects.
Smart Images

Figure CN116587276B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of robot control technology, and in particular to a robot cable operation method, device and storage medium based on a large model. Background Art
[0002] Manipulating deformable linear objects, especially various cables, has a wide range of applications. For example, wires are manipulated to assemble devices in 3C manufacturing; belts are manipulated in the assembly of belt-driven units; and sutures are manipulated to hold tissues together in surgery. In order to automatically complete the above tasks, robustly manipulating deformable linear objects such as cables into the desired shape remains a key issue in robotics. However, since cables have infinite dimensions, it is challenging to obtain accurate dynamic models for precise planning and control. Therefore, it is urgent to build a robot that can perform deformation operations on cables, which will greatly improve the automation efficiency in these fields.
[0003] For the cable modeling problem, the mass-spring system (MSS) is currently used to model deformable objects as networks. Mass is assigned to each individual vertex, and the vertices are connected by spring edges. The internal force between a pair of vertices can be determined by the spring-damping relationship along the displacement direction. The mass-spring model is simple to implement and has a fast simulation speed. It has been applied to different types of deformable objects, for example, by simulating ropes as chains as two-dimensional (2D) grids. The disadvantage is that it is best suited to simulate small deformations, but the accuracy will drop significantly when facing complex deformations. Learning-based methods are also popular methods that approximate the dynamic model of the cable from the collected data set. For example, bidirectional LSTM is used to model chain-like objects and collect a large amount of data to train the LSTM model. Similarly, graph neural networks have emerged as a new structure for learning the dynamics of deformable objects. However, due to the limited number of parameters, current learning methods are still unable to effectively fit the kinematic laws of cables.
[0004] Fitting the cable kinematic model through a neural network often requires collecting a large amount of cable kinematic data in a virtual environment and training the model. However, due to the gap between simulation and reality, the simulated training data may not accurately capture the kinematic laws of the real cable. Currently, domain randomization is used to increase the randomness of training data, but it still cannot solve the gap between virtual cables and real cables. Summary of the invention
[0005] The purpose of the present invention is to provide a robot cable operation method, device and storage medium based on a large model, to learn the cable kinematics based on the large model, to effectively fit the cable kinematics, and to use a correction network to bridge the gap between virtual and reality, so that a real robot can accurately operate a real cable and improve the robot's ability to operate deformable linear objects.
[0006] The purpose of the present invention can be achieved by the following technical solutions:
[0007] A robot cable operation method based on a large model comprises the following steps:
[0008] S1: creating a scene in a virtual environment, wherein the scene includes a cable and a rotatable two-finger robot gripper, and generating kinematic data of various cables on a two-dimensional plane by moving both ends of the cable;
[0009] S2: In the offline stage, the large model is fine-tuned using the generated kinematic data to train a cable kinematic model based on a model with a very large number of parameters;
[0010] S3: Mark multiple key points on the real cable, and use RGB camera to perceive the key point status based on Kalman filtering;
[0011] S4: Based on the key point states, a neural network model is constructed and online learning is performed to obtain a correction function of the cable kinematic model;
[0012] S5: Solving the optimized control input based on the modified cable kinematic model, the real robot controls the real cable according to the optimized control input, and deforms the real cable into the target shape.
[0013] Furthermore, the kinematic data includes the acceleration a of the end of the manipulator at time t. k (t)∈R 1x2 ,Location speed Where k = 1 represents the left end, k = 2 represents the right end, and the position of the n key points at time t is X(t) = [x1(t), x2(t), .., x n (t)] T , the speed of n key points at time t where x i (t)∈R 1x2 represents the 2D position of the i-th key point at time t, Represents the velocity of the i-th key point at time t.
[0014] Further, the S2 comprises the following steps:
[0015] S21: Build a large model, the initial parameters of which are obtained by pre-training with a large amount of text data;
[0016] S22: constructing an input vector based on the kinematic data, wherein the input vector includes the speed and position of n key points, the terminal speed, position and acceleration, and the position encoding;
[0017] S23: Input the input vector to the multi-head attention layer with mask in the large model;
[0018] S24: After adding the output vector of the multi-head attention layer to the input vector to implement the residual operation, the layer normalization operation is performed;
[0019] S25: input the vector output by S24 into the feedforward network, add the vector output by the feedforward network to the vector output by S24, and then perform normalization again;
[0020] S26: Repeat S23-S25 for a preset number of times to extract features, input the extracted features into the fully connected layer and softmax layer of the large model, output a feature vector with a dimension of 2n, calculate the loss, perform back propagation and update the gradient until all kinematic data training is completed, and obtain the cable kinematic model based on the large model, recorded as .
[0021] Furthermore, each attention head in the multi-head attention layer performs the following steps:
[0022] Each kinematic data is passed through three matrices W q ,W k ,W v Perform a linear change, divide it into three, and generate three vectors corresponding to each kinematic data: query, key, and value. When performing self-attention operation with one kinematic data as the center, do a dot product with the key vector of this kinematic data and the query vector of each kinematic data, and then normalize the weights through softmax. Calculate the weighted sum of the vectors of all kinematic data based on the weights as the output of this kinematic data.
[0023] After each attention head completes the above steps, the output of each attention head is combined together as the output of the multi-head attention layer.
[0024] Furthermore, in S26, S23-S25 are repeated 12 times to perform feature extraction.
[0025] Furthermore, the use of the RGB camera to perceive the key point state is specifically: using the RGB camera to perceive the n key point states at time t, including the position Y(t) = [y1(t), y2(t), .., y n (t)]T and speed where y i (t)∈R 1x2 represents the 2D position of the i-th key point at time t, Represents the velocity of the i-th key point at time t.
[0026] Further, the S4 comprises the following steps:
[0027] S41: In the virtual environment and the real environment, the same control input is input to the cable kinematic model trained in S3 and the real cable, respectively, to obtain the output speed of the cable kinematic model and the real cable speed V(t)=[v1(t),v2(t),..,v n (t)] T ,in represents the model prediction speed of the i-th key point at time t, v i (t)∈R 1x2 Represent the true cable speed of the i-th key point at time t and collect a small amount of training data;
[0028] S42: Construct a neural network based on a fully connected layer to As input data, V(t) as supervision data, and output a vector of dimension 2n, the neural network is trained to obtain the modified network of the cable kinematic model, that is, Used to bridge the gap between simulation and reality.
[0029] Further, the S5 comprises the following steps:
[0030] S51: Order is the target position of the key point, G t is the target position of the key point at time t, is the control input, T is the time span;
[0031] S52: Perform forward simulation by taking the state and control input at time t as input, and use the modified cable kinematic model to generate a new position at the next time, that is,
[0032] S53: The forward simulation starting at time t is expressed as The history up to time t is expressed as Calculate the difference between the predicted final position and the actual set target final position, that is, And perform back propagation to find the gradient, and use the stochastic gradient descent algorithm to update the control input;
[0033] S54: Repeat S52-S53 to obtain the optimized control input u 1: ;
[0034] S55: The real robot controls the real cable according to the optimized control input, and deforms the real cable into a target shape.
[0035] A robot cable operating device based on a large model comprises a memory, a processor, and a program stored in the memory, wherein the processor implements the method described above when executing the program.
[0036] A storage medium stores a program, which implements the method described above when executed.
[0037] Compared with the prior art, the present invention has the following beneficial effects:
[0038] The robot cable operation method based on a large model of the present invention models the cable motion through a neural network with a large number of parameters, and the obtained model can be used for precise deformation control of the cable. Since the training data is obtained in a virtual environment, there is a gap with the real cable motion. The model correction network constructed by the present invention can effectively narrow the gap between virtual and real, making the model effective in real cable operation, and realizing the precise deformation control of real cables by real robots. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 is a flow chart of the method of the present invention;
[0040] Figure 2 This is a diagram of the GPT network architecture described in an embodiment of the present invention;
[0041] Figure 3 This is a diagram of a modified network architecture for virtual-real migration according to an embodiment of the present invention;
[0042] Figure 4 This is a hardware architecture diagram of the large model-based robot cable operation method described in an embodiment of the present invention. DETAILED DESCRIPTION
[0043] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.
[0044] This embodiment provides a robot cable operation method based on a large model, such as Figure 1 As shown, the following steps are included:
[0045] S1: Use Unity software to create a scene in a virtual environment. The scene includes cables based on the Obi physics engine and a rotatable two-finger robot gripper. By moving both ends of the cables, kinematic data of various cables on a two-dimensional plane are generated.
[0046] In this embodiment, the kinematic data collected include the acceleration a of the end of the robot arm at time t k (t)∈R 1x2 ,Location speed Where k = 1 represents the left end, k = 2 represents the right end, and the position of the n key points at time t is X(t) = [x1(t), x2(t), .., x n (t)] T , the speed of n key points at time t where x i (t)∈R 1x2 represents the 2D position of the i-th key point at time t, Represents the velocity of the i-th key point at time t.
[0047] The kinematic data of the cables collected are based on 10 different lengths and thicknesses to achieve domain randomization. The cable length and thickness settings are shown in Table 1.
[0048] Table 1 Settings for 10 cables of different lengths and thicknesses
[0049] Cable number Length(m) Diameter(mm) 1 0.3 16 2 0.4 6 3 0.5 18 4 0.6 8 5 0.7 20 6 0.8 10 7 0.9 22 8 1.0 12 9 1.1 24 10 1.2 14
[0050] S2: In the offline stage, the generated kinematic data is used to fine-tune the large model, and the cable kinematic model based on the model with a very large number of parameters is trained.
[0051] S21: Construct a large model based on the GPT neural network. The large model is a pre-trained model whose initial parameters are obtained by pre-training a large amount of text data. In this embodiment, the GPT network framework of the large model is as follows: Figure 2 shown.
[0052] S22: Construct an input vector based on the kinematic data. In this embodiment, the input vector includes the speed and position of 15 key points, 2 terminal speeds, positions and accelerations, and position encoding, thereby obtaining an input vector with a dimension of 80.
[0053] S23: Input the input vector to the multi-head attention layer with mask in the large model. Each attention head performs the following steps:
[0054] Each kinematic data is passed through three matrices W q ,W k ,W vPerform a linear change and divide it into three to generate three vectors of query, key, and value corresponding to each kinematic data; when performing self-attention operation with one kinematic data as the center, do a dot product with the key vector key of this kinematic data and the query vector query of each kinematic data, and then normalize the weights through softmax, and calculate the weighted sum of the vectors of all kinematic data based on the weights as the output of this kinematic data.
[0055] After each attention head completes the above steps, the output of each attention head is combined together as the output of the multi-head attention layer.
[0056] S24: After adding the output vector of the multi-head attention layer to the input vector to implement the residual operation, the layer normalization operation is performed.
[0057] S25: Input the vector output by S24 into the feedforward network, and add the vector output by the feedforward network to the vector output by S24 to achieve a residual operation, and then perform a layer normalization operation.
[0058] S26: Repeat S23-S25 12 times to extract features, input the extracted features into the fully connected layer and softmax layer of the large model, output a feature vector with a dimension of 30, calculate the loss, perform back propagation and update the gradient until all 5000 sets of kinematic data in this embodiment are trained, and obtain the cable kinematic model based on the large model, which is recorded as .
[0059] S3: On the real cable, 15 key points are marked, and based on Kalman filtering, an RGB camera is used to perceive the status of the 15 key points at time t.
[0060] In this embodiment, the RGB camera senses the states of 15 key points at time t, including the position Y(t)=[y1(t),y1(t),..,y 15 (t)] T and speed where y i (t)∈R 1x2 represents the 2D position of the i-th key point at time t, Represents the velocity of the i-th key point at time t.
[0061] S4: Based on the key point states, a neural network model is constructed and online learning is performed as a correction function for the cable kinematic model to overcome the gap between simulation and reality and the generalization problem.
[0062] S41: In the virtual environment and the real environment, the same control input is input to the cable kinematic model trained in S3 and the real cable, respectively, to obtain the output speed of the cable kinematic model and the real cable speed V(t)=[v1(t),v2(t),..,v 15 (t)] T ,in represents the model prediction speed of the i-th key point at time t, v i (t)∈R 1x2 Represent the true cable speed of the ith key point at time t and collect a small amount of training data.
[0063] S42: Construct a neural network based on a fully connected layer to As input data, V(t) as supervision data, and outputting a vector of dimension 30, the neural network is trained using 1000 sets of data to obtain the modified network of the cable kinematic model, namely, Used to bridge the gap between simulation and reality.
[0064] In this embodiment, Figure 3 As shown in the figure, the neural network consists of 3 fully connected layers, where the first layer has an input dimension of 30 and an output dimension of 256, the second layer has an input dimension of 256 and an output dimension of 512, and the third layer has an input dimension of 512 and an output dimension of 30.
[0065] S5: Solving the optimized control input based on the modified cable kinematic model, the real robot controls the real cable according to the optimized control input, and deforms the real cable into the target shape.
[0066] S51: Order is the target position of the key point, G t is the target position of the key point at time t, is the control input, T is the time span, and T takes 100 moments.
[0067] S52: Perform forward simulation by taking the state and control input at time t as input, and use the modified cable kinematic model to generate a new position at the next time, that is,
[0068] S53: The forward simulation starting at time t is expressed as The history up to time t is expressed as Calculate the difference between the predicted final position and the actual set target final position, that is, And perform back propagation to find the gradient, and use the stochastic gradient descent algorithm to update the control input.
[0069] S54: Repeat S52-S53 to obtain the optimized control input u 1: .
[0070] S55: The real robot controls the real cable according to the optimized control input, and deforms the real cable into a target shape.
[0071] The hardware architecture system of an embodiment of the invention is as follows Figure 4 As shown, the cable operation process can be implemented in the actual physical environment by combining with the robot operation platform, which has good task performance and broad application prospects.
[0072] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program code.
[0073] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning, or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.
Claims
1. A robot cable operation method based on a large model, characterized in that: The following steps are involved: S1: creating a scene in a virtual environment, wherein the scene includes a cable and a rotatable two-finger robot gripper, and generating kinematic data of various cables on a two-dimensional plane by moving both ends of the cable; S2: In the offline stage, the large model is fine-tuned using the generated kinematic data to train a cable kinematic model based on a model with a very large number of parameters; S3: Mark multiple key points on the real cable, and use RGB camera to perceive the key point status based on Kalman filtering; S4: Based on the key point states, a neural network model is constructed and online learning is performed to obtain a correction function of the cable kinematic model; S5: Solving the optimized control input based on the modified cable kinematic model, the real robot controls the real cable according to the optimized control input, and deforms the real cable into the target shape; The S2 comprises the following steps: S21: Build a large model, the initial parameters of which are obtained by pre-training text data; S22: constructing an input vector based on the kinematic data, wherein the input vector includes the speed and position of n key points, the terminal speed, position and acceleration, and the position encoding; S23: Input the input vector to the multi-head attention layer with mask in the large model; S24: After adding the output vector of the multi-head attention layer to the input vector to implement the residual operation, the layer normalization operation is performed; S25: input the vector output by S24 into the feedforward network, add the vector output by the feedforward network and the vector output by S24, and then perform normalization again; S26: Repeat S23-S25 for a preset number of times to extract features, input the extracted features into the fully connected layer and softmax layer of the large model, output a feature vector with a dimension of 2n, calculate the loss, perform back propagation and update the gradient until all kinematic data training is completed, and obtain the cable kinematic model based on the large model, recorded as ; Each attention head in the multi-head attention layer performs the following steps: Each kinematic data is passed through three matrices W q ,W k ,W v Perform a linear change, divide it into three, and generate three vectors corresponding to each kinematic data: query, key, and value. When performing self-attention operation with one kinematic data as the center, do a dot product with the key vector of this kinematic data and the query vector of each kinematic data, and then normalize the weights through softmax. Calculate the weighted sum of the vectors of all kinematic data based on the weights as the output of this kinematic data. After each attention head completes the above steps, the output of each attention head is combined together as the output of the multi-head attention layer.
2. A robot cable operation method based on a large model according to claim 1, characterized in that: The kinematic data includes the acceleration a of the end of the robot arm at time t k (t)∈R 1x2 ,Location speed Where k = 1 represents the left end, k = 2 represents the right end, and the position of the n key points at time t is X(t) = [x1(t), x2(t), .., x n (t)] T , the speed of n key points at time t where x i (t)∈R 1x2 represents the 2D position of the i-th key point at time t, Represents the velocity of the i-th key point at time t.
3. The robot cable operation method based on a large model according to claim 1, characterized in that: In S26, S23-S25 are repeated 12 times to perform feature extraction.
4. The robot cable operation method based on a large model according to claim 1, characterized in that: The method of using the RGB camera to perceive the key point state is specifically: using the RGB camera to perceive the n key point states at time t, including the position Y(t) = [y1(t), y2(t), .., y n (t)] T and speed where y i (t)∈R 1x2 represents the 2D position of the i-th key point at time t, Represents the velocity of the i-th key point at time t.
5. The robot cable operation method based on a large model according to claim 1, characterized in that: The S4 comprises the following steps: S41: In the virtual environment and the real environment, the same control input is input to the cable kinematic model trained in S3 and the real cable, respectively, to obtain the output speed of the cable kinematic model and the real cable speed V(t)=[v1(t),v2(t),..,v n (t)] T ,in represents the model prediction speed of the i-th key point at time t, v i (t)∈R 1x2 Represent the true cable speed of the i-th key point at time t and collect a small amount of training data; S42: Construct a neural network based on a fully connected layer to As input data, V(t) as supervision data, and output a vector of dimension 2n, the neural network is trained to obtain the modified network of the cable kinematic model, that is, Used to bridge the gap between simulation and reality.
6. A robot cable operation method based on a large model according to claim 5, characterized in that: The S5 comprises the following steps: S51: Order is the target position of the key point, G t is the target position of the key point at time t, is the control input, T is the time span; S52: Perform forward simulation by taking the state and control input at time t as input, and use the modified cable kinematic model to generate a new position at the next time, that is, S53: The forward simulation starting at time t is expressed as The history up to time t is expressed as Calculate the difference between the predicted final position and the actual target final position, that is, And perform back propagation to find the gradient, and use the stochastic gradient descent algorithm to update the control input; S54: Repeat S52-S53 to obtain the optimized control input u 1:T ; S55: The real robot controls the real cable according to the optimized control input, and deforms the real cable into a target shape.
7. A robot cable manipulation device based on a large model, comprising a memory, a processor, and a program stored in the memory, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
8. A storage medium having a program stored thereon, characterized in that: When the program is executed, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Mobile cable modeling and motion simulation method and device based on physical characteristics
CN101727523A
Robot System And Control Method
CN111618844A
Robot cable shape control method and device based on graph neural network
CN114943182A
Flexible cable state prediction and control system based on hidden space interpolation
CN115990875A
Control device, robot, and robot system
US20170246745A1
