Pitch error compensation method, system and equipment of numerical control machine tool and medium

The compensation value of pitch error of CNC machine tools is obtained through image stitching, which solves the positioning deviation problem caused by reverse gap and pitch error in the prior art, and achieves higher positioning accuracy and simplified compensation process.

CN120161789APending Publication Date: 2025-06-17SICHUAN UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510290612.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-12
Publication Date
2025-06-17

AI Technical Summary

Technical Problem

When performing commutation movements, existing CNC machine tools cause positioning deviations due to reverse clearance and pitch errors, which affects processing quality, and regularly require complex and time-consuming error compensation due to factors such as wear and thermal deformation.

Method used

By acquiring the initial scale image after error detection and collecting the scale image, image stitching is performed to obtain the pitch error compensation value, and calculating the actual position of the CNC machine tool, only the amount of pitch error changes is needed, simplifying the compensation process.

Benefits of technology

It improves the positioning accuracy and repeat positioning accuracy of CNC machine tools, reduces the cost and complexity of regular maintenance, and is suitable for small or medium- and low-end CNC machine tools.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120161789A_ABST
    Figure CN120161789A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of numerical control machine tool control, in particular to a screw pitch error compensation method, system and equipment of a numerical control machine tool and a medium. The method comprises the following steps: firstly, acquiring an initial scale image of a numerical control machine tool after error detection, and storing in a numerical control system; secondly, acquiring an acquisition scale image of an initial acquisition position according to a set visual detection interval; splicing the initial scaleplate image and the acquired scaleplate image to obtain a spliced image; and finally, calculating the actual position of the numerical control machine tool according to a screw pitch error compensation value obtained from the spliced image. And the positioning precision and the repeated positioning precision of machining of the numerical control machine tool are improved only by detecting the pitch error variable quantity in comparison with the primary measurement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of numerical control machine tool control, and specifically, to a pitch error compensation method, system, device and medium for a numerical control machine tool. Background Art

[0002] With the development of automation technology, the functions and performance of numerical control machine tools have been continuously improved, and their application scenarios cover various fields of modern industries such as automobile manufacturing, aerospace, medical equipment, and power electronics. Among them, economic numerical control machine tools occupy a large market share due to advantages such as high precision and high cost performance. Currently, such machine tools generally adopt a semi-closed-loop control structure, which measures information such as the position and speed of the motor through feedback components such as encoders, rather than directly measuring the displacement of the workbench. Therefore, it cannot effectively compensate for the errors caused by the mechanical transmission part.

[0003] In a numerical control machine tool, due to the existence of backlash between transmission chain components or kinematic pairs, the machine tool shows a deviation in the positioning of the workbench during the execution of the reversing motion, which is also called backlash or lost motion; during the manufacturing process of the lead screw, it is difficult to ensure that each pitch is equal due to the limitations of equipment accuracy and process level. The existence of backlash and pitch error will affect the positioning accuracy and repeat positioning accuracy of the machine tool, thus affecting the machining quality. Moreover, with the long-term use of the machine tool, due to factors such as wear and thermal deformation, the reverse error and pitch error of the machine tool will be aggravated. Therefore, it is necessary to regularly measure and compensate the backlash and pitch error of the numerical control machine tool.

[0004] Currently, commonly used pitch error measuring tools include laser interferometers, step gauges, microscopes, etc. The general process is as follows: 1) Select a suitable measurement starting point within the effective stroke of the machine tool lead screw; 2) Set the unit detection distance, divide the measurement axis stroke into several measurement points and write a numerical control program; 3) Start the measurement program, compare the commanded position of the measurement point with the actual position measured by the measuring device to obtain its positioning error; 4) Construct a compensation table for the measurement points and input it into the numerical control system for compensation.

[0005] The principle of backlash compensation is that after measuring the reverse position difference N of the machine tool, it is used as a compensation parameter for the numerical control system. When the machine tool performs a reverse movement, the control system first moves by the value of N and then moves according to the original command. The basic principle of pitch error compensation is the same as that of backlash. First, set the measurement points according to the compensation interval. If the actual distance between two points measured is smaller than the commanded movement distance, additional feed pulses are added in the numerical control system, and vice versa, the feed pulses are reduced.

