A robot machining code acquisition method based on nine coordinate information

By generating robot machining programs based on Solidworks, UG NX, Python and Matlab, the problem of complexity of the offline programming system was solved, and an efficient and accurate robot machining process was achieved.

CN118219253BActive Publication Date: 2025-10-17SOUTH CHINA UNIV OF TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410053567.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-12
Publication Date
2025-10-17
Estimated Expiration
2044-01-12

AI Technical Summary

Technical Problem

In the existing technology, the offline programming system of industrial robots is highly complex and lacks effective programming tools, resulting in low efficiency and cumbersome processing of complex parts.

Method used

The machining model is constructed using Solidworks, imported into UG NX to generate the machining trajectory, the nine-coordinate information is converted using Python and Matlab, B-spline fitting and robot kinematics inverse solution are performed, the robot machining program is generated, and simulation verification is performed in Robotstudio.

Benefits of technology

It simplifies the machining process, improves robot programming efficiency and machining accuracy, ensures the accuracy and safety of the machining process, and avoids collisions and errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118219253B_ABST
    Figure CN118219253B_ABST
Patent Text Reader

Abstract

The application discloses a kind of robot machining code acquisition methods based on nine coordinate information: through Solidworks framework processing model, obtains processing entity;Processing model is imported to UG NX, generates machining track by selecting processing entity, obtains CLS file;Python obtains nine coordinate information in it according to the input CLS file, and calls matlab engine and makes GUI;Matlab utilizes nine coordinate information, carries out B spline fitting fairing processing, obtains robot six-axis data by ABB industrial robot kinematics inverse solution, and outputs rapid instruction;Robotstudio imports rapid instruction and carries out simulation, and observes machining track.The application carries out simulation verification in offline programming, observes machining track by Robotstudio, ensures that collision or error does not occur when executing in real robot, improves safety and stability.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of robot offline programming machining, and in particular to a robot (offline programming) machining code acquisition method based on nine coordinate information. BACKGROUND

[0002] In the field of industrial manufacturing, robot machining is a highly efficient and flexible machining method that can provide a better solution for complex surface part machining. Compared with traditional CNC machine tools, industrial robots have a larger workspace and better flexibility.

[0003] Currently, the programming methods of industrial robots mainly include teaching programming and offline programming. Online programming requires the use of a teach pendant to guide the robot to move along the machining path, which is time-consuming and tedious and is not suitable for the machining of complex parts. Offline programming can solve these problems, but the complexity of offline programming systems is still a major challenge for the practical application of robot machining.

[0004] In the machining process of a CNC machine tool, tool tip position and tool direction data are generated by CAD / CAM software and converted into NC code to drive the tool to complete the machining task. Machine tool programming is expected to realize offline programming of industrial robots, thereby improving programming efficiency, flexibility, and machining quality. Using machine tool programming language, robots can more efficiently perform complex machining tasks and play a greater role in actual production. However, current offline programming still faces the challenges of technical complexity and lack of relevant programming tools. SUMMARY

[0005] The present application aims to overcome the shortcomings and deficiencies of the prior art and provide a robot machining code acquisition method based on nine coordinate information. The present application constructs a machining model through Solidworks, imports it into UG NX to generate machining trajectories based on the model to obtain a CLS file, uses matlab and Python to convert nine coordinate instructions into robot machining programs that can be recognized by industrial robots, and realizes simulation verification.

[0006] The present application is implemented through the following technical solutions:

[0007] A robot machining code acquisition method based on nine coordinate information, comprising the following steps:

[0008] Step S1: Construct a machining model through Solidworks to obtain a machining entity;

[0009] Step S2: Import the machining model into UG NX, select the machining entity, generate machining trajectories, and obtain a CLS file;

[0010] Step S3: Python obtains nine coordinate information in the input CLS file, and calls a matlab engine and makes a GUI;

