Workpiece attitude error compensation method and system based on space angle and TCSTRANS
By using automatic spatial angle fitting and kernel translation technology, the automatic measurement and compensation of workpiece posture on CNC machine tools is realized, which solves the problem of relying on human experience in the existing technology, improves machining accuracy and efficiency, and is suitable for precision machining on five-axis CNC machine tools.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUHAN HUAZHONG NUMERICAL CONTROL
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-28
AI Technical Summary
Existing methods for correcting workpiece posture errors in CNC machine tool machining rely on manual experience, which is complex, inefficient, has poor repeatability, is prone to introducing errors, and leads to chaotic program management when modifying the machining program.
By using a spatial angle and TCSTRANS-based method, a laser probe is used to automatically fit the spatial angle. Combined with kernel translation technology, the program instructions are dynamically reconstructed within the CNC system to achieve automatic measurement, calculation, and compensation of the workpiece posture, thus avoiding modification of the original G-code.
It enables automated measurement and compensation of workpiece posture, improves machining accuracy and efficiency, reduces operational complexity, maintains program standardization, and is suitable for precision machining on five-axis CNC machine tools.
Smart Images

Figure CN121934474A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of CNC machine tool machining technology, and in particular to a workpiece posture error compensation method and system based on spatial angle and TCSTRANS. Background Technology
[0002] In CNC machining, precise workpiece clamping and coordinate system establishment on the machine tool table are crucial prerequisites for ensuring machining accuracy. CNC machining programs are compiled based on a preset workpiece coordinate system, which defines both the workpiece's spatial position (origin) and its spatial orientation (directions of each coordinate axis). Ideally, the workpiece blank clamping orientation should be completely consistent with the preset reference orientation of the CNC program model (horizontal and upright). However, in actual production, factors such as fixture manufacturing errors and wear, machine tool table levelness errors, and uncertainties in human clamping operations can cause deviations between the actual and theoretical spatial orientations of the workpiece, resulting in spatial orientation errors.
[0003] When spatial attitude error is significant, directly executing a machining program based on the theoretical coordinate system will cause spatial misalignment between the tool path and the actual geometry of the workpiece blank, leading to problems such as local undercutting, overcutting, or even workpiece scrapping. This problem is particularly prominent in high-precision fields such as aerospace and precision molds.
[0004] Existing methods for correcting workpiece posture errors heavily rely on operator experience and skills. Operators must manually measure and estimate the workpiece's tilt angle and direction using tools such as dial indicators and machine tool probes, and then decompose the posture error into coordinate rotation commands (such as G68.2) executable by the CNC system through complex spatial geometric calculations. This method has several drawbacks: it is complex and inefficient, with tedious and time-consuming measurement, calculation, and parameter input processes; it has poor repeatability, as human calculation can easily introduce errors, and it depends heavily on the operator's skill level; it has a high technical threshold, requiring operators to possess strong spatial imagination and mathematical calculation abilities, resulting in high training costs; furthermore, existing methods require modification of already compiled and validated machining programs, leading to chaotic program management, complex post-processing, and potential interference or path problems that deviate from the original machining intent. Therefore, current technology lacks an integrated software solution that can automatically, quickly, and accurately measure, calculate, and compensate for workpiece spatial posture errors within the CNC system. Summary of the Invention
[0005] The present invention aims to solve at least one of the technical problems existing in the prior art, and proposes a workpiece posture error compensation method and system based on spatial angle and TCSTRANS.
[0006] In a first aspect, embodiments of the present invention provide a workpiece attitude error compensation method based on spatial angles and TCSTRANS, comprising:
[0007] S100. Perform multi-point sampling on the workpiece reference surface, automatically perform spatial plane fitting calculation, solve the rotation matrix by SVD decomposition, and then automatically fit the spatial angle by inverse solving the rotation matrix to obtain the spatial angle parameters;
[0008] When the S200 CNC system parses the machining program, it reads the spatial angle parameters corresponding to the workpiece coordinate system, enables the attitude correction function, and dynamically reconstructs the program instructions through the kernel translation mechanism. Without modifying the original G code, it completes the workpiece coordinate system attitude correction and obtains the corrected characteristic coordinate system TCSTRANS.
[0009] S300. Based on the modified characteristic coordinate system TCSTRANS, the XYZ coordinates and rotation axis angles in the characteristic system are transformed into the corresponding coordinates and angles in the machine tool coordinate system, thereby realizing the control of the tool center point in five-axis linkage machining.
[0010] Furthermore, in S100, automatic fitting of the spatial angle is achieved to obtain the spatial angle parameters. The specific steps include:
[0011] S101. Configure machine tool structure parameters and RTCP parameters, and load the preset automatic measurement program;
[0012] S102. Drive the probe to collect coordinate data of three non-collinear points on the workpiece reference plane;
[0013] S103. Combine the collected coordinate data into an original matrix A, and calculate the centroid vector of matrix A. Combined with the centroid vector of the actual workpiece position matrix B Through the covariance matrix H=A× SVD decomposition, solving for the rotation matrix R = V × U and V are orthogonal matrices;
[0014] S104. Calculate the spatial angular direction vector using the inverse kinematics formula and automatically fill it into the attitude parameter items of the specified workpiece coordinate system.
[0015] Furthermore, the specific steps implemented in S103 include: after receiving the coordinates of multiple points, combining the multiple coordinates into the original matrix A= If the matrix formed by the actual workpiece position is B, then the two matrices A and B satisfy B = R * A + T, where R is the rotation matrix and T is the translation matrix.
[0016] The centroid vector of matrix A is obtained as follows: The centroid of matrix B is According to the rotational properties of rigid bodies, then =R* Thus, through the covariance matrix The SVD decomposition solution is obtained .
[0017] Furthermore, in S200, the corrected characteristic coordinate system TCSTRANS is obtained, and the specific steps include:
[0018] S201. The system interpreter parses the original G code line by line. When it parses the line of program that sets the workpiece coordinate system, it obtains the corresponding spatial angle parameters.
[0019] S202. Determine whether the attitude correction function is enabled. If enabled, start the kernel translation mechanism and dynamically insert TCSTRANS feature coordinate system instructions.
[0020] S203 calculates the spatial rotation transformation matrix from the theoretical workpiece coordinate system to the actual workpiece coordinate system based on spatial angle parameters;
[0021] S204. Subsequent programming coordinates will be interpreted and mapped in this modified characteristic coordinate system.
[0022] Furthermore, in S202, the TCSTRANS characteristic coordinate system instruction is dynamically inserted. The specific method includes: if the attitude correction function is confirmed to be enabled, the interpreter will start its unique kernel translation mechanism. The mechanism will dynamically insert a TCSTRANS characteristic coordinate system instruction after the current program line without changing the original program instruction sequence, and pass the obtained spatial angle parameters to the instruction. The system kernel will calculate a spatial rotation transformation matrix from the theoretical workpiece coordinate system to the actual workpiece coordinate system in real time based on the spatial angle parameters, and store the spatial rotation transformation matrix.
[0023] Furthermore, in S300, tool center point control is achieved in five-axis linkage machining. Specific steps include:
[0024] S301. The interpolator receives the XYZ coordinates of the tool center point in the characteristic coordinate system, and transforms them into coordinates in the machine tool coordinate system through a preset matrix operation formula, thereby driving the linear axis to move.
[0025] S302. The interpolator receives the rotation axis angle in the characteristic coordinate system, converts it into a tool vector in the characteristic coordinate system, and then converts it into a tool vector in the machine tool coordinate system through a preset matrix operation formula; the tool vector in the machine tool coordinate system is converted into the machine tool rotation axis angle through the source coordinate system to the target coordinate system, so as to achieve precise synchronization of tool direction and position.
[0026] Furthermore, the expression of the matrix operation formula is: Machine tool coordinates = rotation transformation matrix × characteristic system coordinates.
[0027] Secondly, this invention also discloses a workpiece posture error compensation system based on spatial angles and TCSTRANS, comprising: a spatial angle fitting module, a coordinate system correction module, and a five-axis RTCP execution module; wherein:
[0028] The spatial angle fitting module is used to sample multiple points on the workpiece reference surface, automatically perform spatial plane fitting calculations, solve the rotation matrix through SVD decomposition, and then automatically fit the spatial angles by inverse solving the rotation matrix to obtain the spatial angle parameters.
[0029] The coordinate system correction module is used when the CNC system parses the machining program to read the spatial angle parameters corresponding to the workpiece coordinate system, enable the attitude correction function, and dynamically reconstruct the program instructions through the kernel translation mechanism to complete the workpiece coordinate system attitude correction without modifying the original G code, and obtain the corrected characteristic coordinate system TCSTRANS.
[0030] The five-axis RTCP execution module is used to transform the XYZ coordinates and rotation axis angles in the characteristic coordinate system into the corresponding coordinates and angles in the machine tool coordinate system based on the modified characteristic coordinate system TCSTRANS, thereby realizing the control of the tool center point in five-axis linkage machining.
[0031] Thirdly, the present invention also discloses an electronic device, characterized in that it comprises:
[0032] One or more processors;
[0033] Memory, used to store one or more programs;
[0034] When the one or more programs are executed by the one or more processors, the one or more processors implement the error compensation method.
[0035] The present invention also discloses a computer-readable medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the steps in the error compensation method.
[0036] This invention discloses a workpiece posture error compensation method and system based on spatial angles and TCSTRANS. The method achieves automatic workpiece posture sensing, seamless compensation, and efficient machining through the synergistic effect of three core technologies: automatic spatial angle fitting via laser plane alignment, workpiece coordinate system correction via kernel translation, and TCSTRANS characteristic coordinate system transformation supporting five-axis RTCP programming. This invention eliminates the need to modify the original machining program, reducing operational complexity and technical barriers, and significantly improving machining accuracy, efficiency, and process reliability. It is particularly suitable for machining precision workpieces on five-axis CNC machine tools, solving problems such as reliance on manual experience, chaotic program management, and complex post-processing in existing technologies.
[0037] Compared with the prior art, the present invention has the following advantages:
[0038] 1. High degree of automation: It realizes automatic measurement, calculation and compensation of workpiece posture without manual intervention, reducing operation complexity and technical threshold;
[0039] 2. No modification to the original program: The coordinate system is dynamically reconstructed through the kernel translation mechanism, avoiding modification of the original processing program, maintaining program standardization and reusability, and solving the problems of chaotic program management and complex post-processing;
[0040] 3. Improved machining accuracy and efficiency: Based on SVD decomposition and precise matrix operations, the attitude perception accuracy is high; the TCSTRANS characteristic coordinate system supports five-axis RTCP programming, realizing true five-axis linkage machining, improving machining efficiency and surface quality;
[0041] 4. High versatility: It can be integrated into various CNC systems and is suitable for machining precision workpieces on five-axis CNC machine tools, especially suitable for high-precision machining fields such as aerospace and precision molds. Attached Figure Description
[0042] Figure 1 A flowchart illustrating a workpiece posture error compensation method based on spatial angle and TCSTRANS provided in an embodiment of the present invention;
[0043] Figure 2 A structural block diagram of a workpiece posture error compensation system based on spatial angle and TCSTRANS provided in an embodiment of the present invention;
[0044] Figure 3 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0045] To enable those skilled in the art to better understand the technical solutions of the present invention, exemplary embodiments of the present invention are described below in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0046] Where there is no conflict, the various embodiments of the present invention and the features thereof may be combined with each other.
[0047] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.
[0048] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Terms such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.
[0049] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having the meaning consistent with their meaning in the context of the relevant art and the invention, and will not be interpreted as having an idealized or overly formal meaning unless expressly so defined herein.
[0050] In the technical solution of this invention, the collection, storage, use, processing, transmission, provision, and disclosure of user personal information all comply with relevant laws and regulations and do not violate public order and good morals. The use of user data in this technical solution follows relevant national laws and regulations (e.g., the "Information Security Technology - Personal Information Security Specification"). For example: appropriate measures are taken for personal information access control; restrictions are imposed on the display of personal information; the purpose of using personal information does not exceed the scope of direct or reasonable association; and explicit identity targeting is eliminated when using personal information to avoid precisely locating a specific individual.
[0051] To address at least one of the technical problems existing in the aforementioned related technologies, the present invention provides a workpiece posture error compensation method and system based on spatial angle and TCSTRANS.
[0052] This embodiment discloses a workpiece attitude error compensation method based on spatial angle and TCSTRANS, such as Figure 1 ,include:
[0053] S100. Perform multi-point sampling on the workpiece reference surface, automatically perform spatial plane fitting calculation, solve the rotation matrix by SVD decomposition, and then automatically fit the spatial angle by inverse solving the rotation matrix to obtain the spatial angle parameters;
[0054] In S100 of this embodiment, automatic fitting of the spatial angle is performed to obtain the spatial angle parameters. The specific steps include:
[0055] S101. Configure machine tool structure parameters and RTCP parameters, and load the preset automatic measurement program; specifically, the operator selects the "Three-Point Plane Alignment" function in the CNC system interface. To ensure measurement accuracy, the operator must first accurately fill in the machine tool structure parameters and RTCP parameters in the system based on the machine tool's RTCP (Tool Center Point Control) calibration results. This step is fundamental to ensuring accurate measurement by the laser probe in the five-axis machine tool space. In the "Three-Point Plane Alignment" function interface, the operator clicks the "Load Program" button. The system will automatically load a preset automatic measurement program that matches the current machine tool structure and probe type, eliminating the need for the user to manually write or select a measurement macro program, greatly simplifying operation and avoiding human error.
[0056] S102. Drive the probe to collect coordinate data of three non-collinear points on the workpiece reference plane; specifically, the operator presses the cycle start button. The machine tool will automatically drive the laser probe, following the path set in the preloaded program, to sequentially sample the three non-collinear points (P1, P2, P3) on the workpiece reference plane. After sampling, the probe will automatically return the coordinate values of the three points in the machine tool coordinate system to the system kernel.
[0057] S103. Combine the collected coordinate data into an original matrix A, and calculate the centroid vector of matrix A. Combined with the centroid vector of the actual workpiece position matrix B Through the covariance matrix H=A× SVD decomposition, solving for the rotation matrix R = V × U and V are orthogonal matrices;
[0058] The specific steps of S203 in this implementation include: after receiving the multi-point coordinates, combining the multiple coordinates into the original matrix A= If the matrix formed by the actual workpiece position is B, then the two matrices A and B satisfy B = R * A + T, where R is the rotation matrix and T is the translation matrix.
[0059] The centroid vector of matrix A is obtained as follows: The centroid of matrix B is According to the rotational properties of rigid bodies, then =R* Thus, through the covariance matrix The SVD decomposition solution is obtained .
[0060] Specifically, in the automatic spatial angle fitting technology of this embodiment, Singular Value Decomposition (SVD) is the core mathematical tool for solving the workpiece posture rotation matrix. Its function is to accurately extract the rotation relationship between the actual posture of the workpiece and the theoretical posture from the probe sampling data, providing a reliable basis for subsequent spatial angle (I, J, K) calculations. In this embodiment, the coordinates of three non-collinear points on the workpiece reference surface are collected by the laser probe to form the original matrix A (in the machine tool coordinate system) and the target matrix B (the ideal reference in the actual workpiece coordinate system). The core purpose of SVD decomposition is to solve for a unique rotation matrix from the linear correlation between the two matrices after eliminating translation interference. This matrix directly represents the deviation between the actual posture and the theoretical posture of the workpiece.
[0061] S104. The spatial angular direction vector (I, J, K) is calculated using the inverse kinematics formula and automatically filled into the attitude parameter field of the specified workpiece coordinate system. Specifically, the inverse kinematics formula calculates the direction vector (I, J, K) of the workpiece's spatial attitude. Subsequently, the system automatically fills this (I, J, K) vector value into the attitude parameter input field of the user-specified workpiece coordinate system (such as G54), completing the fully automated process from measurement to parameter setting.
[0062] By implementing step S100, the traditional experience-based manual measurement and complex calculation process is transformed into a standardized process that is automatically completed by the CNC system, which fundamentally improves the efficiency and accuracy of attitude perception and lays the data foundation for subsequent automated compensation.
[0063] When the S200 CNC system parses the machining program, it reads the spatial angle parameters corresponding to the workpiece coordinate system, enables the attitude correction function, and dynamically reconstructs the program instructions through the kernel translation mechanism. Without modifying the original G code, it completes the workpiece coordinate system attitude correction and obtains the corrected characteristic coordinate system TCSTRANS.
[0064] In S200 of this embodiment, the corrected characteristic coordinate system TCSTRANS is obtained. The specific steps include:
[0065] S201. The system interpreter parses the raw G-code line by line. When it parses the program line that sets the workpiece coordinate system, it obtains the corresponding spatial angle parameters. Specifically, when the user executes the machining program, the system interpreter begins to parse the raw G-code line by line. When the interpreter parses the program line that sets the workpiece coordinate system (e.g., G54), the system will actively obtain its spatial attitude parameters (I, J, K) from the parameter area corresponding to that coordinate system, and then determine whether the "spatial attitude correction" function of that coordinate system is enabled.
[0066] S202. Determine whether the attitude correction function is enabled. If enabled, start the kernel translation mechanism to dynamically insert TCSTRANS characteristic coordinate system instructions. In S202, the specific method for dynamically inserting TCSTRANS characteristic coordinate system instructions includes: if the attitude correction function is confirmed to be enabled, the interpreter will start its unique kernel translation mechanism. The mechanism will dynamically insert a TCSTRANS characteristic coordinate system instruction after the current program line without changing the original program instruction sequence, and pass the obtained spatial angle parameters to the instruction. The system kernel will calculate a spatial rotation transformation matrix from the theoretical workpiece coordinate system to the actual workpiece coordinate system in real time based on the spatial angle parameters, and store the spatial rotation transformation matrix.
[0067] Specifically, if the feature is confirmed to be enabled, the interpreter will activate its unique kernel translation mechanism. This mechanism will dynamically insert a coordinate system rotation instruction (such as a TCSTRANS feature system instruction) after the current program line without changing the original program instruction sequence, and pass the obtained (I,J,K) parameters to the instruction.
[0068] S203 calculates the spatial rotation transformation matrix from the theoretical workpiece coordinate system to the actual workpiece coordinate system based on the spatial angle parameter; the system kernel calculates a spatial rotation transformation matrix M from the theoretical workpiece coordinate system to the actual workpiece coordinate system in real time according to the (I,J,K) parameters, and stores the matrix in the channel module.
[0069] S204. All subsequent programming coordinates will be interpreted and mapped within this modified characteristic coordinate system. All subsequent programming coordinates based on this workpiece coordinate system (G54) will be interpreted and mapped within this characteristic coordinate system.
[0070] In step S200 of this invention, when the CNC system interprets the workpiece coordinate system in the machining program, it dynamically reconstructs the original G-code program at the system kernel level (e.g., superimposing TCSTRANS characteristic coordinate system instructions on the workpiece coordinate system) based on the user's settings for spatial angle correction parameters of the workpiece coordinate system, without modifying the original G-code, through a unique kernel translation process, and automatically completes the attitude correction of the workpiece coordinate system. This achieves high-precision attitude compensation with "zero modification to the original program," perfectly maintaining the standardization and reusability of the machining program, and is fundamentally different from all existing solutions that require modification of the source program.
[0071] S300. Based on the modified characteristic coordinate system TCSTRANS, the XYZ coordinates and rotation axis angles in the characteristic system are transformed into the corresponding coordinates and angles in the machine tool coordinate system, thereby realizing the control of the tool center point in five-axis linkage machining.
[0072] In S300 of this embodiment, the tool center point control in five-axis linkage machining is realized, and the specific steps include:
[0073] S301. The interpolator receives the XYZ coordinates of the tool center point in the characteristic coordinate system, transforms them into coordinates in the machine tool coordinate system through a preset matrix operation formula, and drives the linear axis to move; the expression of the matrix operation formula is: machine tool coordinates = rotation transformation matrix × characteristic coordinate system coordinates.
[0074] S302. The interpolator receives the rotation axis angle in the characteristic coordinate system, converts it into a tool vector in the characteristic coordinate system, and then converts it into a tool vector in the machine tool coordinate system through a preset matrix operation formula. The tool vector in the machine tool coordinate system is then transformed into a machine tool rotation axis angle via the source coordinate system to the target coordinate system, achieving precise synchronization between the tool direction and position. The expression of the matrix operation formula is: Machine tool coordinates = Rotation transformation matrix × Characteristic coordinate system coordinates.
[0075] Specifically, based on the modified characteristic coordinate system, the five-axis RTCP function is enabled, and efficient machining is achieved through the following two transformations:
[0076] Transformation from the characteristic coordinate system XYZ to the machine coordinate system XYZ: The interpolator receives the coordinates of the tool center point in the characteristic coordinate system, reads the rotation transformation matrix M, performs the operation "machine coordinate = M × characteristic coordinate system", converts it to coordinates in the machine coordinate system, drives the linear axis (X,Y,Z) to move, and compensates for attitude error;
[0077] Transformation from programmable rotary axis coordinates to machine tool rotary axis coordinates: The interpolator receives the tool direction (rotary axis angles A and C) in the characteristic coordinate system, first converts it into a tool vector in the characteristic coordinate system, then converts it into a tool vector in the machine tool coordinate system through matrix operations, and finally converts it into a machine tool rotary axis angle through ijk2abc, ensuring that the tool direction and position are accurately synchronized, and realizing five-axis linkage machining.
[0078] This embodiment discloses a workpiece posture error compensation method based on spatial angles and TCSTRANS. The method achieves automatic workpiece posture sensing, seamless compensation, and efficient machining through the synergistic effect of three core technologies: automatic spatial angle fitting via laser plane alignment, workpiece coordinate system correction via kernel translation, and TCSTRANS characteristic coordinate system transformation supporting five-axis RTCP programming. This invention eliminates the need to modify the original machining program, reducing operational complexity and technical barriers, and significantly improving machining accuracy, efficiency, and process reliability. It is particularly suitable for machining precision workpieces on five-axis CNC machine tools, solving problems such as reliance on manual experience, chaotic program management, and complex post-processing in existing technologies.
[0079] Based on the same inventive concept, embodiments of the present invention also provide a workpiece posture error compensation system based on spatial angles and TCSTRANS, comprising: a spatial angle fitting module, a coordinate system correction module, and a five-axis RTCP execution module; wherein:
[0080] The spatial angle fitting module is used to sample multiple points on the workpiece reference surface, automatically perform spatial plane fitting calculations, solve the rotation matrix through SVD decomposition, and then automatically fit the spatial angles by inverse solving the rotation matrix to obtain the spatial angle parameters.
[0081] The coordinate system correction module is used when the CNC system parses the machining program to read the spatial angle parameters corresponding to the workpiece coordinate system, enable the attitude correction function, and dynamically reconstruct the program instructions through the kernel translation mechanism to complete the workpiece coordinate system attitude correction without modifying the original G code, and obtain the corrected characteristic coordinate system TCSTRANS.
[0082] The five-axis RTCP execution module is used to transform the XYZ coordinates and rotation axis angles in the characteristic coordinate system into the corresponding coordinates and angles in the machine tool coordinate system based on the modified characteristic coordinate system TCSTRANS, thereby realizing the control of the tool center point in five-axis linkage machining.
[0083] The specific working methods of the space angle fitting module, coordinate system correction module and five-axis RTCP execution module have been described in the above workpiece posture error compensation method, and will not be repeated here.
[0084] Based on the same inventive concept, embodiments of the present invention also provide an electronic device. Figure 3 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. Figure 3 As shown, an embodiment of the present invention provides an electronic device including: one or more processors 101, a memory 102, and one or more I / O interfaces 103. The memory 102 stores one or more programs, which, when executed by the one or more processors, cause the one or more processors to implement any of the error compensation methods described in the above embodiments; the one or more I / O interfaces 103 are connected between the processor and the memory, configured to enable information interaction between the processor and the memory.
[0085] The processor 101 is a device with data processing capabilities, including but not limited to a central processing unit (CPU); the memory 102 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), and flash memory (FLASH); the I / O interface (read / write interface) 103 is connected between the processor 101 and the memory 102, and can realize information interaction between the processor 101 and the memory 102, including but not limited to a data bus (Bus).
[0086] In some embodiments, the processor 101, memory 102, and I / O interface 103 are interconnected via bus 104, and thus connected to other components of the computing device.
[0087] In some embodiments, the one or more processors 101 include a field-programmable gate array.
[0088] This invention also provides a computer-readable medium. The computer-readable medium stores a computer program, which, when executed by a processor, implements the steps of any of the error compensation methods described in the above embodiments. The computer-readable storage medium may be volatile or non-volatile.
[0089] This invention also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code. When the computer-readable code is run in the processor of an electronic device, the processor in the electronic device executes the above-described error compensation method.
[0090] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).
[0091] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable program instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0092] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0093] The computer program instructions used to perform the operations of this invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the computer-readable program instructions. This electronic circuitry can execute the computer-readable program instructions to implement various aspects of the invention.
[0094] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.
[0095] Various aspects of the present invention are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0096] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0097] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0098] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0099] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in conjunction with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in conjunction with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of the invention as set forth in the appended claims.
Claims
1. A workpiece attitude error compensation method based on spatial angle and TCSTRANS, characterized in that, include: S100. Perform multi-point sampling on the workpiece reference surface, automatically perform spatial plane fitting calculation, solve the rotation matrix by SVD decomposition, and then automatically fit the spatial angle by inverse solving the rotation matrix to obtain the spatial angle parameters; When the S200 CNC system parses the machining program, it reads the spatial angle parameters corresponding to the workpiece coordinate system, enables the attitude correction function, and dynamically reconstructs the program instructions through the kernel translation mechanism. Without modifying the original G code, it completes the workpiece coordinate system attitude correction and obtains the corrected characteristic coordinate system TCSTRANS. S300. Based on the modified characteristic coordinate system TCSTRANS, the XYZ coordinates and rotation axis angles in the characteristic system are transformed into the corresponding coordinates and angles in the machine tool coordinate system, thereby realizing the control of the tool center point in five-axis linkage machining.
2. The method according to claim 1, characterized in that, In S100, automatic fitting of spatial angles is achieved to obtain spatial angle parameters. The specific steps include: S101. Configure machine tool structure parameters and RTCP parameters, and load the preset automatic measurement program; S102. Drive the probe to collect coordinate data of three non-collinear points on the workpiece reference plane; S103. Combine the collected coordinate data into an original matrix A, and calculate the centroid vector of matrix A. Combined with the centroid vector of the actual workpiece position matrix B Through the covariance matrix H=A× SVD decomposition, solving for the rotation matrix R = V × U and V are orthogonal matrices; S104. Calculate the spatial angular direction vector using the inverse kinematics formula and automatically fill it into the attitude parameter items of the specified workpiece coordinate system.
3. The method according to claim 2, characterized in that, The specific steps of S103 include: after receiving the coordinates of multiple points, combining the multiple coordinates into the original matrix A= If the matrix formed by the actual workpiece position is B, then the two matrices A and B satisfy B = R * A + T, where R is the rotation matrix and T is the translation matrix. The centroid vector of matrix A is obtained as follows: The centroid of matrix B is According to the rotational properties of rigid bodies, then =R* Thus, through the covariance matrix The SVD decomposition solution is obtained .
4. The method according to claim 1, characterized in that, In S200, the corrected characteristic coordinate system TCSTRANS is obtained. The specific steps include: S201. The system interpreter parses the original G code line by line. When it parses the line of program that sets the workpiece coordinate system, it obtains the corresponding spatial angle parameters. S202. Determine whether the attitude correction function is enabled. If enabled, start the kernel translation mechanism and dynamically insert TCSTRANS feature coordinate system instructions. S203 calculates the spatial rotation transformation matrix from the theoretical workpiece coordinate system to the actual workpiece coordinate system based on spatial angle parameters; S204. Subsequent programming coordinates will be interpreted and mapped in this modified characteristic coordinate system.
5. The method according to claim 4, characterized in that, In S202, the TCSTRANS characteristic coordinate system instruction is dynamically inserted. The specific method includes: if the attitude correction function is confirmed to be enabled, the interpreter will start its unique kernel translation mechanism. The mechanism will dynamically insert a TCSTRANS characteristic coordinate system instruction after the current program line without changing the original program instruction sequence, and pass the obtained spatial angle parameters to the instruction. The system kernel calculates a spatial rotation transformation matrix from the theoretical workpiece coordinate system to the actual workpiece coordinate system in real time based on the spatial angle parameters, and stores the spatial rotation transformation matrix.
6. The method according to claim 1, characterized in that, In S300, the specific steps for controlling the tool center point in five-axis linkage machining include: S301. The interpolator receives the XYZ coordinates of the tool center point in the characteristic coordinate system, and transforms them into coordinates in the machine tool coordinate system through a preset matrix operation formula, thereby driving the linear axis to move. S302. The interpolator receives the rotation axis angle in the characteristic coordinate system, converts it into a tool vector in the characteristic coordinate system, and then converts it into a tool vector in the machine tool coordinate system through a preset matrix operation formula; the tool vector in the machine tool coordinate system is converted into the machine tool rotation axis angle through the source coordinate system to the target coordinate system, so as to achieve precise synchronization of tool direction and position.
7. The method according to claim 1, characterized in that, The expression for the matrix operation formula is: Machine tool coordinates = rotation transformation matrix × characteristic system coordinates.
8. A workpiece posture error compensation system based on spatial angle and TCSTRANS, employing any one of the methods in claims 1-7, characterized in that, include: The module includes a space angle fitting module, a coordinate system correction module, and a five-axis RTCP execution module; among which: The spatial angle fitting module is used to sample multiple points on the workpiece reference surface, automatically perform spatial plane fitting calculations, solve the rotation matrix through SVD decomposition, and then automatically fit the spatial angles by inverse solving the rotation matrix to obtain the spatial angle parameters. The coordinate system correction module is used when the CNC system parses the machining program to read the spatial angle parameters corresponding to the workpiece coordinate system, enable the attitude correction function, and dynamically reconstruct the program instructions through the kernel translation mechanism to complete the workpiece coordinate system attitude correction without modifying the original G code, and obtain the corrected characteristic coordinate system TCSTRANS. The five-axis RTCP execution module is used to transform the XYZ coordinates and rotation axis angles in the characteristic coordinate system into the corresponding coordinates and angles in the machine tool coordinate system based on the modified characteristic coordinate system TCSTRANS, thereby realizing the control of the tool center point in five-axis linkage machining.
9. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1 to 7.
10. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7.