[0006] After a period of time, due to factors such as wear, thermal deformation, and environmental factors such as temperature and humidity, the actual values of the backlash and pitch error of the CNC machine tool are different from the detected values at the time of factory shipment. Therefore, it is necessary to measure and compensate regularly. At present, professional equipment and tools are required for the measurement of these two items, and the installation and use processes are complex. For example, for commonly used laser interferometers, their usage costs are high and time-consuming, which are difficult to bear for some small or medium- and low-grade CNC machine tool manufacturers or equipment users. Summary of the Invention

[0007] In view of the problems of time-consuming and complex processes existing in the existing compensation methods, the present invention proposes a pitch error compensation method, system, equipment and medium for a CNC machine tool. The method first obtains the initial scale image of the CNC machine tool after error detection and saves it to the numerical control system. Secondly, according to the set visual detection interval, the acquired scale image at the initial acquisition position is obtained. Then, the initial scale image and the acquired scale image are spliced to obtain a spliced image. Finally, according to the pitch error compensation value obtained from the spliced image, the actual position of the CNC machine tool is calculated. Only the change amount of the pitch error compared with the initial measurement needs to be detected, which improves the positioning accuracy and repeat positioning accuracy of the CNC machine tool processing.

[0008] The specific implementation content of the present invention is as follows:

[0009] A pitch error compensation method for a CNC machine tool. First, according to the set visual detection interval, the initial scale image of the CNC machine tool after error compensation is obtained and saved to the numerical control system. Secondly, after the CNC machine tool has worked for a period of time, according to the set visual detection interval, the acquired scale image at the acquisition position is obtained. Then, the initial scale image and the acquired scale image are spliced to obtain a spliced image. Finally, according to the pitch error compensation value obtained from the spliced image, the actual position of the CNC machine tool is calculated.

[0010] To better implement the present invention, further, the pitch error compensation method for the CNC machine tool specifically includes the following steps:

[0011] Step S1: Measure the initial scale image of the CNC machine tool at the time of factory shipment to generate a pitch error compensation table and save it to the numerical control system;

[0012] Step S2: According to the set visual detection interval, obtain the acquired scale image at the visual detection point at the initial acquisition position;

[0013] Step S3: Vertically splice the initial scale image and the acquired scale image to obtain a spliced image, and obtain the change amount of the pitch error according to the spliced image;

[0014] Step S4: Perform linear interpolation processing on the change amount of the pitch error to obtain a pitch error compensation table after correcting the change amount of the error, and calculate the actual position of the CNC machine tool.

[0015] To better implement the present invention, further, step S1 specifically includes the following steps:

[0016] Step S11: Call a test device to test the numerically controlled machine tool when it leaves the factory for calibration;

[0017] Step S12: Fix a collection device on the z-axis machining axis of the numerically controlled machine tool and perform axis movement;

[0018] Step S13: Take the scale image collected after the axis movement as the reference image, generate a pitch error compensation table, and save it to the numerical control system.

[0019] To better implement the present invention, further, step S2 specifically includes the following steps:

[0020] Step S21: According to the set visual detection interval, collect the scale image in the forward direction at the visual detection point to obtain the forward-collected scale image;

[0021] Step S22: According to the set visual detection interval, collect the scale image in the reverse direction at the visual detection point to obtain the reverse-collected scale image.

[0022] To better implement the present invention, further, step S3 specifically includes the following steps:

[0023] Step S31: Vertically splice the reference image, the forward-collected scale image, and the reverse-collected scale image to obtain a spliced image;

[0024] Step S32: Determine whether there is splicing misalignment in the spliced image. If there is misalignment, calculate the change amount of the pitch error at the visual detection point, and perform interpolation calculation on the correction value at the pitch error compensation point according to the deviation amount, and obtain the corrected pitch error compensation value according to the correction value.

[0025] To better implement the present invention, further, if there is misalignment, step S4 specifically includes the following steps:

[0026] Step S41: If the pitch error compensation interval is equal to the visual detection interval, calculate the pitch error compensation value after correcting the pitch error change amount according to the compensation value of each pitch error compensation point and the pitch error change amount;

[0027] Step S42: If the pitch error compensation interval is less than the visual detection interval, call linear interpolation to calculate the correction value of the error compensation point;

[0028] Step S43: Taking the pitch error compensation origin as the base point, perform interpolation calculation at different command positions to obtain the error compensation value of the numerical control system and calculate the actual position of the numerically controlled machine tool.

[0029] To better implement the present invention, further, the specific operation of calling the linear interpolation to calculate the correction value of the error compensation point in step S42 is as follows:

[0030]