[0011] Step S4: Matlab performs B-spline fitting fairing processing on the nine coordinate information, obtains robot six-axis data through ABB industrial robot kinematics inverse solution, and outputs rapid instructions;

[0012] Step S5: Robotstudio imports the rapid instructions to perform simulation and observe the machining trajectory.

[0013] The above step S4 specifically includes the following sub-steps:

[0014] S4-1, nine coordinate information conversion:

[0015] The nine coordinate information in the CLS file is the xyz position of the end mill tool center point TCP, the tool axis direction vector, and the xyz position of the tool contact point P3; the tool axis direction vector is extracted and converted into rotation angles around the X-axis direction and the Z-axis direction to obtain the rotation angles of the A-axis and the C-axis of the machine tool; and according to the five-axis information and the tool length H, the point trajectory on the tool axis is calculated, so as to obtain the trajectories of the tool center point TCP, the point on the tool axis and the tool contact point P3, and three curves are formed;

[0016] Wherein, the point on the tool axis is calculated as follows:

[0017] First, calculate the rotation angles of the A-axis and the C-axis of the machine tool:

[0018]

[0019] Wherein, v is the tool axis direction vector of the nine coordinate information, A and C are the rotation angles of the A-axis and the C-axis;

[0020] Then calculate the point on the tool axis

[0021] P2=P1+rotz(C)·rotx(A)·D;

[0022] Wherein, P1 is a point on TCP, P2 is the tool axis point to be solved, D is a column vector of the tool length used for machining, and rotz and rotx are rotation matrices obtained by rotating the robot Z-axis and X-axis rotation angles, respectively;

[0023] S4-2, B-spline least square fitting is performed on the three B-spline curves to obtain the pose matrix of the robot end;

[0024] The TCP point P1 is substituted into the B-spline curve as a control point to obtain the B-spline curve after smoothing fitting; since the point on the tool shaft and the tool contact point are both generated in the same NC code instruction, the B-spline curve can be fitted according to the definition of the B-spline curve; in the smoothing processing of the B-spline curve fitting, the expression is as follows:

[0025]

[0026] Wherein, u is the parameter of the B-spline curve; r is the number of control points, D j is the jth control point of the curve; N j,p (u) is the pth B-spline basis function of the jth control point, and satisfies the Cox-deBoor recursive relationship:

[0027]

[0028] Wherein, it is stipulated that

[0029] The parameter u in the TCP curve is calculated by using the cumulative chord length method, and the expression is as follows:

[0030]

[0031] Wherein j=1, 2, …, m-2; m is the number of control points of the curve;

[0032] The B-spline least square function is defined as:

[0033]

[0034] Wherein, R j =P j -N 0,p (u j )P0-N n,p (u j )P m , j=1, 2, …, m-1.

[0035] f is a scalar function of n-1 variables P1, P2, …, P n-1 , and the linear equation of P i can be obtained by applying the standard linear least square fitting technique:

[0036] P=(N T N) -1 R;

[0037] In the formula, N is a (m-1)×(n-1) matrix composed of scalars,

[0038]

[0039] R is a column vector with n-1 points,

[0040]

[0041] By the cumulative chord length method, it is ensured that each node interval contains at least one u j and in this case the matrix N T N is positive definite, and the linear equation group P=(N T N) -1 R can be solved by Gaussian elimination, so as to obtain the control point P=[P1 P2 … P n-1 ] T , so that a B-spline curve closest to the given trajectory points can be determined;

[0042] Since the three B-spline curves are generated simultaneously in the same NC code instruction, the obtained u and nodes are substituted into the B-spline least square fitting function to calculate the corresponding points on the three B-spline curves at the same time, and the three curves satisfy the following formula:

[0043]

[0044] Where C1(u), C2(u), and C3(u) are the points obtained by calculating the three curves after B-spline fitting of TCP, tool axis point, and tool contact point, respectively, and R is the tool radius;

