Method for dynamic simulation and control of welding robot based on digital twin technology
The welding robot model is constructed through digital twin technology, which solves the problems of multi-dimensional feature attention and data transmission identification in the welding field, realizes dynamic simulation and control of welding robots, improves welding efficiency and quality, and reduces operational risks.
Patent Information
- Application Number
- CN202411330438.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2044-09-24
AI Technical Summary
The prior art lacks attention to multi-dimensional welding characteristics in the welding field, making it difficult to realize real-time simulated weld molding and prediction of different welding workpiece parameters, and there are problems of data transmission and identification of fault prediction and virtual and real mapping of welding robots.
Using digital twin technology to build a welding robot model, establish a 1:1 actual factory equipment model through SolidWorks, import Unity3D for unified coordinate system setting, combine it with ADS communication protocol to achieve digital transformation, and obtain PLC data through scripts to identify the centerline of the welding workpiece and Simulate the weld forming process.
Dynamic simulation and control of welding robots is realized, welding efficiency and quality is improved, practical operation risks are reduced, welding accuracy and safety is enhanced, and process parameters are optimized.
Smart Images

Figure CN118848169B_ABST
Abstract
Description
Technical Field
[0001] The present invention provides a method for realizing dynamic simulation and control of a welding robot based on digital twin technology, and belongs to the technical field of welding. Background Art
[0002] In the field of welding, the real-time, fidelity, visualization and virtual-to-real mapping characteristics of digital twin systems have attracted much attention. The existing three-dimensional dynamic demonstration model lacks multi-dimensional welding characteristics. At present, the existing technology has real-time simulation of weld formation and prediction of different welding workpiece parameters, which can achieve all-round monitoring of the weld formation process and easily find suitable process parameters for non-welding researchers, so as to improve welding efficiency and quality. In addition, the basic architecture of industrial robot fault prediction has been designed, and the physical model of industrial robot with virtual-to-real mapping has been constructed using digital twin technology, realizing real-time prediction of faults. Four Kuka robots are used as research objects, aiming to use digital twin technology to improve the efficiency and accuracy of robots and achieve virtual-to-real mapping. The digital twin of the welding robot is constructed according to the needs and system of the welding robot, and the ADS communication protocol is integrated to realize the digital transformation mode. The final effect is to improve the work efficiency and accuracy of the Kuka robot, reduce the error rate in the production process, and thus improve the overall operation efficiency of the production line. How to obtain the data of four robots in this process, and how to transmit the data of four Siemens PLCs to a Beckhoff PLC for management? The following text description needs to be added to the implementation of this method: "The underlying data of the four Kuka robots adopts the profinet communication protocol, which is based on Ethernet technology and aims to provide high-performance, real-time and reliable communication solutions. It is used for communication between control systems, sensors and actuators, and realizes the interconnection between welding automation equipment. It is then converted into JS format through serial connection and transmitted to Beckhoff PLC for unified management. The server collects data from twincat software through the ADS communication protocol, analyzes and calculates, thereby controlling the mutual mapping of the welding robot twin and the physical entity robot." How to solve the problem of updating the position and rotation of objects in Unity according to the read data, and making smooth transitions to avoid jumps? How to identify the center line of the groove of different workpieces? How to simulate the algorithm analysis of the fill weld? The above difficult problems need to be solved. Summary of the invention
[0003] The present invention uses four KUKA robots as physical entities to construct a digital twin. The six-axis angle, welding current, welding voltage, wire feeding speed, and wire filling speed data of the four robots are collected respectively. The problem that needs to be overcome in this process is how to construct the joint motion between the six axes, and how to obtain the data of the four robots and transmit it to the server. Secondly, how to automatically identify the weld center lines of different welding workpieces in the digital twin system, and feed back the results to the staff for timely adjustment. Finally, according to the weld formation in the real scene, how to realize the simulation of the weld forming process of the twin system. Allowing staff to perform simulation operations in a virtual environment can reduce the risks in the actual operation process and improve the overall welding efficiency and quality.
[0004] The present invention proposes a method for realizing dynamic simulation and control of a welding robot based on digital twin technology. First, a 1:1 actual factory equipment model is established using SolidWorks; secondly, the model is imported into Unity3D to establish a unified coordinate system, and the coordinated motion of each joint of the welding robot is simulated, and the digital transformation is realized in combination with the ADS communication protocol. Then, the center line of the weld is identified according to different workpieces, the positional relationship between the welding gun and the center line is dynamically adjusted, and timely feedback is given to the staff for adjustment. Finally, the welding process is simulated in real time through simulation software, so that the staff can achieve higher accuracy and safety in the welding operation, and perform optimization analysis of the process parameters. The present invention enables the staff to perform simulation operations in a virtual environment, thereby reducing the risks in the actual operation process and improving the overall welding efficiency and quality.
[0005] The specific technical solution is:
[0006] A method for realizing dynamic simulation and control of a welding robot based on digital twin technology includes the following steps:
[0007] S1. Hardware selection;
[0008] MAG welding robot workstation 1: KR1608HW welding robot, Ariston350 welding power source, WF12-50P wire feeding mechanism, 350A welding gun, 1.5x0.8x0.8 workbench
[0009] MAG welding robot workstation 2: KR1608HW welding robot, Ariston350 welding power source, WF12-50P wire feeding mechanism, 350A welding gun, L-50 L-type positioner
[0010] TIG welding robot workstation 1: KR1608HW welding robot, TETRIX352 welding power source, WF12-50P wire feeding mechanism, 300A welding gun, L-50 L-type positioner, WF-100 wire feeding mechanism
[0011] TIG welding robot workstation 2: KR1608HW welding robot, TETRIX551 welding power source, WF12-50P wire feeding mechanism, 300A welding gun, 1.5x0.8x0.8 workbench, WF-100 wire feeding mechanism
[0012] S2, modeling;
[0013] Based on the above hardware, 3D design software such as CATIA, UG, SolidWorks, etc. can be selected for 1:1 modeling or modeling through 3D scanning. This method uses SolidWorks professional 3D design software, which has unit precision settings, sketch tools, dimensioning, and inspection tools, making it an ideal choice for engineers who need high precision and reliability. However, the rendering effect of such software is poor, and it is impossible to obtain data from hardware and drive the movement of digital models. Unity3D is a cross-platform game engine that can be used to create interactive content such as video games, architectural visualization, and real-time 3D animation. It has good platform portability and human-computer interactivity, and its built-in physics engine can be used to simulate actual physical phenomena.
[0014] Digital model conversion: Unity3D software recognizes the .FBX file format, but files created by general mechanical drawing software cannot be accepted by Unity3D software. Therefore, the files created by the mechanical design software need to be converted into the file format recognized by Unity3D through 3DMAX software and finally imported into the Unity3D development environment.
[0015] Adjust the model to the center coordinates of Unity:
[0016] 1) Drag the .Fbx file into Unity's project panel and drag the model into the scene.
[0017] 2) Right-click the model in the Hierarchy panel, select Prefab, and click Unpack.
[0018] 3) Select all assembly parts, find the Reset button in Transform in the Inspector panel, and click it to center the model in Unity coordinates.
[0019] S3, joint definition;
[0020] In Unity3D, in order to define the 6 joints of the physical entity welding robot model, create six objects named joint_1 to joint_6 and arrange them in order. In the "Transform" component of each object, place the latter object as a child object in the "Child" field of the previous object. For example, the parent of joint 1 (joint_1) is Base and the child is a1; the parent of joint 2 (joint_2) is a1 and the child is a2, and so on, to establish the joint parent-child relationship from the base base to the end effector a6. When moving joint_1, the other joints will follow the movement accordingly, simulating the movement of the physical entity model.
[0021] S4, collect data;
[0022] In Unity3D, the data transmitted from the PLC is obtained through the script file, using the ADS communication protocol. ADS (Automation Device Specification) is an automation device specification that provides routing for communication between devices. ADS communication is a special protocol defined by Beckhoff for non-periodic communication in the TwinCAT system. It can be used for internal communication within the controller, communication between controllers, and communication between controllers and PC high-level languages. Define the communication IP address and port number, and create a handle.
[0023] adsClient = new TcAdsClient();
[0024] adsClient.Connect("xxx.xxx.xxx.xxx.1.1", 851);
[0025] structHandle = adsClient.CreateVariableHandle("MAIN.All_1");
[0026] The physical robot joint data is extracted from the data structure in the communication protocol.
[0027] myStruct = (MyStruct)adsClient.ReadAny(structHandle, typeof(MyStruct));
[0028] float[] actPosArray = myStruct.result;
[0029] robotAxisAngles[i, j] = actPosArray [i * axisCount + j];
[0030] S5, drive model design;
[0031] First, obtain the joint number and axis direction of the physical entity. The system uses relative positioning technology, which requires calculating the angle difference between the current frame and the previous frame, and then applying it to the digital model. The system's data refresh frame rate is 60, so if the object's angle value continues to change, the digital model will be synchronized in real time, presenting a smooth dynamic effect.
[0032] GameObject robot = GameObject.Find($"Robot{i + 1}");
[0033] Transform axis = robotAxis[i * axisCount + j];
[0034] Vector3 rotationAxis = Vector3.zero;
[0035] if (j == 0)
[0036] rotationAxis = Vector3.forward;
[0037] float currentAngle = robotAxisAngles[i, j];
[0038] float deltaAngle = currentAngle - lastRobotAxisAngles[i, j];
[0039] lastRobotAxisAngles[i, j] = currentAngle;
[0040] axis.Rotate(rotationAxis, deltaAngle);
[0041] S6. Visual management design;
[0042] Create an interface in Unity3D to display the real-time values of six-axis angle, positioner angle, welding voltage, welding current, welding speed and wire feeding speed, and allow the large screen design principle to update the data at any time:
[0043] 1) Create UI Canvas:
[0044] Right-click in the Hierarchy panel and select UI -> Canvas to create a UI Canvas object. Create Text UI elements under the Canvas. Each Text is used to display the value of a parameter. Adjust the position, size, color and other properties of the Text to make the interface layout clearer.
[0045] 2) Create a script to obtain data:
[0046] Write a script to get the data and use GetComponent <text>() method to obtain a reference to the UI element. In the script, update the obtained data to the corresponding Text UI element to ensure that the parameter value is displayed in real time.
[0047] 3) Scripts are attached to UI elements and operate the interface:
[0048] Find each Text UI element and drag it to the corresponding variable reference in the script to ensure that the data is updated correctly. Through the custom Unity script, realize the mouse control camera movement function: left button to rotate, middle button to zoom, right button to move.
[0049] S7, identify the center line of the V-groove;
[0050] 1) Get the center point and scaling value of the V-groove.
[0051] Vector3 center = object02.position; Vector3 scale =object02.lossyScale;
[0052] 2) Calculate the vertex of the V-groove: get the vertex by adding or subtracting half of the scaling value from the center point.
[0053] Vector3 bottomVertex = center - object02.TransformDirection(Vector3.up * scale.y / 2);
[0054] Vector3 topVertex = center + object02.TransformDirection(Vector3.up *scale.y / 2);
[0055] 3) Calculate the start and end points of the center line: Draw the center line by extending a small distance outward from each vertex.
[0056] Vector3startPoint = bottomVertex - object02.TransformDirection(Vector3.up * extensionLength);
[0057] Vector3 endPoint = topVertex + object02.TransformDirection(Vector3.up* extensionLength);
[0058] 4) Calculate the relationship between the welding gun and the center line.
[0059] Get the vector from the welding gun to the starting point of the center line Vector3 centerToPoint = object03.position- startPoint;
[0060] Calculate the projection of the welding gun in the center line direction Vector3 projectionOnLine = Vector3.Project(centerToPoint, lineDirection);
[0061] Get the projection point Vector3 projectedPoint = startPoint + projectionOnLine;
[0062] Calculate the deviation vector Vector3 deviationVector = object03.position -projectedPoint;
[0063] Determine whether the point is on the center line based on the tolerance value. If it is within the tolerance range, output a message, otherwise output a message about the direction and magnitude of the deviation.
[0064] S8, simulation of weld forming process;
[0065] 1) Set the scene.
[0066] Create a weld filler material prefab
[0067] According to the model of workpiece and filler material in SolidWorks, simulate the weld filler material as a prefab and name it WeldFillMaterialPrefab.
[0068] 2) Filling weld process.
[0069] Initialize the fill material and initialize an array fillMaterials in the Start function with a size of fillCount.
[0070] Use a for loop to iterate over the array and instantiate the fill material prefab at the starting position, storing it in the array.
[0071] void Start()
[0072] {
[0073] fillMaterials = new GameObject[fillCount];
[0074] for (int i = 0; i < fillCount; i++)
[0075] {
[0076] fillMaterials[i] = Instantiate(weldFillMaterialPrefab,startPoint.position, Quaternion.identity);
[0077] }
[0078] }
[0079] Calculate the direction and step size In the Update function, calculate the direction vector from the start point to the end point and normalize it.
[0080] Vector3 direction = (endPoint.position - startPoint.position).normalized;
[0081] Set the fill material position and orientation:
[0082] Use a for loop to iterate over each filling material, calculating the step size based on the filling amount.
[0083] Use the Vector3.Lerp function to linearly interpolate the position of each fill material between the start and end points.
[0084] Set each fill material to always face in the Vector3.up direction.
[0085] for (int i = 0; i < fillCount; i++)
[0086] {
[0087] float step = (1.0f / fillCount) * i;
[0088] fillMaterials[i].transform.position = Vector3.Lerp(startPoint.position, endPoint.position, step);
[0089] fillMaterials[i].transform.rotation = Quaternion.LookRotation(Vector3.up);
[0090] }
[0091] The present invention realizes the digital twin of the welding robot system through multiple scripts, which enables the robot and the positioner to move in coordination, identify the center of the welding workpiece and simulate the weld formation. Specifically, it includes functions such as real-time data interaction between the robot and PLC, V-groove positioning and centerline identification, and weld filling simulation; specifically:
[0092] 1. Implementation of digital twin of welding robot: Use TwinCAT ADS library to communicate with PLC, read the welding robot axis angle data in PLC in real time, and apply it to the Unity scene to realize real-time simulation of robot status. The robot in the scene updates the angle of each axis through the read data to achieve the simulation effect synchronized with the actual welding robot. Real-time: Through real-time data interaction with PLC through ADS library, the status of welding robot in Unity can be synchronized with the actual equipment in real time, so as to achieve highly realistic simulation effect. High precision: Through accurate angle and position calculation, the simulation system can simulate the actual welding process with high precision, which is helpful for debugging and optimizing welding process. Intuitive display: Make the complex welding process intuitive, which is convenient for engineers and operators to observe and analyze the welding process and improve work efficiency.
[0093] 2. V-groove positioning and centerline identification: Use Unity's Transform component to calculate the vertex and centerline of the V-groove, and ensure accurate positioning by adjusting the centerline length. Use projection calculation and vector operation to determine the position of the object (welding gun) on the centerline of the V-groove, so as to accurately locate the welding path. Precise positioning: Through geometric calculation and projection algorithm, ensure that the welding workpiece (such as welding gun) can be accurately positioned on the centerline of the V-groove to improve welding quality and accuracy. Dynamic adjustment: The system can adjust the welding gun position in real time during the welding process to ensure that the weld is always in the best position, improving welding efficiency and consistency. Fault tolerance: By setting the tolerance value, the system has a certain fault tolerance in actual applications and adapts to changes in different workpieces and working conditions.
[0094] 3. Weld seam simulation filling: Use the preform of the weld seam filling material to calculate the position of each filling material through linear interpolation to simulate the weld seam filling process. Update the position and direction of each filling material in real time in the Unity scene to visualize the weld seam forming process. Intuitive simulation: Through the dynamic instantiation and position update of the weld seam filling material, the weld seam forming process is intuitively displayed, which is convenient for analyzing and optimizing the welding process. Fine control: It can finely control the weld seam filling speed and quantity, realize welding simulation under different workpieces and working conditions, and has high flexibility and scalability. Process optimization: By observing and analyzing the simulated weld, you can quickly adjust the welding parameters, optimize the welding process, and improve the welding quality and efficiency.
[0095] The present invention significantly improves the reliability and efficiency of the welding process by realizing the digital twin of the welding robot system and combining PLC real-time data interaction, geometric calculation and simulation filling technology. The specific technical effects and advantages are as follows:
[0096] Improve the accuracy and consistency of the welding process: Through precise geometric calculation and real-time data interaction, high-precision simulation of the welding process is achieved to ensure the consistency and quality of the welding process.
[0097] Improve the intuitiveness and controllability of operations: Through 3D simulation and visual display, welding operations are made more intuitive, making it easier for engineers and operators to monitor and adjust in real time.
[0098] Optimize welding process and parameters: Through simulation and data analysis, the best welding parameters and process can be quickly found, shortening the debugging time and improving production efficiency.
[0099] The above effects are based on reasonable engineering practice and technical verification, which will help to improve the automation and intelligence level of the welding industry. BRIEF DESCRIPTION OF THE DRAWINGS
[0100] Figure 1 A welding robot according to the present invention;
[0101] Figure 2 It is a digital twin booth of the welding robot of the present invention;
[0102] Figure 3 A schematic diagram of the welding gun of the present invention at the center line;
[0103] Figure 4 The welding gun of the present invention is not in the centerline schematic diagram;
[0104] Figure 5 It is a simulation weld filling of the present invention;
[0105] Figure 6 This is a diagram of the parent-child relationship of the joints of the present invention. DETAILED DESCRIPTION
[0106] The specific technical solution of the present invention is explained in conjunction with embodiments.
[0107] Experiment 1: Implementation of the digital twin system of welding robots
[0108] Experimental equipment: PLC (Beckhoff), such as Figure 1 The welding robot (type KR1608HW) and computer (running Unity software environment) are shown.
[0109] Experimental steps:
[0110] 1. Data acquisition: Through the Beckhoff TwinCAT ADS library, establish communication with the PLC and obtain the angle data of each axis of the welding robot in real time.
[0111] 2. Data application: Apply the acquired axis angle data to the digital twin robot model in the Unity scene.
[0112] 3. Real-time simulation: By updating the angle of each axis in Unity, real-time simulation synchronized with the actual robot is achieved.
[0113] Specific data and effects:
[0114] Angle data: Axis1=1.4°, Axis2=-54.3°, Axis3=70.0°, Axis4=1.9°, Axis5=56.6°, Axis6=-9.1°. Effect:
[0115] Tests show that the angle update delay of the digital twin robot in Unity does not exceed 50ms, which is sufficient to meet the requirements of real-time simulation. By comparing the position of the actual robot and the digital twin model, the angle error is less than 0.1°, which has a high simulation accuracy. Figure 2 shown.
[0116] advantage:
[0117] Real-time synchronization: It can reflect the actual status of the equipment in real time, making it easier for engineers to monitor and adjust the process.
[0118] High simulation accuracy: Extremely low angular error ensures the reliability of simulation results and provides reliable data support for subsequent process optimization.
[0119] Experiment 2: V-groove positioning and centerline identification
[0120] Experimental equipment: computer (running Unity software environment), 3D model (V-groove and welding gun), measuring tool (laser rangefinder).
[0121] Experimental steps:
[0122] 1. Geometry calculation: Create a V-groove model in Unity and calculate the vertex and center line of the groove.
[0123] 2. Projection calculation: Determine whether the welding gun (object03) is on the center line of the V-groove and calculate its deviation distance.
[0124] Specific data and effects
[0125] data:
[0126] V-groove model: height = 0.1m, width = 0.05m.
[0127] Welding gun position coordinates: X=0.025m, Y=0.1m, Z=0.0m.
[0128] Effect:
[0129] Positioning effect: When the welding gun is located at the coordinates (X=0.025m, Y=0.1m, Z=0.0m), the calculation results show that the center deviation of the welding gun is 0.0m, proving that the welding gun is exactly located on the center line of the V-shaped groove. Figure 3 and Figure 4 shown.
[0130] advantage:
[0131] Precise positioning: It can accurately calculate the position of the welding gun in the V-groove to ensure that the welding path is consistent with the designed path.
[0132] Dynamic adjustment: supports real-time monitoring and adjustment of welding gun position to meet the needs of different workpieces and complex welding paths.
[0133] Experiment 3: Weld Seam Simulation Filling
[0134] Experimental equipment: computer (running Unity software environment), weld filling material preform, 3D model (weld).
[0135] Experimental steps:
[0136] 1. Material instantiation: Instantiate the weld filler material prefab in Unity and set the fill start and end points.
[0137] 2. Position update: Dynamically calculate and update the position and direction of each filling material through linear interpolation method.
[0138] 3. Weld formation: Observe and record the formation process of the simulated weld.
[0139] Effect: Simulate weld filling, such as Figure 5 shown.
[0140] advantage:
[0141] Intuitive display: The simulation filling process is visualized, which makes it easy for engineers to observe and adjust the welding process.
[0142] Fine control: Ability to finely control weld filling speed and path to adapt to different welding requirements.
[0143] Process optimization: The simulation results can be used to quickly adjust and optimize welding parameters to improve welding efficiency and quality.
[0144] Through the above specific test scheme and implementation steps, the present invention realizes efficient digital twinning of the welding robot system, accurate identification of V-groove positioning and centerline, and simulated weld filling. The detailed records and data analysis of each test prove that the present invention has a high degree of real-time, accuracy and operability, and can significantly improve the efficiency and quality of the welding process.
[0145] The key technical points of the present invention are:
[0146] 1. Construct the joint motion mode of four six-axis robots through the concept of "father-child" relationship. Figure 6 shown.
[0147] 2. PLC communication
[0148] Using TwinCAT ADS Library: The script communicates with the PLC by using the TwinCAT ADS library (Application Developer's Software). The ADS library enables C# programs to read and write PLC variables.
[0149] Establish a connection: Establish a connection between the Unity client and the PLC server by calling the "Connect" method.
[0150] Creation and use of variable handles: By obtaining the variable handle in the PLC, the script can access and manipulate the data in the PLC. This is achieved through the "CreateVariableHandle" method.
[0151] 3. Data structure processing
[0152] Define C# structures: Several C# structures need to be defined in the script, which match the data structures in the PLC. Use the "StructLayout" and "MarshalAs" features to ensure that the memory layout and data types are consistent with those in the PLC.
[0153] Type conversion and memory layout control: Through clear memory layout control and type conversion mechanisms, ensure that the data read from the PLC can be correctly stored in the corresponding structure fields.
[0154] 4. Data reading and analysis
[0155] Real-time data reading: In Unity's "Update" method, the script continuously calls the "ReadAny" method to read data from the PLC to ensure the real-time nature of the data.
[0156] Data parsing and processing: Parse and convert the read data into the format required for actual application (for example, convert the unit of the read angle data into degrees).
[0157] 5 Object Transformation and Rotation
[0158] Update object status in real time: The script contains the logic for updating the object status in Unity based on the read data, and realizes the rotation and position adjustment of the object through the transformation matrix.
[0159] Smooth transition: To prevent the object's angle from jumping, the script records and compares the angle values of the previous frame and the current frame, calculates the difference in rotation, and achieves smooth rotation for the object.
[0160] 6. UI Update
[0161] Real-time data display: The script updates various read data (such as current, voltage, speed, etc.) to the UI components in real time to ensure that the user interface can reflect the latest system status.
[0162] Text component binding: Each UI text component is bound to the corresponding data and changes as the data is updated.
[0163] 7. Debugging and Monitoring
[0164] Debug information output: When executing key steps or operations, the script uses debug logs to output current status and data information to help developers perform real-time monitoring and problem location.
[0165] 8. Resource management and release
[0166] Handle release: When the script is destroyed, ensure that the handles of all PLC variables are correctly released to prevent resource leakage.
[0167] Disconnect: Ensure that the connection to the PLC is disconnected when the application exits to free up communication resources and maintain system stability.
[0168] 9. Error handling and robustness
[0169] Error handling: Add error capture and handling mechanisms during communication with PLC to ensure that the system can handle smoothly in the event of communication interruption or abnormality.
[0170] Enhance system robustness: Ensure that all data read and write operations have sufficient boundary checking and exception handling to improve the robustness and reliability of the system.
[0171] 10. Component and Transformation Management
[0172] Transform component: The script obtains and manages the position, rotation, and scale information of objects in the scene through the "Transform" component.
[0173] Transformation between the world coordinate system and the local coordinate system: The transformation from the local coordinate system to the world coordinate system is achieved through the "TransformDirection" method.
[0174] 11. Coordinate calculation and geometric operations
[0175] Vertex and vector calculation: Calculate the positions of the two vertices of the V-groove, as well as the starting and ending points of the center line.
[0176] Vector operations: vector addition and subtraction and the "normalized" method are used to calculate the direction and normalized vectors between vertices.
[0177] Projection operation: Use the "Vector3.Project" method to project a point onto a vector (center line) to calculate the distance between the point and the line.
[0178] 12. Gizmos Drawing
[0179] Use of the Gizmos class: Use "Gizmos.DrawLine" to draw the center line for debugging in the editor.
[0180] Color settings: Use "Gizmos.color" to set the color of the drawn lines.
[0181] 13. Starting methods and life cycle management
[0182] Start method: Initializes operations at the beginning of the game and outputs the initial world coordinates of the object.
[0183] OnDrawGizmos method: called in real time in editor mode to draw and update debug graphics.
[0184] 14. Basic physics and tolerance judgment
[0185] Tolerance value setting: Set a small tolerance value to determine whether a point is on the center line, allowing a certain deviation.
[0186] Distance and direction judgment: The positional relationship between the welding gun and the wire is determined by calculating the offset vector and its modulus.
[0187] 15. Scalability and flexibility settings
[0188] Parameter Adjustment: Allows you to adjust the length and tolerance of the centerline through variables such as "extensionLength" and "yTolerance" to suit different application needs.
[0189] 16. Object Instantiation
[0190] Use of prefabs: The script dynamically generates weld filler materials through the passed prefab ("weldFillMaterialPrefab").
[0191] Object array management: Create an array ("fillMaterials") to store all instantiated weld fill material objects for subsequent operations.
[0192] 17. Transform component
[0193] Position transformation: Use the "Transform" component to obtain the positions of the start and end points for subsequent calculation of direction and interpolation.
[0194] Direction setting: Set the direction of each filling material through "transform.rotation".
[0195] 18. Linear Interpolation
[0196] Vector3.Lerp method: Use the "Vector3.Lerp" method to perform linear interpolation between the starting point and the end point to calculate the position of each fill material.
[0197] 19. Motion and animation
[0198] Smooth movement: Smooth movement of materials is achieved by calculating the position of each fill material in the "Update" method.
[0199] Speed control: Although the filling process in the script is based on interpolation, the filling speed can still be controlled by adjusting the "fillSpeed" variable (although the current script does not use this variable, it can be expanded).
[0200] 21. Mathematical calculations and vector operations
[0201] Vector normalization: Determine the filling direction by calculating the vector from the start point to the end point and normalizing it.
[0202] Interpolation calculation: According to the current index and filling quantity, the position step of each material is calculated to ensure that the filling material is evenly distributed.
[0203] 22. Scalability
[0204] Dynamically adjust parameters: By passing in different starting points, end points, filling quantities, speeds and other parameters, you can flexibly adjust the filling effect to meet the needs of different scenarios.
[0205] Fill direction setting: You can modify the direction setting logic according to your needs to achieve filling effects in different angles and directions.< / text>
Claims
1. A method for realizing dynamic simulation and control of a welding robot based on digital twin technology, characterized in that: First, use SolidWorks to build a 1:1 model of the actual factory equipment. Second, import this model into Unity3D to establish a unified coordinate system and simulate the coordinated motion of the joints of the welding robot, and realize digital transformation in combination with the ADS communication protocol. Then, identify the center line of the weld according to different workpieces, dynamically adjust the position relationship between the welding gun and the center line, and promptly feedback to the staff for adjustment. Finally, use simulation software to simulate the welding process in real time, so that the staff can optimize the process parameters during the welding operation. The specific steps include: S1. Hardware selection; S2, modeling; Based on the above hardware, choose 3D design software to perform 1:1 modeling or build models through 3D scanning; S3, joint definition; In Unity3D, define the six joints of the physical entity welding robot model, create six objects named joint_1 to joint_6, and arrange them in order; in the "Transform" component of each object, place the latter object as a child object in the "Child" field of the previous object; establish the joint parent-child relationship from the base base to the end effector a6; when moving joint_1, the other joints follow the movement accordingly, simulating the movement of the physical entity model; S4, collect data; In Unity3D, obtain the data transmitted from PLC through the script file, use the ADS communication protocol, define the communication IP address and port number, and create a handle; Extract the physical robot joint data through the data structure in the communication protocol; S5, drive model design; First, the physical entity joint number and axis direction are obtained; the system uses relative positioning technology to calculate the angle difference between the current frame and the previous frame, and then applies it to the digital model; the system's data refresh frame rate is 60. If the object angle value continues to change, the digital model will be synchronized in real time, presenting a smooth dynamic effect; S6. Visual management design; Create an interface in Unity3D to display the real-time values of six-axis angle, positioner angle, welding voltage, welding current, welding speed and wire feeding speed, and allow the large screen design principle to update the data at any time; S7, identify the center line of the V-groove; S7 specifically includes the following sub-steps: 1) Get the center point and scaling value of the V-groove; 2) Calculate the vertex of the V-groove: add or subtract half of the scaling value from the center point to get the vertex; 3) Calculate the starting and ending points of the center line: Draw the center line by extending a small distance outward from each vertex; 4) Calculate the relationship between the welding gun and the center line: Get the vector from the welding gun to the starting point of the center line; Calculate the projection of the welding gun in the center line direction; Get the projection point; Calculate the deviation vector; Determine whether the point is on the center line based on the tolerance value. If it is within the tolerance range, output a message; otherwise, output a message about the direction and magnitude of the deviation. S8, simulation of weld forming process; S8 specifically includes the following sub-steps: 1) Set the scene; Create a weld filler material prefab; According to the model of workpiece and filler material in SolidWorks, simulate the weld filler material; as a prefab, and name it WeldFillMaterialPrefab; 2) Filling weld process; Initialize the filling material. In the Start function, initialize an array fillMaterials with a size of fillCount; Use a for loop to traverse the array and instantiate the fill material prefab at the starting point and store it in the array; Calculate the direction and step size In the Update function, calculate the direction vector from the start point to the end point and normalize it; Set the fill material position and orientation: Use a for loop to iterate over each filling material and calculate the step length based on the filling quantity; Use the Vector3.Lerp function to linearly interpolate between the start and end points to set the position of each fill material; Set each fill material to always face in the Vector3.up direction.
2. The method for realizing dynamic simulation and control of a welding robot based on digital twin technology according to claim 1 is characterized in that: S2 uses SolidWorks professional 3D design software and Unity3D’s built-in physics engine to simulate actual physical phenomena; Digital model conversion: convert the files created by the mechanical design software into the file format recognized by Unity3D through 3DMAX software and finally import them into the development environment of Unity3D; Adjust the model to the center coordinates of Unity: 1) Drag the .Fbx file into Unity's project panel and drag the model into the scene; 2) Right-click the model in the Hierarchy panel, select Prefab, and click Unpack; 3) Select all assembly parts, find the Reset button in Transform in the Inspector panel, and click it to center the model in Unity coordinates.
3. The method for realizing dynamic simulation and control of a welding robot based on digital twin technology according to claim 1 is characterized in that: The visual management design of S6 specifically includes the following sub-steps: 1) Create UI Canvas: Right-click in the Hierarchy panel and select UI -> Canvas to create a UI Canvas object. Create Text UI elements under the Canvas. Each Text element is used to display the value of a parameter. Adjust the properties of the Text element to make the interface layout clear. 2) Create a script to obtain data: Write a script to get the data and use GetComponent <text> () method to obtain a reference to the UI element; in the script, update the obtained data to the corresponding Text UI element to ensure that the parameter value is displayed in real time;< / text> 3) Scripts are attached to UI elements and operate the interface: Find each Text UI element and drag it to the corresponding variable reference in the script to ensure that the data is updated correctly; through the custom Unity script, realize the mouse control camera movement function: left button to rotate, middle button to zoom, right button to move.
Citation Information
Patent Citations
Weld joint deviation value real-time detection method and system and weld joint deviation correction method
CN115178837A
Digital twinning method and system for welding robot workstation
CN115329559A