[0031] where i = 1, 2, …, n; j = 1, 2, …, m; δw i is the correction value of the error compensation point.

[0032] Based on the above-mentioned pitch error compensation method for a numerically controlled machine tool, to better implement the present invention, further, a pitch error compensation system for a numerically controlled machine tool is proposed, which is used to execute the above-mentioned pitch error compensation method for a numerically controlled machine tool; it includes an initial unit, a collection unit, a splicing unit, and a calculation unit;

[0033] The initial unit is used to obtain the initial scale image of the numerically controlled machine tool after error detection and save it to the numerical control system;

[0034] The collection unit is used to obtain the collection scale image at the initial collection position according to the set visual detection interval;

[0035] The splicing unit is used to splice the initial scale image and the collection scale image to obtain a spliced image;

[0036] The calculation unit is used to calculate the actual position of the numerically controlled machine tool according to the pitch error compensation value obtained from the spliced image.

[0037] Based on the above-mentioned pitch error compensation method for a numerically controlled machine tool, to better implement the present invention, further, an electronic device is proposed, which includes a memory and a processor; a computer program is stored on the memory; when the computer program is executed on the processor, the above-mentioned pitch error compensation method for a numerically controlled machine tool is implemented.

[0038] Based on the above-mentioned pitch error compensation method for a numerically controlled machine tool, to better implement the present invention, a computer-readable storage medium is proposed, and a computer instruction is stored on the computer-readable storage medium; when the computer instruction is executed on the above-mentioned electronic device, the above-mentioned pitch error compensation method for a numerically controlled machine tool is implemented.

[0039] The present invention has the following beneficial effects:

[0040] (1) The present invention only needs to detect the change amount of the pitch error compared with the initial measurement. Compared with high-precision measurement devices such as laser interferometers, the principle and process of the present invention are simple, the cost of regular maintenance is reduced, and it is easy to implement.

[0041] (2) The present invention comprehensively considers the influence of the backlash and pitch error of the CNC machine tool, and through reasonable measurement, compensation and adjustment, ensures the machining accuracy and stability of the machine tool. Description of the Drawings

[0042] Figure 1 It is a schematic diagram of the characteristic image and motion trajectory provided by the present invention.

[0043] Figure 2 It is a schematic diagram of image stitching provided by the present invention.

[0044] Figure 3 It is a schematic diagram of the compensation representation after correcting the change amount of the pitch error provided by the present invention.

[0045] Figure 4 It is a schematic diagram of correcting the pitch error compensation value provided by the present invention.

[0046] Figure 5 It is a schematic diagram of the detection and correction process of the pitch error change amount provided by the present invention. Detailed Embodiment