[0045] The three curves always remain perpendicular, and the fixed distance between the TCP point and the tool axis point is the length of the tool axis, and the fixed distance between the TCP point and the tool contact point is the tool radius, so that a local coordinate system can be established;

[0046] The point on the curve of the TCP is taken as the origin of the local coordinate system, the point on the tool axis is taken as the point on the Z axis, and the tool contact point is taken as the point on the Y axis, to form a local coordinate system, and then the pose matrix of the tool in the absolute coordinate system is calculated, so as to obtain the pose matrix of the robot end, and the calculation formula is as follows:

[0047]

[0048] Where N, A, and O are obtained by calculating the vectors C1(u), C2(u), and C3(u);

[0049] S4-3, calculate the robot end pose:

[0050] Using the DH model and the above pose matrix, the inverse solution of the six-axis robot is calculated to obtain the robot six-axis data, and it is checked whether the data is within the robot joint angle range; then, according to the robot end pose matrix, the quaternion [w, x, y, z] of the robot attitude is calculated, and the calculation formula is as follows:

[0051]

[0052] S4-4, speed planning for the robot:

[0053] In the B-spline curve after the TCP fair fitting, the curvature of the curve is calculated, the robot acceleration is controlled by screening the curvature mutation point, if the curvature of the current point is mutated before and after, the current motion speed of the robot is reduced, and then the operation is stable, the formula for judging the curvature mutation point is as follows:

[0054] |ρ i+1 -ρ i |≥10(|ρ i -ρ i-1 |+|ρ i+2 -ρ i+1 |);

[0055] Where, ρ i is the curvature radius of the i-th interpolation point.

[0056] S4-5, input robot execution statement:

[0057] The robot end position, quaternion and motion speed of steps S4-2, S4-3 and S4-4 are comprehensively outputted, the robot motion execution statement is finally outputted, and saved in a txt file, waiting for subsequent steps to input simulation software for result detection.

[0058] Compared with the prior art, the present application has the following advantages and effects:

[0059] (1) The present application uses SolidWorks, UG NX, Python, MATLAB and industrial robot to realize the whole process of robot offline programming machining, simplifies the machining process while ensuring the accuracy and feasibility of machining. The tool position file generated by UGNX describes the end position and attitude of the robot in the machining process. Compared with NC code, the robot attitude obtained by the present application is more accurate, which is beneficial to subsequent robot attitude planning. The method is simple and convenient, and only UG NX software is needed to realize the acquisition of robot position and attitude, which is feasible and beneficial to subsequent trajectory planning and attitude planning.

[0060] (2) The present application faces the machining model with complex surface, and realizes the smooth processing of the curve by least square fitting of three B-spline curves. This method can better maintain the characteristics of the original curve and obtain the robot position matrix, so that the machining process is more accurate and efficient.

[0061] (3) The simulation verification is carried out in offline programming, the machining track is observed through Robotstudio, collision or error is ensured not to occur when being executed in the real robot, and safety and stability are improved. BRIEF DESCRIPTION OF DRAWINGS

[0062] Figure 1 is a method flowchart of an embodiment of the present application.

[0063] Figure 2 is a schematic diagram of an S-shaped test piece processed by an industrial robot according to an embodiment of the present application; in the diagram, reference numeral 1 is an ABB industrial robot, 2 is a machining tool, and 3 is an S-shaped test piece.

[0064] Figure 3 is a schematic diagram of B-spline fitting error according to an embodiment of the present application. DETAILED DESCRIPTION

[0065] To make the objectives, technical solutions and advantages of embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in connection with the drawings of the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0066] Embodiment:

[0067] As shown in the figure, the present embodiment provides a robot offline programming machining method based on NC code, comprising the following steps: Figure 1

[0068] S100, a machining model is constructed through Solidworks to obtain a machining entity, and the machining entity selected is a blank of an S-shaped test piece, as shown in the figure. Figure 2

[0069] S200, the machining model is imported into UG NX, a machining track is generated by selecting the machining entity, and NC code is obtained, comprising the following steps:

[0070] S210, the machining model is imported into UG NX in the form of an STL file;

[0071] S220, the blank machining position space is set according to the machining task and the commonly used workspace of the robot;

[0072] S230, in UG NX, the "machining" module is selected, the machining machine tool is selected, and the tool, geometric body, program and method are set respectively.

[0073] ​​S240, select the processing procedure "bottom wall milling", obtain the CLS file of S-shaped test piece processing.

[0074] S300, Python obtains nine coordinate information in the input CLS file, and calls the matlab engine and makes GUI, including the following steps:

[0075] S310, using the dict instruction of Python, traversing each row of data information of CLS, checking the nine coordinate information in the row, and finally storing and outputting in the dictionary.

[0076] Since the nine coordinate instruction lines are all separated by $$ symbol, the nine coordinate information is stored in the dictionary by searching $$ to determine the line where the nine coordinate information is located, and finally stored and output in the dictionary.

[0077] S320, Python uses matlab.engine library to call matlab engine, integrates and manages matlab program, and finally uses tkinter library to make program GUI interface.

[0078] S400, Matlab uses nine coordinate information to obtain robot six-axis data through ABB IRB120 robot kinematics inverse solution, outputs robot motion instruction, including the following steps:

[0079] S410, using the input nine coordinate information, B-spline fitting is carried out on three groups of control points to obtain three curves, and then the pose matrix of the robot end is calculated, and the robot kinematics inverse solution is calculated to check whether the six-axis data is within the joint angle range;

[0080] S420, using joint angle to obtain the quaternion of robot posture;

[0081] S430, calculating the curvature of the TCP curve, velocity planning is carried out on the robot motion;

[0082] S440, the robot end position, quaternion and velocity obtained from S410 to S430 are integrated to generate robot motion instruction, and stored in txt file.

[0083] S500, Robotstudio imports robot motion instruction for simulation and observes the processing trajectory.

[0084] The embodiments of the application are not limited by the above examples, and any changes, modifications, substitutions, combinations and simplifications made without departing from the spirit and principles of the application shall be equivalent replacement modes, and all shall be included in the protection scope of the application.

Claims

1. A method for obtaining robot processing codes based on nine-coordinate information, characterized in that The steps include: Step S1: Build a machining model through Solidworks to obtain the machining entity; Step S2: Import the machining model into UG NX, generate the machining trajectory by selecting the machining entity, and obtain the CLS file; Step S3: Python obtains the nine-coordinate information from the input CLS file, calls the MATLAB engine, and creates the GUI; Step S4: Matlab uses the nine-coordinate information to perform B-spline fitting and smoothing, obtains the robot's six-axis data through the inverse kinematic solution of the ABB industrial robot, and outputs the rapid command; Step S5: Import the rapid command into Robotstudio for simulation and observe the processing trajectory; Step S4 specifically includes the following sub-steps: S4-1, nine-coordinate information conversion: The nine-coordinate information in the CLS file is the xyz position of the end mill tool center point TCP, the tool axis direction vector, and the xyz position of the tool contact point P3. The tool axis direction vector is extracted and converted into rotation angles around the X and Z axes to obtain the rotation angles of the machine tool's A and C axes. Furthermore, based on the five-axis information and the tool length H, the trajectory of the points on the tool axis is calculated to obtain the trajectory of the tool center point TCP, the points on the tool axis, and the tool contact point P3, forming three curves. The points on the tool axis are calculated as follows: First calculate the rotation angle of the A-axis and C-axis of the machine tool: Among them, v is the tool axis direction vector of the nine-coordinate information, A and C are the rotation angles of the A axis and C axis; Then calculate the point on the tool axis P2=P1+rotz(C)·rotx(A)·D Where P1 is the point on the TCP, P2 is the desired tool axis point, D is the column vector of the tool length used in machining, rotz and rotx are the rotation matrices obtained by rotating the robot around the Z and X axes, respectively. S4-2, perform B-spline least squares fitting on the three B-spline curves to obtain the pose matrix of the robot end: The TCP point P1 is used as a control point and substituted into the B-spline curve to obtain the smoothed B-spline curve. Since the points on the tool axis and the tool contact points are generated in the same NC code instruction, fitting can be performed according to the definition of the B-spline curve. In the smoothing process of the B-spline curve fitting, the expression is as follows: Among them, u is the parameter of the B-spline curve; r is the number of control points, D j is the j-th control point of the curve; N j,p (u) is the p-order B-spline basis function of the j-th control point and satisfies the Cox-deBoor recursion relation: Among them, the provisions The parameter u in the TCP curve is calculated using the cumulative chord length method, and its expression is: Where j = 1, 2, ..., m-2; m is the number of control points of the curve; The B-spline least squares function is defined as: Among them, R j =P j -N 0,p (u j )P0-N n,p (u j )P m ,j=1,2,…,m-1. f is about n-1 variables P1, P2, ..., P n-1 scalar-valued function, applying standard linear least squares fitting techniques, we can get P i The linear equation is: P=(N T N) -1 R; Where N is a (m-1)×(n-1) matrix composed of scalars, R is a column vector consisting of n-1 points. By using the cumulative chord length method, it is ensured that each node interval contains at least one u j And in this case the matrix N T N is positive definite, the linear equation system P = (N T N) -1 R can be solved by Gaussian elimination method, so as to obtain the control point P = [P1 P2 … P n-1 ] T , so that a B-spline curve that is most similar to the given trajectory point can be determined; Since the three B-spline curves are generated simultaneously in the same NC code instruction, the obtained u and nodes are substituted into the B-spline least squares fitting function to calculate the corresponding points on the three B-spline curves after the least squares fitting at the same time. These three curves satisfy the following formula: Where C1(u), C2(u), and C3(u) are the three curves obtained after B-spline fitting of TCP, tool axis point, and tool contact point under parameter u calculation, and R is the tool radius; The three curves are always kept perpendicular, and the fixed distance between the TCP point and the tool axis point is the length of the tool axis, and the fixed distance between the TCP point and the tool contact point is the tool radius, so a local coordinate system can be established; The point on the TCP curve is used as the origin of the local coordinate system, the point on the tool axis is used as the point on the Z axis, and the tool contact point is used as the point on the Y axis to form a local coordinate system. Then, the pose matrix of the tool in the absolute coordinate system is calculated to obtain the pose matrix of the robot end. The calculation formula is as follows: Where N, A, and O are all calculated from the C1(u), C2(u), and C3(u) vectors; S4-3, calculate the robot end pose: Using the DH model and the above pose matrix, we calculate the inverse solution of the six-axis robot, obtain the six-axis data of the robot, and check whether the data is within the range of the robot joint angle. Then, based on the robot end pose matrix, we calculate the quaternion [w, x, y, z] of the robot posture. The calculation formula is as follows: S4-4, speed planning for the robot: In the B-spline curve after TCP smoothing fitting, the curvature of the curve is calculated. By screening the curvature mutation point, the robot acceleration is controlled. If the curvature before and after the current point suddenly changes, the current movement speed of the robot is reduced to stabilize the operation. The formula for determining the curvature mutation point is as follows: |r i+1 -r i |≥10(|ρ i -r i-1 |+|r i+2 -r i+1 |); Among them, ρ i is the curvature radius of the i-th interpolation point.

2. The method for obtaining robot processing codes based on nine-coordinate information according to claim 1, characterized in that: Also includes S4-5, input robot execution statement: The robot end position, quaternion and motion speed of steps S4-2, S4-3 and S4-4 are integrated, and the robot motion execution statement is finally output and saved in a txt file, waiting to be input into the simulation software for result detection in the subsequent steps.

Citation Information

Patent Citations

  • Numerical control programming method for air inlet and outlet edges of rough machining blades

    CN109623291A