[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will combine the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. It should be understood that the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments, and should not be regarded as a limitation of the protection scope. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present invention.

[0048] In the description of the present invention, it should be noted that unless otherwise clearly defined and limited, the terms "set", "connected", and "connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can also be directly connected, or indirectly connected through an intermediate medium, and can be the communication inside two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific situations.

[0049] Embodiment 1:

[0050] This embodiment proposes a pitch error compensation method for a numerically controlled machine tool. First, according to the set visual detection interval, the initial scale image of the numerically controlled machine tool after error compensation is obtained and saved to the numerical control system. Secondly, after the numerically controlled machine tool has worked for a period of time, according to the set visual detection interval, the acquired scale image at the acquisition position is obtained. Then, the initial scale image and the acquired scale image are spliced to obtain a spliced image. Finally, according to the pitch error compensation value obtained from the spliced image, the actual position of the numerically controlled machine tool is calculated.

[0051] Working principle: This embodiment can simplify the measurement method of the backlash and pitch error of the numerically controlled machine tool. Perform an error detection using a laser interferometer or other high-precision equipment once when the equipment leaves the factory. For subsequent detections, use the "machine vision + scale" scheme, and only detect the change in pitch error compared to the initial measurement, reducing the cost of regular maintenance.

[0052] Embodiment 2:

[0053] This embodiment is described in the form of steps based on the above Embodiment 1.

[0054] Step S1: Measure the numerically controlled machine tool at the time of leaving the factory, obtain the initial scale image, generate a pitch error compensation table, and save it to the numerical control system.

[0055] The specific steps of step S1 include the following steps:

[0056] Step S11: Call the test equipment to test and calibrate the numerically controlled machine tool at the time of leaving the factory;

[0057] Step S12: Fix the acquisition device on the z-axis of the numerically controlled machine tool and perform axis movement;

[0058] Step S13: Take the scale image acquired after the axis movement as the reference image, generate a pitch error compensation table, and save it to the numerical control system.

[0059] Step S2: According to the set visual detection interval, obtain the acquired scale image at the visual detection point at the initial acquisition position.

[0060] The specific steps of step S2 include the following steps:

[0061] Step S21: According to the set visual detection interval, acquire the scale image in the forward direction at the visual detection point to obtain the forward acquired scale image;

[0062] Step S22: According to the set visual detection interval, acquire the scale image in the reverse direction at the visual detection point to obtain the reverse acquired scale image.

[0063] Step S3: Vertically splice the initial scale image and the acquired scale image to obtain a spliced image, and obtain the change in pitch error according to the spliced image.

[0064] Step S3 specifically includes the following steps:

[0065] Step S31: Vertically splice the reference image, the forward-acquired scale image, and the reverse-acquired scale image to obtain a spliced image;

[0066] Step S32: Determine whether there is splicing misalignment in the spliced image. If there is misalignment, calculate the pitch error change amount of the visual detection point, perform interpolation calculation on the correction value at the pitch error compensation point according to the deviation amount, and obtain the corrected pitch error compensation value according to the correction value.

[0067] Step S4: Perform linear interpolation processing on the pitch error change amount to obtain a pitch error compensation table after correcting the error change amount, and calculate the actual position of the numerical control machine tool.

[0068] If there is misalignment, step S4 specifically includes the following steps:

[0069] Step S41: If the pitch error compensation interval is equal to the visual detection interval, calculate the pitch error compensation value after correcting the pitch error change amount according to the compensation value of each pitch error compensation point and the pitch error change amount;

[0070] Step S42: If the pitch error compensation interval is less than the visual detection interval, call linear interpolation to calculate the correction value of the error compensation point;

[0071] The specific operation of calling linear interpolation to calculate the correction value of the error compensation point in step S42 is:

[0072]

[0073] where i = 1, 2,..., n; j = 1, 2,..., m; δw i is the correction value of the error compensation point.

[0074] Step S43: Based on the pitch error compensation origin as the base point, perform interpolation calculation at different command positions to obtain the error compensation value of the numerical control system, and calculate the actual position of the numerical control machine tool.

[0075] Working principle: In this embodiment, an error detection using a laser interferometer or other high-precision equipment is performed when the machine tool leaves the factory. After the detection results are input into the numerical control system for compensation, an industrial camera is used to capture and save the scale image designed in this solution. Assuming that the pitch error compensation interval of the numerical control system is Δps and the visual detection interval is Δpw, the following relationship should be satisfied: Δpw <= Δps. During subsequent detection and maintenance, the scale image is captured at the same position, and the change amount of the pitch error at this position is obtained by splicing the vertical lines in the photos at the same position. After linear interpolation processing, it is added to the compensation module of the numerical control system, and then a pitch error compensation table with corrected error change amount can be obtained to improve the positioning accuracy and repeat positioning accuracy of the numerical control machine tool processing.

[0076] Other parts of this embodiment are the same as those of the above Embodiment 1, so they will not be elaborated here.

[0077] Embodiment 3:

[0078] Based on any one of the above Embodiment 1 - Embodiment 2, as Figure 1 、 Figure 2 、 Figure 3 、 Figure 4 、 Figure 5 shown, a specific embodiment will be described in detail.

[0079] As Figure 1 shown is a schematic diagram of the scale and the camera shooting movement trajectory. The scale is installed on a fixed component in the working area of the machine tool, such as the machine tool base. The density of the vertical lines in the scale can be adjusted according to the visual detection interval. After the backlash and pitch error of the numerical control machine tool are measured, calibrated, and compensated by a laser interferometer or other high-precision equipment, an industrial camera is fixed at the height h of the Z-axis of the machine tool, so that the camera captures the scale image shown in Figure 1 at the visual detection point during the axis movement. After the axis moves forward or backward, a set of photos is obtained, which is used as a fixed reference for subsequent detection of the pitch error change amount and is saved to the detection system.

[0080] As Figure 2 shown, ① is the image obtained after the laser interferometer or other high-precision equipment measures, calibrates, and compensates the pitch error of the machine tool, which is used as the reference for image splicing after the machine tool has been used for a period of time. ② is the image collected in the forward direction, i.e., from left to right, after being used for a period of time. ③ is the image collected after reversing after a period of time. ④ is the enlarged image of the image splicing comparison.

[0081] When the backlash and pitch error of the machine tool change, this information will be presented through the splicing effect shown in ④. ΔL is the deviation between the image at this position and the reference image. The change in pitch error at this visual detection point can be obtained through image processing technology. After detecting the change in error at all visual detection points, linear interpolation is performed to obtain the correction value at the pitch error compensation point. As Figure 3 Shown is the schematic diagram of the compensation after correcting the change in pitch error, where m ≥ n, Δp w ≤ Δp s .

[0082] As Figure 4 shown, taking Δp w = Δp s as an example to illustrate how to correct the pitch error compensation value according to the change in pitch error:

[0083] Among them, before adding the change correction value, the compensation value of each pitch error compensation point is Δs i (i = 1, 2,... n). After the machine tool has been used for a period of time, a scale photo is taken at the compensation point and compared with the reference image at this position to obtain the change in pitch error δw i (i = 1, 2,... n). The pitch error compensation value Δi after correcting the change in pitch error can be obtained as:

[0084] Δi = Δs i + δw i

[0085] When Δp w < Δp s (m > n), the correction value of the error compensation point can be calculated by linear interpolation:

[0086]

[0087] In the formula, i = 1, 2,..., n; j = 1, 2,..., m.

[0088] Taking the pitch error compensation origin as the base point, at different command positions, the error compensation value of the numerical control system can be calculated by linear interpolation, that is, the actual position output of the numerical control system is:

[0089] P actual = P target + Δ + δ

[0090] Among them, P actual is the actual output position of the numerical control system, P target is the command position of the numerical control system, Δ is the pitch error compensation value measured by the laser interferometer, and δ is the change correction value of the pitch error.

[0091] Working principle: The existence of backlash and pitch error in CNC machine tools directly affects the positioning accuracy and repeat positioning accuracy of machine tool machining. During the actual machining process, the influences of both should be comprehensively considered, and through reasonable measurement, compensation, and adjustment, the machining accuracy and stability of the machine tool are ensured. In this embodiment, a method for detecting the change amount of pitch error and compensating pitch error is designed. The change amount of pitch error after a CNC machine tool has been used for a period of time is detected by "laser interferometer + machine vision + scale", and added to the pitch error compensation module of the numerical control system. Its measurement accuracy is related to the pixel level of the industrial camera. During the regular maintenance after the machine tool leaves the factory, compared with high-precision measurement equipment such as laser interferometers, the principle and process of this solution are simple, the cost is low, and it is easy to implement.

[0092] Other parts of this embodiment are the same as any one of the above-mentioned Embodiment 1 - Embodiment 2, so they will not be elaborated here.

[0093] Embodiment 4:

[0094] Based on any one of the above-mentioned Embodiment 1 - Embodiment 3, this embodiment proposes a pitch error compensation system for a CNC machine tool, which is used to execute the pitch error compensation method for the CNC machine tool described above; it includes an initial unit, a collection unit, a splicing unit, and a calculation unit;

[0095] The initial unit is used to obtain the initial scale image of the CNC machine tool after error detection and save it to the numerical control system;

[0096] The collection unit is used to obtain the collected scale image at the initial collection position according to the set visual detection interval;

[0097] The splicing unit is used to splice the initial scale image and the collected scale image to obtain a spliced image;

[0098] The calculation unit is used to calculate the actual position of the CNC machine tool according to the pitch error compensation value obtained from the spliced image.

[0099] This embodiment also proposes an electronic device, including a memory and a processor; a computer program is stored on the memory; when the computer program is executed on the processor, the pitch error compensation method for the CNC machine tool described above is implemented.

[0100] This embodiment also proposes a computer-readable storage medium, on which a computer instruction is stored; when the computer instruction is executed on the above-mentioned electronic device, the pitch error compensation method for the CNC machine tool described above is implemented.

[0101] Other parts of this embodiment are the same as any one of the above-mentioned Embodiment 1 - Embodiment 3, so they will not be elaborated here.

[0102] The above are only the preferred embodiments of the present invention, and do not impose any form of limitation on the present invention. Any simple modification or equivalent change made to the above embodiments based on the technical essence of the present invention shall fall within the protection scope of the present invention.

Claims

1. A pitch error compensation method for a CNC machine tool, characterized in that: Firstly, according to the set visual inspection interval, the initial scale image of the CNC machine tool after error compensation is obtained and saved to the CNC system; secondly, after the CNC machine tool has worked for a period of time, the acquisition scale image of the acquisition position is obtained according to the set visual inspection interval; then the initial scale image is spliced ​​with the acquisition scale image to obtain a spliced ​​image; finally, the actual position of the CNC machine tool is calculated according to the pitch error compensation value obtained from the spliced ​​image.

2. The pitch error compensation method for a CNC machine tool according to claim 1, characterized in that: The pitch error compensation method of the CNC machine tool specifically comprises the following steps: Step S1: according to the set visual inspection interval, the initial scale image of the CNC machine tool after error compensation is obtained, a pitch error compensation table is generated, and saved to the CNC system; Step S2: After the CNC machine tool has been working for a period of time, a scale image is acquired at a visual inspection point at an acquisition position according to a set visual inspection interval; Step S3: vertically stitching the initial scale image and the acquired scale image to obtain a stitched image, and obtaining a pitch error variation according to the stitched image; Step S4: Perform linear interpolation processing on the pitch error variation to obtain a pitch error compensation table after correcting the error variation, and calculate the actual position of the CNC machine tool.

3. The pitch error compensation method for a CNC machine tool according to claim 2, characterized in that: The step S1 specifically includes the following steps: Step S11: calling the test equipment to test and calibrate the CNC machine tool before leaving the factory; Step S12: Fixing the acquisition device on the z machining axis of the CNC machine tool and performing axis movement; Step S13: according to the set visual inspection interval, the initial scale image collected after the axis movement is used as the reference image, a pitch error compensation table is generated, and saved to the CNC system.

4. The pitch error compensation method for a CNC machine tool according to claim 2, characterized in that: The step S2 specifically includes the following steps: Step S21: According to the set visual inspection interval, a ruler image is positively collected at the visual inspection point to obtain a positively collected ruler image; Step S22: According to the set visual inspection interval, the scale image is reversely collected at the visual inspection point to obtain a reversely collected scale image.

5. The pitch error compensation method for a CNC machine tool according to claim 4, characterized in that: The step S3 specifically comprises the following steps: Step S31: vertically stitching the reference image, the forward-collected scale image, and the reverse-collected scale image to obtain a stitched image; Step S32: Determine whether there is any stitching misalignment in the stitched image. If there is any misalignment, calculate the pitch error change at the visual detection point, and interpolate and calculate the correction value at the pitch error compensation point based on the deviation, and obtain the corrected pitch error compensation value based on the correction value.

6. A pitch error compensation method for a CNC machine tool according to claim 5, characterized in that: If there is misalignment, step S4 specifically includes the following steps: Step S41: if the pitch error compensation interval is equal to the visual detection interval, the pitch error compensation value after correcting the pitch error change is calculated according to the compensation value of each pitch error compensation point and the pitch error change; Step S42: if the pitch error compensation interval is smaller than the visual detection interval, call linear interpolation to calculate the correction value of the error compensation point; Step S43: Taking the pitch error compensation origin as the base point, interpolation calculation is performed at different command positions to obtain the error compensation value of the CNC system and calculate the actual position of the CNC machine tool.

7. The pitch error compensation method for a CNC machine tool according to claim 6, characterized in that: The specific operation of calling the linear interpolation to calculate the correction value of the error compensation point in step S42 is: Where i = 1, 2, ..., n; j = 1, 2, ..., m; δw i is the correction value of the error compensation point, p si is the machine coordinate of the compensation point, p wj The machine tool coordinates of the photo taking point.

8. A pitch error compensation system for a CNC machine tool, used for executing the pitch error compensation method for a CNC machine tool as claimed in claim 1; characterized in that: It includes initial unit, acquisition unit, splicing unit and calculation unit; The initial unit is used to obtain the initial scale image of the CNC machine tool after error detection and save it to the CNC system; The acquisition unit is used to acquire an acquisition scale image at an initial acquisition position according to a set visual detection interval; The stitching unit is used to stitch the initial scale image with the acquired scale image to obtain a stitched image; The calculation unit is used to calculate the actual position of the CNC machine tool according to the pitch error compensation value obtained from the spliced ​​image.

9. An electronic device, characterized in that: It comprises a memory and a processor; a computer program is stored in the memory; when the computer program is executed on the processor, the pitch error compensation method of the CNC machine tool as described in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions; when the computer instructions are executed on the electronic device as claimed in claim 9, the pitch error compensation method for a CNC machine tool as claimed in any one of claims 1 to 7 is implemented.