Automatic tool measurement device and method for computer numerical control machine tool
The automated tool measuring device using computer vision technology solves the measurement limitations and high costs of laser tool measuring devices in the aerospace field, enabling efficient and reliable detection of tool quality and reducing the quality risks and production costs of parts.
Patent Information
- Application Number
- PCT/CN2025/114608
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-06-18
- Filing Date
- 2025-08-14
- Publication Date
- 2025-12-26
AI Technical Summary
Existing laser tool measuring devices in the aerospace field suffer from limited measurement parameters, susceptibility to harsh environments, high cost, and reliance on imports. Furthermore, the lack of domestic alternatives makes tool quality inspection difficult, impacting component quality and cost.
An automated tool measuring device based on computer vision is adopted, including a measuring camera, a detection camera, a DC power supply, a Raspberry Pi, and a supplementary lighting unit. It identifies tool anomalies through image processing and combines interactive registration and adaptive calibration strategies to achieve efficient and accurate measurement of tool parameters.
It achieves automated and low-cost tool quality inspection, reduces human intervention, improves the reliability and safety of measurement, avoids component quality problems caused by tool malfunctions, and has a competitive advantage in the market.
Smart Images

Figure PCTCN2025114608-APPB-I100001 
Figure PCTCN2025114608-APPB-I100002 
Figure PCTCN2025114608-APPB-I100003
Abstract
Description
An automatic tool measuring device and method for CNC machine tools Technical Field
[0001] This invention belongs to the field of CNC machining technology, and particularly relates to an automatic tool measuring device and method for CNC machine tools. Background Technology
[0002] In the aerospace field, CNC machining is commonly used to obtain well-designed components. The most crucial component in CNC machining is the tool itself; therefore, the quality of the tool directly affects the quality of the machined parts. Surface defects or abnormalities in the tool pose a significant quality risk to the components. Furthermore, since quality problems caused by tool defects are directly related to surface abnormalities, the tool's surface quality can be evaluated through measurement to determine whether it meets the requirements.
[0003] Tool inspection based on surface quality is currently dominated by laser tool measuring devices in the industry. However, lasers have several drawbacks, including a limited range of measurable parameters, inability to measure localized anomalies, and significant susceptibility to harsh CNC machining environments. Furthermore, in the aerospace field, these products are almost entirely imported, and are extremely expensive, costing hundreds of thousands of yuan. The long import cycle for laser tool measuring equipment and the risk of supply disruptions highlight the urgent need for domestic alternatives for CNC machining tools.
[0004] With the successful application of computer vision technology in various fields, and given the low cost of core components, it provides guiding methods and strategies for using vision to measure cutting tools. However, research on vision-based tool measurement methods is limited in the industry, and no related patent technology system has been established. Laser-based tool measurement methods have many shortcomings. Against this backdrop, developing reliable tool measurement technology using our own methods is of great significance for industry development, extending tool life during machining, reducing or avoiding component scrapping due to tool quality defects, and improving economic efficiency. Summary of the Invention
[0005] To address the shortcomings of the prior art, this invention proposes an automatic tool testing device and method for CNC machine tools, which enables automated, efficient, and accurate identification of tool abnormalities while reducing human intervention during parts processing to lower costs and meet industry development needs.
[0006] The technical solution adopted to achieve the above objectives is as follows:
[0007] An automatic tool measuring device for a CNC machine tool is characterized by comprising a measuring camera, a detection camera, a DC power supply, a Raspberry Pi, a supplementary lighting unit, and a device housing with an open top. The detection camera and the detection camera are each equipped with a dust cover. A top plate is provided at the open top of the device housing, and the top plate is rotatably connected to the device housing via a hinge. A motor for controlling the opening and closing of the top plate is also mounted on the device housing. The measuring camera is mounted on the inner wall of one side of the device housing to acquire radial images of the tool holder and the cutting tool. The detection camera is mounted on the outside of the device. The inner wall at the bottom of the housing is used to acquire the end face image of the tool from the axial direction; the supplementary lighting unit is arranged on the housing of the device and is used to supplement the light when the measuring camera and the inspection camera capture images; the Raspberry Pi is installed inside the housing of the device and is communicatively connected to the measuring camera, the inspection camera, the supplementary lighting unit and the motor device, and is used to control the automatic tool measuring device to complete the tool measuring work by communicating and interacting with the machine tool CNC system; the DC power supply is located inside the housing of the device and is electrically connected to the measuring camera, the inspection camera, the Raspberry Pi, the supplementary lighting unit and the motor device, and is used to provide working power for the entire automatic tool measuring device.
[0008] Preferably, the supplementary lighting unit includes a planar supplementary lighting component disposed on the opposite side of the measuring camera and a ring-shaped supplementary lighting component disposed centered on the detection camera, and the planar supplementary lighting component includes a planar scattering film with LED light strips laid on the planar scattering film.
[0009] Based on the above-mentioned automatic tool measuring device for CNC machine tools, this technical solution proposes an automatic tool measuring method for CNC machine tools, including tool measuring before machining and tool measuring after machining.
[0010] The pre-machining tool measurement is performed after manual or automatic tool changing on the machine tool, and includes the following steps:
[0011] S1, the machine tool CNC system sends a tool testing preparation signal to the Raspberry Pi. After receiving the tool testing preparation signal, the Raspberry Pi starts its internal main program to test the tool testing hardware function of the automatic tool testing device.
[0012] S2, Raspberry Pi uses an interactive registration method in conjunction with the machine tool CNC system to move the machine tool spindle to a pre-set measurement point in preparation for measurement;
[0013] S3, the Raspberry Pi controls the measuring camera and the detection camera to capture side images of the tool holder and the tool, as well as the end face image of the tool, and performs the first measurement of the tool parameters based on the side image and the end face image.
[0014] S4 calibrates the machine tool spindle position within the automatic tool measuring device using a pre-designed adaptive calibration strategy for the tool tip position. After completing the machine tool spindle position calibration, it acquires time-series images based on the images captured by the measuring camera. ;
[0015] S5, based on time series images Perform a second measurement of the tool parameters;
[0016] S6, evaluate the corresponding tool and tool holder parameters after tool change based on the measured parameters;
[0017] S7. Based on the evaluation results, decide whether to perform a tool change again. If yes, perform the tool change again and return to step S1. If no, the tool test before machining is completed and the CNC machine tool performs the part machining.
[0018] The post-processing tool testing: after the part is processed, repeat steps S1 to S7, and judge whether there is any abnormality in the tool based on the evaluation result of step S7. If there is no abnormality in the tool, the tool is put into storage normally; otherwise, the corresponding tool is replaced.
[0019] Preferably, in step S1, the testing of the tool testing hardware function of the automatic tool testing device includes the following steps:
[0020] S11, Configuration Activation: Activation based on The developed camera calls the test code and enables the supplementary lighting unit; by default, the ID number corresponding to the measurement camera is 0 and the ID number corresponding to the detection camera is 1. The images acquired by the measurement camera and the detection camera are then labeled with... and express;
[0021] S12, Camera and Illumination Function Test: Obtaining the current measurement space through the measuring camera and the detection camera. Images and Images, and on Images and The image quality is evaluated; if the quality evaluation result does not meet the requirements, the supplementary lighting unit, measuring camera and detection camera are restarted, and the process returns to step S11; if the quality evaluation result meets the requirements, it means that the image capture hardware function test is completed, and the measuring camera, detection camera and supplementary lighting unit are turned off, and the process proceeds to step S13.
[0022] S13, Automation Auxiliary Function Test: The Raspberry Pi control motor device opens the top panel of the device and simultaneously opens the dust covers on the measuring camera and the detection camera to prepare for the tool testing operation. During this period, if the top panel and dust covers can be opened smoothly, it indicates that the automation auxiliary function has not malfunctioned and the tool testing hardware function test is completed. If the top panel and / or dust covers cannot be opened smoothly, it indicates that the automation auxiliary function has malfunctioned. After repairing the corresponding fault, return to step S1.
[0023] Preferably, in step S12, for Images and The method for image quality assessment is as follows: evaluation is based on the random distribution differences in global pixel brightness values. The evaluation formula for a satisfactory image quality assessment result is expressed as follows: ;in, This is a function that sorts the grayscale values of pixels. This represents an image that has undergone analysis and processing. The number representing the object image. This indicates the row number of the image pixels. This indicates the number of columns for the image pixels. Indicates the distance between adjacent pixels. This indicates the pre-set brightness threshold for the percentage of pixel positions.
[0024] Preferably, in step S2, moving the machine tool spindle to a pre-set measurement point in preparation for measurement includes the following steps:
[0025] S21, the Raspberry Pi sends a readiness completion signal to the machine tool CNC system. After receiving the readiness completion signal, the machine tool CNC system controls the machine tool spindle to move to the measurement point of the automatic tool measuring device preset in the CNC system. Fixed point directly above Among them, measurement points and fixed point All are coordinate points in the machine tool coordinate system, and the measurement points The geometric center of the automatic tool measuring device;
[0026] S22, the machine tool CNC system sends an initial position signal to the Raspberry Pi. After receiving the initial position signal, the Raspberry Pi starts the measuring camera, detection camera and supplementary light unit based on the pre-set main measurement program in the Raspberry Pi.
[0027] S23, the Raspberry Pi sends a start measurement signal to the machine tool CNC system. After receiving the start measurement signal, the machine tool CNC system controls the machine tool spindle to start from the fixed point. Move down to the measurement point At the designated location, interactive registration is completed;
[0028] S24, the machine tool CNC system sends a trigger signal to the Raspberry Pi. After the Raspberry Pi receives the trigger signal, it controls the automatic tool measuring device to start the measurement work.
[0029] Preferably, in step S3, the first measurement of tool parameters based on the side image and end face image includes the following steps:
[0030] S31, the program controlling the measuring camera and the detection camera respectively reads the configuration files para1.txt and para2.txt that are stored in the Raspberry Pi memory at a predetermined location, and initializes the built-in parameters of the measuring camera and the detection camera based on the configuration files para1.txt and para2.txt to obtain clear and high-resolution images of the tool holder and tool side, image1 and tool end face, image2.
[0031] S32, for image1 and image2 respectively, a set of measurement samples consisting of a number of images is obtained, and the image1 and image2 with better quality are selected from the batch of images of the measurement samples based on a pre-set image optimization strategy;
[0032] S33, from the selected image1, complete the measurement of the non-angular parameters of the tool holder and the tool; from the selected image2, complete the detection of tool abnormalities.
[0033] Preferably, step S4, calibrating the position of the machine tool spindle within the automatic tool measuring device, includes the following steps:
[0034] S41, the Raspberry Pi sends a position calibration signal to the machine tool's CNC system. Upon receiving the signal, the CNC system controls the machine tool spindle to move an initial distance along the negative Z-axis of the machine tool coordinate system, thus changing the spindle's coordinates. value;
[0035] S42, the machine tool CNC system sends a Z-axis displacement signal to the Raspberry Pi. After receiving the Z-axis displacement signal, the Raspberry Pi starts an adaptive calibration program to calibrate the position of the machine tool spindle on the Z-axis.
[0036] S43, maintain the machine tool spindle along the coordinate system of the machine tool coordinate system. With the value unchanged, the Raspberry Pi, through communication interaction, enables the machine tool's CNC system to control the movement of the machine tool spindle, changing the X-axis and / or Y-axis coordinates of the machine tool spindle in the machine tool coordinate system, so that the distance between the tool tip and the measuring camera lens is the camera's minimum viewing distance. This means completing the machine tool spindle position calibration.
[0037] Preferably, step S42, calibrating the position of the machine tool spindle on the Z-axis, includes the following steps:
[0038] S421, Start the measuring camera to capture images and obtain image dst;
[0039] S422, Identify the Y-axis coordinates of the tool tip in image dst. coordinate values Used to represent tool features, for machine tools in captured images When the value changes, it is synchronized with the corresponding tool features in the dst image. Regarding the changes;
[0040] S423, based on coordinate values Calculate the Y-axis distance deviation between the tool tip and the geometric center of image dst. ;
[0041] S424, Determine the distance deviation value The value of the distance deviation is positive or negative; if the coordinate value of the tool tip on the Y-axis is directly above the center of the image dst, the corresponding distance deviation value is negative; if the coordinate value of the tool tip on the Y-axis is below the center of the image dst, the corresponding distance deviation value is positive.
[0042] S425, based on distance deviation value The sign of the value is used to correct the Z-axis position of the machine tool spindle in the machine tool coordinate system, that is:
[0043] If the distance deviation value A negative value indicates the coordinates of the machine tool spindle. If the value is greater than the target value, the Raspberry Pi uses communication interaction to enable the machine tool CNC system to control the machine tool spindle to move along the negative direction of the machine tool coordinate system Z axis. The single movement distance does not exceed 1 / 50 of the total length of the automatic tool measuring device.
[0044] If the distance deviation value A positive value indicates the coordinates of the machine tool spindle. If the value is less than the target value, the Raspberry Pi uses communication interaction to enable the machine tool CNC system to control the machine tool spindle to move along the positive direction of the machine tool coordinate system Z axis. The single movement distance does not exceed 1 / 100 of the total length of the automatic tool measuring device.
[0045] S426, Repeat steps S421 to S425. Through continuous communication and interaction between the Raspberry Pi and the machine tool CNC system, adaptive calibration of the tool tip position is achieved until the corresponding distance deviation value is reached. This means the calibration is complete; among them, To pre-set a distance deviation threshold.
[0046] Preferably, in step S4, a time-series image is obtained based on the image captured by the measurement camera. The method is as follows: The machine tool CNC system controls the machine tool spindle to start rotating at the lowest speed, and at the same time sends a remeasurement signal to the Raspberry Pi. After receiving the remeasurement signal, the Raspberry Pi controls the measuring camera to start capturing images. The measuring camera captures time-series images at the maximum frame rate. and time series images Save the corresponding number of images using... express.
[0047] Preferably, in step S5, based on time series images The second measurement of tool parameters includes the following steps:
[0048] S51, to obtain A time series image For each time series image to be analyzed... By selecting the region where its geometric center is distributed as the study area, we obtain... cropped image ;
[0049] S52, for cropping images Random noise in the image is filtered out.
[0050] S53, based on image capture Create a new blank image of the same size and color space as the first image, starting from the original image. The accumulation begins in the blank image, based on the principle of representing the grayscale pixel area of the tool at different angles during spindle rotation. frame The image is obtained after iteration. ;
[0051] S54, based on the same structure factor and different coordinate grayscale differences, obtains the image. The corner feature curve, composed of a series of pixels with varying curvature, is used to obtain the radius value of the corner based on the least squares fitting method. This means completing the second measurement of tool parameters.
[0052] The beneficial effects of this invention are:
[0053] This technical solution strictly limits the range of motion of the machine tool spindle during the tool testing process, ensuring that collisions and error prevention issues caused by abnormalities during the interaction process are prevented. Compared with existing methods, it demonstrates better autonomous decision-making capabilities, while also significantly improving reliability and safety.
[0054] This technical solution can not only identify whether cutting tools and tool holders meet process parameter specifications, but also identify tool defects, effectively avoiding quality problems in machined parts caused by tool abnormalities. The entire tool measuring device is inexpensive, priced far lower than similar foreign products. Furthermore, the designed device can obtain low-noise images conducive to analysis, and the measured parameters are more reliable, demonstrating a stronger competitive advantage in the market. Attached Figure Description
[0055] Figure 1 is a flowchart of an automatic tool measuring method for a CNC machine tool;
[0056] Figure 2 is a schematic diagram of an automatic tool measuring device for a CNC machine tool;
[0057] Figure 3 is a schematic diagram of the automatic tool measuring device for a CNC machine tool.
[0058] Figure 4 is a schematic diagram of the imaging range of the measuring camera.
[0059] In the picture:
[0060] 1. Measuring camera; 2. Inspection camera; 3. DC power supply; 4. Raspberry Pi; 5. Device housing; 6. Device top plate; 7. Dust cover; 8. Hinge; 9. Motor assembly; 10. Ring lighting assembly; 11. Planar lighting assembly; 11.1. Planar scattering film; 11.2. LED light strip; 12. Spindle; 13. Tool holder; 14. Tool; 15. Inner wall of the device; 16. Imaging range of the measuring camera. Embodiments of the present invention
[0061] To make the purpose, technical solution and advantages of the invention clearer, the technical solution of the invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the invention, but not all embodiments.
[0062] Therefore, the following detailed description of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0063] Example 1
[0064] This embodiment discloses an automatic tool measuring device for a CNC machine tool (hereinafter referred to as the automatic tool measuring device). As a basic implementation of this technical solution, as shown in Figure 2, it includes a measuring camera 1, a detection camera 2, a DC power supply 3, a Raspberry Pi 4, a supplementary lighting unit, and a device housing 5 with an open top. The detection camera 2 and the detection camera 3 are respectively provided with dust covers 7.
[0065] A device top plate 6 is provided at the top opening of the device housing 5. The device top plate 6 is rotatably connected to the device housing 5 via a hinge 8, and a motor device 9 for controlling the opening and closing of the device top plate 6 is also installed on the device housing 5.
[0066] The measuring camera 1 is mounted on the inner wall of one side of the device housing 5 and is used to acquire side images of the tool holder 13 and the tool 14 from the radial direction.
[0067] The inspection camera 2 is mounted on the inner wall at the bottom of the device housing 5 and is used to acquire an axial image of the end face of the tool 14.
[0068] The supplementary lighting unit is installed on the housing 5 of the device and is used to provide supplementary lighting when the measuring camera 1 and the detection camera 2 capture images.
[0069] The Raspberry Pi 4 is installed inside the device housing 5 and communicates with the measuring camera 1, the detection camera 2, the supplementary lighting unit, and the motor device 9. It is used to control the automatic tool measuring device to complete the tool measuring work by communicating and interacting with the machine tool CNC system.
[0070] The DC power supply 3 is located inside the device housing 5 and is electrically connected to the measuring camera 1, the detection camera 2, the Raspberry Pi 4, the supplementary lighting unit, and the motor device 9 to provide power for the entire automatic tool measuring device.
[0071] Based on the aforementioned hardware structure of the automatic tool measuring device, the software parameters involved in this technical solution are as follows:
[0072] The software program runs on a 64-bit Windows 7 system; the processor is an Intel(R) Xeon(R) W-22233.60GHz; the RAM is 32GB with a frequency of 3200MHz; and the hard drive capacity is 256GB. The software development platform is Visual Studio 2019; the programming language is C++; the corresponding image processing library is OpenCV 4.5.5; it is based on the Release x64 platform, with the Raspberry Pi 4 running Ubuntu 16.08; and the SDK version is 10.0.22000.0.
[0073] Example 2
[0074] This embodiment discloses an automatic tool measuring device for CNC machine tools (hereinafter referred to as automatic tool measuring device). As a preferred embodiment of this technical solution, as shown in Figure 3, it includes a measuring camera 1, a detection camera 2, a DC power supply 3, a Raspberry Pi 4, a supplementary lighting unit, and a device housing 5 with an open top. The detection camera 2 and the detection camera 3 are respectively provided with dust covers 7.
[0075] A top plate 6 is provided at the top opening of the device housing 5. The top plate 6 is rotatably connected to the device housing 5 via a hinge 8, and a motor device 9 for controlling the opening and closing of the top plate 6 is also installed on the device housing 5. A measuring camera 1 is mounted on the inner wall of one side of the device housing 5 to acquire side images of the tool holder 13 and the tool 14 radially. A detection camera 2 is mounted on the inner wall of the bottom of the device housing 5 to acquire end face images of the tool 14 axially. A supplementary lighting unit is arranged on the device housing 5 to provide supplementary lighting when the measuring camera 1 and the detection camera 2 capture images. A Raspberry Pi 4 is installed inside the device housing 5 and is communicatively connected to the measuring camera 1, the detection camera 2, the supplementary lighting unit, and the motor device 9. It is used to control the automatic tool measuring device to complete the tool measuring work by communicating with the machine tool CNC system. A DC power supply 3 is located inside the device housing 5 and is electrically connected to the measuring camera 1, the detection camera 2, the Raspberry Pi 4, the supplementary lighting unit, and the motor device 9 to provide operating power for the entire automatic tool measuring device.
[0076] More specifically, the supplementary lighting unit includes a planar supplementary lighting component 11 disposed on the opposite side of the measuring camera 1 and a ring supplementary lighting component 10 disposed centered on the detection camera 2. The planar supplementary lighting component 11 includes a planar scattering film 11.1, on which an LED light strip 11.2 is laid.
[0077] In this technical solution, the automatic knife measuring device has a length, width, and height of 30cm, meaning the outer casing 5 is a cube with a side length of 30cm. Based on this, the measuring camera 1 is located at the geometric center of the inner wall of one side of the outer casing 5. A planar supplementary lighting assembly 11 is laid on the entire surface of the outer casing 5 opposite to the measuring camera 1. Within the planar supplementary lighting assembly 11, a planar scattering film 11.1 is used to achieve uniform lighting. The DC power supply 3 is located at the bottom corner inside the outer casing 5, with a corresponding output voltage of 12V. The detection camera 2 is located at the center of the bottom surface of the outer casing 5, used to capture the image of the end face of the knife 14. The Raspberry Pi 4 is also located at the bottom corner of the outer casing 5, forming a symmetrical relationship with the DC power supply 3 at the bottom corner. A ring-shaped supplementary lighting assembly 10 is distributed around the detection camera 2, closely attached to the bottom surface inside the outer casing 5, its function being to illuminate the end face of the knife 14 so that the detection camera 2 can capture a relatively clear image.
[0078] The motor device 9 controls the opening and closing of the top plate 6. When the automatic tool measuring device is stopped, the top plate 6 is closed to prevent the entry of cutting fluid and other debris. When the automatic tool measuring device is in measurement mode, the motor device 9 keeps the top plate 6 open. The dust cover 7 on the measuring camera 1 is used to shield debris from inside the housing 5 of the device, preventing it from adhering to the camera lens and obstructing clear imaging. The dust cover 7 on the measuring camera 1 is closed when not in measurement mode and is only opened during measurement. The dust cover 7 on the inspection camera 2 is used to shield debris and cutting fluid from the machine tool spindle 12, tool holder 13, and cutting tool 14, preventing them from adhering to the lens and obstructing clear imaging. The dust cover 7 on the inspection camera 2 is closed when not in inspection mode and is only opened during inspection. The entire measuring device is rigidly connected to the machine tool. The automatic tool measuring device is installed vertically without tilt, and the connection is achieved through connecting holes.
[0079] Example 3
[0080] This embodiment discloses an automatic tool measuring method for CNC machine tools. As a preferred implementation of this technical solution, as shown in Figure 1, it includes tool measuring before machining and tool measuring after machining.
[0081] Pre-machining tool measurement begins after manual or automatic tool changing on the machine tool, and includes the following steps:
[0082] S1, the machine tool CNC system sends a tool testing preparation signal to the Raspberry Pi 4. After receiving the tool testing preparation signal, the Raspberry Pi 4 starts its internal main program to test the tool testing hardware function of the automatic tool testing device. During this period, the Raspberry Pi 4 and the machine tool CNC system transmit signal data through wireless communication.
[0083] S2, Raspberry Pi 4 uses an interactive registration method in conjunction with the machine tool CNC system to move the machine tool spindle 12 to a pre-set measurement point in preparation for measurement;
[0084] S3, Raspberry Pi 4 controls measuring camera 1 and detection camera 2 to capture side images of tool holder 13 and tool 14 and end face image of tool 14 respectively, and performs the first measurement of tool 14 parameters based on the side image and end face image.
[0085] S4, the position of the machine tool spindle 12 in the automatic tool measuring device is calibrated using a pre-designed adaptive calibration strategy for the tool tip position. After the machine tool spindle 12 position calibration is completed, a time-series image is acquired based on the image captured by the measuring camera 1. The imaging range of the image captured by camera 1 is shown in Figure 4.
[0086] S5, based on time series images Perform the second measurement of tool parameters 14;
[0087] S6, evaluate the parameters of the corresponding tool 14 and tool holder 13 after tool change based on the measurement parameters; specifically, for the measured tool holder 13 and tool 14 parameters obtained from the first measurement of tool 14 parameters and the second measurement of tool 14 parameters, based on the tool 14 and tool holder 13 numbers in the CNC machining program of the workpiece after tool change, and combined with the parameters of the corresponding numbered tool 14 and tool holder 13 in the previously existing database, a comparison judgment is made to achieve the purpose of tool measurement;
[0088] S7. Based on the evaluation results, decide whether to perform a tool change again. If yes, perform the tool change again and return to step S1. If no, the tool test before machining is completed and the CNC machine tool performs the part machining.
[0089] The post-processing tool testing: after the part is processed, steps S1 to S7 are repeated, and the tool 14 is judged to be abnormal based on the evaluation result of step S7. If the tool 14 is not abnormal, the tool 14 is put into storage normally; otherwise, the corresponding tool 14 is replaced.
[0090] Example 4
[0091] This embodiment discloses an automatic tool measuring method for CNC machine tools. As a preferred implementation of this technical solution, based on embodiment 3, step S1 of the method involves testing the tool measuring hardware function of the automatic tool measuring device, which includes the following steps:
[0092] S11, Configuration Activation: Activation based on The developed camera calls the test code and enables the supplementary lighting unit; by default, the ID number corresponding to measurement camera 1 is 0 and the ID number corresponding to detection camera 2 is 1. The images acquired by measurement camera 1 and detection camera 2 are respectively... and This means that the resulting images have the same resolution, that is, the number of rows and columns in the image are equal.
[0093] S12, Camera and lighting function test: The current measurement space is obtained through measuring camera 1 and detection camera 2. Images and Images, and on Images and The image quality is evaluated; if the quality evaluation result does not meet the requirements, the supplementary lighting unit, measuring camera 1 and detection camera 2 are restarted, and the process returns to step S11; if the quality evaluation result meets the requirements, it indicates that the image capture hardware function detection is complete, and the measuring camera 1, detection camera 2 and supplementary lighting unit are turned off, and the process proceeds to step S13.
[0094] S13, Automation Auxiliary Function Test: The Raspberry Pi 4 controls the motor device 9 to open the top plate 6 of the device, and simultaneously opens the dust cover 7 on the measuring camera 1 and the detection camera 2 to prepare for the tool testing operation; during this period, if the top plate 6 and the dust cover 7 can be opened smoothly, it indicates that the automation auxiliary function has not malfunctioned and the tool testing hardware function test is completed. If the top plate 6 and / or the dust cover 7 cannot be opened smoothly, it indicates that the automation auxiliary function has malfunctioned. After repairing the corresponding fault, return to step S1.
[0095] Example 5
[0096] This embodiment discloses an automatic tool measuring method for CNC machine tools. As a preferred implementation of this technical solution, based on embodiment 4, step S12 involves... Images and The method for image quality assessment is as follows: evaluation is based on the random distribution differences in global pixel brightness values. Specifically, the total number of evaluation marker pixels is... Divide the total number of pixels into Action and In each column, the distance between each pixel is equal. The evaluation and labeling pixels are uniformly distributed with reference to the center position of the image. Based on this, Images and The pixels distributed at the marked locations in the image are read, and sorted from smallest to largest based on the sum of the gray values of each pixel's channels. Only one-third or more of the pixel locations have a brightness value greater than a set threshold. Only if the image quality meets the requirements will the supplementary lighting unit and camera be restarted.
[0097] Therefore, the evaluation formula for a satisfactory image quality assessment result is expressed as follows: ;in, This is a function that sorts pixel grayscale values. Based on the evaluation formula, it can be determined whether the camera's image quality meets the requirements, and it can also be determined whether the supplementary lighting unit is turned on normally. This represents an image that has undergone analysis and processing. The number representing the object image. This indicates the row number of the image pixels. This indicates the number of columns for the image pixels. Indicates the distance between adjacent pixels. This indicates a pre-set brightness threshold for the percentage of pixel positions.
[0098] Example 6
[0099] This embodiment discloses an automatic tool measuring method for CNC machine tools. As a preferred implementation of this technical solution, based on embodiments 3, 4, or 5, step S2, moving the machine tool spindle 12 to a pre-set measuring point in preparation for measurement, includes the following steps:
[0100] S21, the Raspberry Pi 4 sends a readiness completion signal to the machine tool CNC system. After receiving the readiness completion signal, the machine tool CNC system controls the machine tool spindle 12 to move to the measurement point of the automatic tool measuring device preset in the CNC system. Fixed point directly above Among them, measurement points and fixed point All are coordinate points in the machine tool coordinate system, and the measurement points The geometric center of the automatic tool measuring device; more specifically, the measuring point. The geometric center of the automatic tool measuring device relative to the machine tool origin , , data;
[0101] S22, the machine tool CNC system sends an initial position signal to the Raspberry Pi 4. After receiving the initial position signal, the Raspberry Pi 4 starts the measuring camera 1, the detection camera 2 and the supplementary light unit based on the pre-set main measurement program in the Raspberry Pi 4.
[0102] S23, the Raspberry Pi 4 sends a start measurement signal to the machine tool CNC system. After receiving the start measurement signal, the machine tool CNC system controls the machine tool spindle 12 to start from the fixed point. Move down to the measurement point At the location, interactive registration is completed; for the measurement point At fixed point middle and The numerical values are the same, and the differences are only reflected in In terms of value, during the entire movement process, the machine tool spindle 12 and tool 14 do not have spatial interference with other hardware and tool measuring devices;
[0103] S24, the machine tool CNC system sends a trigger signal to the Raspberry Pi 4. After the Raspberry Pi 4 receives the trigger signal, it controls the automatic tool measuring device to start the measurement work.
[0104] Example 7
[0105] This embodiment discloses an automatic tool measurement method for CNC machine tools. As a preferred implementation of this technical solution, based on embodiments 3, 4, 5, or 6, step S3, which involves measuring the first tool 14 parameters based on side and end face images, includes the following steps:
[0106] S31, respectively control the program of measuring camera 1 and detection camera 2 to read the configuration files para1.txt and para2.txt that are stored in the memory of Raspberry Pi 4 in advance at a predetermined location, and initialize the built-in parameters of measuring camera 1 and detection camera 2 based on the configuration files para1.txt and para2.txt to obtain clear and high-resolution side image image1 of tool holder 13 and tool 14 and end face image2 of tool 14.
[0107] S32, for images image1 and image2 respectively, a set of measurement samples consisting of a number of images is obtained. Based on a pre-set image optimization strategy, images image1 and image2 with better quality are selected from the batch of images of the measurement samples respectively. The better quality specifically means that the image has less background noise, higher contrast of the tool 14 boundary, and a larger first derivative reflected in the numerical value.
[0108] S33, from the selected image1, the non-angular parameters of the tool holder 13 and the tool 14 are measured; from the selected image2, abnormal conditions of the tool 14 are detected. The non-angular parameters include parameters other than the angle value, such as the diameter and length of the tool 14, and are used to measure the parameters of the tool 14. Abnormal conditions include incorrect handling or selection of the tool 14 and the tool holder 13, which are not directly related to the parameters of the measuring camera 1 and the detection camera 2.
[0109] Example 8
[0110] This embodiment discloses an automatic tool measuring method for CNC machine tools. As a preferred implementation of this technical solution, based on embodiments 3, 4, 5, 6, or 7, step S4, calibrating the position of the machine tool spindle 12 within the automatic tool measuring device, includes the following steps:
[0111] S41, the Raspberry Pi 4 sends a position calibration signal to the machine tool CNC system. After receiving the position calibration signal, the machine tool CNC system controls the machine tool spindle 12 to move an initial distance along the negative Z-axis of the machine tool coordinate system, thus changing the coordinates of the machine tool spindle 12. value;
[0112] S42, the machine tool CNC system sends a Z-axis displacement signal to the Raspberry Pi 4. After receiving the Z-axis displacement signal, the Raspberry Pi 4 starts the adaptive calibration program to calibrate the position of the machine tool spindle 12 on the Z-axis.
[0113] S43, keep the machine tool spindle 12 aligned with the coordinates in the machine tool coordinate system. With the value unchanged, the Raspberry Pi 4, through communication interaction, enables the CNC system of the machine tool to control the movement of the machine tool spindle 12, changing the X-axis and / or Y-axis coordinates of the machine tool spindle 12 in the machine tool coordinate system, so that the distance between the end point of the tool 14 and the lens of the measuring camera 1 is the minimum viewing distance of the camera. This completes the 12-position calibration of the machine tool spindle. Among these, the minimum viewing distance... This allows the tool 14 to occupy a larger area within the image imaging range of the measuring camera 1, achieving a magnified view of the tool 14 tip while maintaining clear imaging, thus improving the measurement accuracy of the tool 14's rotation angle. During the movement, there is no spatial interference between the machine tool spindle 12 and the tool measuring device.
[0114] Example 9
[0115] This embodiment discloses an automatic tool measuring method for CNC machine tools. As a preferred implementation of this technical solution, based on embodiment 8, step S42, calibrating the position of the machine tool spindle 12 on the Z-axis, includes the following steps:
[0116] S421, Start measuring camera 1 to capture images and obtain image dst;
[0117] S422, Identify the Y-axis coordinates of the tool tip in image dst. coordinate values Used to represent tool 14 features; for changes in the machine tool's z-value in the captured image, it is synchronized to the corresponding tool 14 features in the dst image. Regarding the changes;
[0118] S423, based on coordinate values Calculate the Y-axis distance deviation between the end point of tool 14 and the geometric center of image dst. ;
[0119] S424, Determine the distance deviation value The value of the distance deviation is positive or negative; if the coordinate value of the tip of the tool 14 on the Y-axis is directly above the center of the image dst, the corresponding distance deviation value is negative; if the coordinate value of the tip of the tool 14 on the Y-axis is below the center of the image dst, the corresponding distance deviation value is positive.
[0120] S425, based on distance deviation value The sign of the value is used to correct the Z-axis position of the machine tool spindle 12 in the machine tool coordinate system, that is:
[0121] If the distance deviation value A negative value indicates the coordinates of the machine tool spindle 12. If the value is greater than the target value, the Raspberry Pi 4 uses communication interaction to enable the machine tool CNC system to control the machine tool spindle 12 to move along the negative direction of the machine tool coordinate system Z-axis. The single movement distance does not exceed 1 / 50 of the total length of the automatic tool measuring device. The height value of the movement is based on the length value as a reference and is only numerical, not directional.
[0122] If the distance deviation value A positive value indicates the coordinates of the machine tool spindle 12. If the value is less than the target value, the Raspberry Pi 4 uses communication interaction to enable the machine tool CNC system to control the machine tool spindle 12 to move along the positive direction of the machine tool coordinate system Z-axis. The single movement distance does not exceed 1 / 100 of the total length of the automatic tool measuring device. The height value of the movement is based on the length value as a reference and is only numerical, not directional.
[0123] S426, Repeat steps S421 to S425. Through continuous communication and interaction between the Raspberry Pi 4 and the machine tool CNC system, adaptive calibration of the tool tip position is achieved until the corresponding distance deviation value is reached. This means the calibration is complete; among them, To pre-set a distance deviation threshold.
[0124] In this technical solution, the designed adaptive calibration strategy only changes the calibration process. The corresponding value and Remain unchanged, and at the same time, the corresponding The value sets limits on the maximum single step size increase and decrease, ensuring collision and error prevention issues caused by anomalies during the interaction process, and effectively guaranteeing the reliability and safety of the adaptive calibration process.
[0125] Example 10
[0126] This embodiment discloses an automatic tool measuring method for CNC machine tools. As a preferred implementation of this technical solution, based on embodiments 3, 4, 5, 6, 7, 8, or 9, step S4 involves acquiring a time-series image based on the image captured by the measuring camera 1. The method is as follows: The machine tool CNC system controls the machine tool spindle 12 to start rotating at the lowest speed, and at the same time sends a remeasurement signal to the Raspberry Pi 4. After receiving the remeasurement signal, the Raspberry Pi 4 controls the measuring camera 1 to start capturing images. The measuring camera 1 captures time-series images at the maximum frame rate. and time series images Save the corresponding number of images using... express.
[0127] Example 11
[0128] This embodiment discloses an automatic tool measuring method for CNC machine tools. As a preferred implementation of this technical solution, it is based on Embodiment 10, and obtains time-series images. For the image to be analyzed, the region where the geometric center of the image is distributed is selected as the study area. The selection is based on the geometric center of the blade tip of the tool 14 in the image after adaptive calibration. This selection method can obtain a more focused region of interest, which is beneficial for feature extraction. Based on this, in step S5, based on the time series image... The second measurement of tool parameters 14 includes the following steps:
[0129] S51, to obtain Re-time series images For the image to be analyzed, for each re-time series image By selecting the region where its geometric center is distributed as the study area, we obtain... Re-capture the image The specific method for image cropping is as follows: based on a pre-marked statistical database, the coordinates of the tool tip point of each CNC machine tool 14 in the second magnified imaging image are determined, and the image is cropped accordingly. The image region in the diagram is determined by the coordinates of the corresponding region in the statistical database based on the specified tool type 14 in the CNC machining program. The cropped image is obtained from these coordinates. ;
[0130] S52, for cropping images Random noise in the image is filtered out to improve the difference between the tool 14 feature and the background;
[0131] S53, based on image capture Create a new blank image with the same size and color space as the first image, using the same dimensions as the first image. The accumulation begins in the blank image, based on the principle that the grayscale pixel area of the tool 14 represents different angles during the rotation of the spindle 12. again The image is obtained after iteration. ;
[0132] S54, based on the same structure factor and different coordinate grayscale differences, obtains the image. The corner feature curve, composed of a series of pixels with varying curvature, is used to obtain the radius value of the corner based on the least squares fitting method. This completes the second measurement of tool parameters 14. Among these, the radius... The numerical value can be compared with the database to determine whether the tool's 14-turn angle meets the requirements.
[0133] Example 12
[0134] This embodiment discloses an automatic tool measuring method for CNC machine tools. As a preferred implementation of this technical solution, the specific operation is as follows:
[0135] The first step, based on manual or automatic tool changing on the machine tool, is to begin the measurement process. The CNC system of the CNC machine tool sends a tool preparation signal to the Raspberry Pi 4 in the automatic tool measuring device, and the signal data is transmitted wirelessly.
[0136] The second step involves the Raspberry Pi 4 hardware in the automatic tool measuring device receiving the tool measuring preparation signal and activating the... The developed camera calls the test code and enables the planar fill light component 11; by default, the ID number corresponding to the measurement camera 1 is 0, and the ID number corresponding to the detection camera 2 is 1. The obtained camera images are respectively used... and This means that the resulting images have the same resolution, that is, the number of rows and columns in the image are equal.
[0137] The third step is... and The image evaluation method assesses the differences in the random distribution of global pixel brightness values, with the total number of evaluation marker pixels being [number missing]. Divide the total number of pixels into Action and In each column, the distance between each pixel is equal. The evaluation marker pixels are uniformly distributed with reference to the center position of the image. The evaluation method is as follows: and The pixels distributed at the marked locations in the image are read, and sorted from smallest to largest based on the sum of the gray values of each pixel's channels. Only one-third or more of the pixel locations have a brightness value greater than a set threshold. Only if the image quality meets the requirements will the supplementary lighting unit and cameras (measuring camera 1 and detection camera 2) be restarted. The corresponding evaluation formula can be expressed as: ;
[0138] in, The pixel grayscale values are sorted. Based on the evaluation formula, it can be determined whether the camera's image quality meets the requirements, and it can also be determined whether the supplementary lighting unit is working properly.
[0139] Fourth step: After the cameras (measuring camera 1 and detection camera 2) and the supplementary lighting unit are tested and found to be normal, turn off the cameras (measuring camera 1 and detection camera 2) and the supplementary lighting unit. Raspberry sends an open signal to the motor device 9. Based on the torque provided by the motor device 9, the top plate 6 of the device is opened. At the same time, the dust cover 7 of measuring camera 1 and the dust cover 7 of detection camera 2 are opened to prepare for the measuring knife operation.
[0140] Fifth, after the Raspberry Pi 4 receives signals from the cameras (measuring camera 1 and detection camera 2), the supplementary lighting unit, and the motor device 9 and determines that the hardware is normal, the Raspberry Pi 4 sends a preparation completion signal to the machine tool CNC system. Upon receiving the preparation completion signal, the machine tool CNC system, based on the pre-set automatic tool measuring device and the machine tool's measurement points... Measurement points The geometric center of the tool measuring device is relative to the origin of the machine tool. , , Data, move the machine tool spindle 12 to the fixed point directly above the tool measuring device. At, relative to the measurement point At fixed point middle and The numerical values are the same, and the differences are only reflected in In terms of value, the machine tool spindle 12 and tool 14 do not have spatial interference with other hardware and tool measuring devices during the entire movement process.
[0141] Step 6: The machine tool spindle 12 moves to the fixed point above the tool measuring device. Afterwards, the CNC system sends an initial positioning signal to the Raspberry Pi 4. Upon receiving the corresponding signal, the main measurement program written in the Raspberry Pi 4 is started, and the measuring camera 1, the detection camera 2, the planar fill light component 11, and the ring fill light component 10 are turned on again to prepare for the measuring tool.
[0142] Step 7: The Raspberry Pi 4 sends a start measurement signal to the machine tool's CNC system. After receiving the corresponding signal, the CNC system controls the machine tool spindle 12 to start from the fixed point. Move down to the measurement point At the location, at the fixed position above the measuring tool device With measurement point of and The values are the same, only The change is numerically reflected as a relative decrease. The corresponding cutting tool 14 and tool holder 13 have moved into the interior of the tool measuring device.
[0143] Step 8: The machine tool spindle 12 reaches the measurement point. After interactive registration is completed, the machine tool CNC system sends a trigger signal to the Raspberry Pi 4, and the Raspberry Pi 4 starts measuring after receiving the signal.
[0144] Step 9: Begin measuring the parameters corresponding to the first measurement strategy. The program controlling the measurement camera 1 reads the configuration file para1.txt, which is stored in the Raspberry Pi 4 memory at a predetermined location. Based on the configuration file, it initializes the intrinsic parameters of the measurement camera 1 (which include parameters such as brightness, gain, white balance, focus, and exposure) to obtain a clear, high-resolution image (image1) of the tool holder 13 and the tool 14. Similarly, the intrinsic parameters of the detection camera 2 are initialized based on the configuration file para1.txt to obtain an image (image2) perpendicular to the tool tip view direction.
[0145] Step 10: For the images image1 of the tool holder 13 and the tool 14 and image2 of the direction perpendicular to the tool tip view, a set of measurement samples consisting of several images is obtained. Based on the set image optimization strategy, the images with better quality are selected from the batch of images, and the measurement is performed based on the optimized images.
[0146] Step 11: From the selected image1 image, measure the non-angular parameters of the tool holder 13 and the tool 14; from the selected image2 image, detect any abnormalities in the tool 14.
[0147] Step 12: After completing the first parameter measurement, the Raspberry Pi 4 sends a signal to the machine tool indicating completion of the first measurement. Upon receiving the signal, the machine tool's CNC system changes the coordinates of spindle 12, i.e., the corresponding... , The value remains constant and decreases slowly. Value. Simultaneously, the machine tool's CNC system sends a message to the Raspberry Pi 4. When the value of the signal changes, the Raspberry Pi 4 receives the signal and initiates the adaptive calibration program.
[0148] 1) Activate the image capture function of measuring camera 1 and identify the coordinate values of the tool tip point in image dst. For the machine tool in the captured image Value changes are reflected in the image Changes in value;
[0149] 2) Calculation The distance deviation between the value and the center of the image dst ,like If the value is located above the center of the image dst, the corresponding deviation value is negative. A value located below the center of the image dst corresponds to a positive deviation value;
[0150] 3) Determine the distance deviation value The value is positive or negative; if the corresponding value is negative, the Raspberry Pi 4 sends a decrease feedback to the machine tool CNC system. Not enough value The value needs to be further reduced. The value decreases by more than 1 / 50 of the total length of the device in a single step during the decreasing process;
[0151] 4) Determine the distance deviation value The sign of the value indicates whether the corresponding value is positive or negative. If the value is positive, the Raspberry Pi 4 sends a decrease in feedback to the CNC system of the machine tool. Values are excessive. The value needs to be increased. During the increase of the value, the single increase step size exceeds 1 / 100 of the total length of the device;
[0152] 5) Through continuous communication and interaction between the Raspberry Pi 4 and the machine tool, adaptive calibration of the tool tip position is achieved until the corresponding... Approaching 0, because Since it is an integer, a threshold is set. ,make satisfy Stop calibration when the relationship is established.
[0153] The designed adaptive calibration strategy only changes the calibration process. The corresponding value and Remain unchanged, and at the same time, the corresponding The value sets limits on the maximum single step size increase and decrease, ensuring collision and error prevention issues caused by anomalies during the interaction process, and effectively guaranteeing the reliability and safety of the adaptive calibration process.
[0154] Step 13, completed using an adaptive approach. After value calibration, maintain The value remains unchanged based on the setting of a fixed value. and The value is such that the distance between the tip of the knife and the lens of measuring camera 1 is the minimum line-of-sight of the camera. minimum sight distance This allows the tool 14 to occupy a larger area within the image imaging range of the measuring camera 1, achieving a magnified view of the tool 14 tip while maintaining clear imaging, thus improving the measurement accuracy of the tool 14's rotation angle. Furthermore, there is no spatial interference between the machine tool spindle 12 and the tool measuring device during the movement process.
[0155] Step fourteen: After completing the position calibration, the machine tool CNC system sends a measurement signal to the Raspberry Pi 4. When the Raspberry Pi 4 receives the corresponding measurement signal, the measuring camera 1 begins to capture images. At the same time, the machine tool CNC system controls the spindle 12 to start rotating at the lowest speed, and the measuring camera 1 captures images at the maximum frame rate and processes the time-series images. Save the corresponding number of images using... express.
[0156] Step 15, to obtain the time series image. For the image to be analyzed, the region where the geometric center of the image is distributed is selected as the study area. The selection is based on the geometric center of the tool tip of tool 14 in the image after adaptive calibration. This selection method can obtain a more focused region of interest, which is beneficial for feature extraction. The selection method is as follows: based on the pre-labeled statistical database, the regional coordinates of the tool tip point of each CNC machine tool 14 in the second magnified image are determined, and the image is selected by selection. The image region in the diagram. Specifically, the coordinates of the corresponding region in the statistical database are determined based on the specified tool type (14) in the CNC machining program, and the cropped image is obtained from these coordinates. .
[0157] Step 16: Design a filtering method to remove cropped images. Random noise in the tool 14 is used to improve the difference between the tool 14 features and the background.
[0158] Step 17, based on the captured image Create a new blank image of the same size and color space. From the first captured image Start at The accumulation begins in the middle, and the principle of accumulation is to represent the grayscale pixel area of the tool 14 at different angles when the spindle 12 rotates. again After iteration image.
[0159] Step 18: Obtain images using different methods based on the polar coordinate grayscale differences of the same structural factor. The radius of the corner can be obtained from the corner feature curve composed of a series of pixels with different curvatures, based on the least squares fitting method. Numerical value, radius By comparing the numerical values with the database, it can be determined whether the tool's 14-degree rotation angle meets the requirements. The radius is then obtained. After obtaining the numerical values, the second parameter measurement step is completed. The radius is then calculated based on the obtained pixel values. The fitting formulas are:
[0160] ;
[0161] In the equation of a circle , , Since it is an unknown quantity, further calculations are needed. Transforming the expression yields:
[0162] ;
[0163] Further , , The equation of the circle can be rearranged as follows:
[0164] ;
[0165] in Using the coordinates of the center of the circle, solve for... , , The equation of the circle can be obtained by numerical calculation. The points on the line segment relating the points on the circle to the center form the set of points on the circle. , The value of represents the number of points on the line segment. The difference between the square of the distance from any point on the line segment to the center and the square of the radius can be expressed as:
[0166] ;
[0167] This is expressed as: tangent length The square of the distance is equal to the distance from the point of tangency to the center of the circle. square minus radius The square of . Solving the expression will give the result. , , The numerical value can then be used to determine the turning angle. Numerical value.
[0168] Step 19: For the parameters of the tool holder 13 and the tool 14 obtained in the first and second measurements, the tool holder 13 and the corresponding tool number in the CNC machining program of the workpiece after tool change are compared and judged in combination with the parameters of the corresponding tool holder 14 and the corresponding tool number in the previously existing database to achieve the purpose of tool measurement.
[0169] Step 20: After judging the parameters of the tool test, determine whether the tool needs to be changed or processed based on whether the parameters meet the requirements. If the parameters of the tool test meet the requirements, the spindle 12 of the machine tool is reset and the predetermined part processing is completed based on the designed CNC program. If the corresponding tool test parameters do not meet the requirements, the tool holder 13, the cutting tool 14, or the tool holder 13 plus the cutting tool 14 are replaced. After the replacement is completed, the tool test step is completed again based on the tool test step before processing described above.
[0170] Furthermore, in order to further prevent economic losses caused by the scrapping of processed parts due to defects or abnormalities of the tool 14 during the parts processing, a tool testing step at an interval can be set according to the actual needs. That is, during the parts processing, the tool 14 is periodically tested and judged for defects by the designed device to reduce processing abnormalities caused by defects of the tool 14.
[0171] Step 21: After the corresponding parts are processed according to the established procedure, the tool 14 that has been put into storage needs to be further judged to see if there are any abnormalities or defects. This is called post-processing tool testing in this invention. The corresponding steps from "tool testing hardware function detection" to "parameter judgment and evaluation method" are the same as those for pre-processing tool testing.
[0172] Furthermore, after the tool testing is completed, the "parameter judgment and evaluation method" requires another evaluation of whether there is any abnormality in tool 14. If tool 14 is abnormal, it needs to be replaced. If tool 14 is not abnormal, it can be put into storage normally. Based on this, the entire tool testing process is completed.
[0173] The entire measurement process must be documented, including the total usage time of the corresponding tool 14, the type and grade of the defective tool 14, the number of times the tool 14 was used, and the measurement time, in order to meet the needs of targeted improvement of the machining process of parts or the selection of the optimal tool 14.
[0174] After the measurement is completed, the machine tool CNC system sends a measurement completion command to the Raspberry Pi 4. Upon receiving the signal, the Raspberry Pi 4 activates the supplementary lighting unit and sends a camera shutdown command. After completing the corresponding hardware shutdown, the Raspberry Pi 4 sends a command to the motor device 9 to close the top plate 6 of the device, and simultaneously closes the dust covers 7 of both the measuring camera 1 and the detection camera 2. Finally, the Raspberry Pi 4 shuts down all peripherals, retaining only the most basic function of communicating with the machine tool CNC system, so that the entire measuring device can be restarted promptly if needed for subsequent measurements to complete the tool measurement purpose.
Claims
1. An automatic tool measuring method for a CNC machine tool, characterized in that, An automatic tool measuring device for a CNC machine tool is used for tool measuring before and after machining; wherein, the automatic tool measuring device includes a measuring camera (1), a detection camera (2), a DC power supply (3), a Raspberry Pi (4), a supplementary lighting unit, and a device housing (5) with an open top, and dust covers (7) are respectively provided on the detection camera (2). The device housing (5) has a device top plate (6) at the top opening. The device top plate (6) is rotatably connected to the device housing (5) via a hinge (8). The device housing (5) is also equipped with a motor device (9) for controlling the opening and closing of the device top plate (6). The measuring camera (1) is mounted on the inner wall of one side of the device housing (5) for acquiring side images of the tool holder (13) and the tool (14) from the radial direction; The detection camera (2) is mounted on the inner wall of the bottom of the device housing (5) and is used to acquire an image of the end face of the tool (14) from the axial direction. The supplementary lighting unit is arranged on the device housing (5) and is used to provide supplementary lighting when the measuring camera (1) and the detection camera (2) capture images; The Raspberry Pi (4) is installed inside the device housing (5) and is connected to the measuring camera (1), the detection camera (2), the supplementary lighting unit and the motor device (9) for communication interaction with the machine tool CNC system to control the automatic tool measuring device to complete the tool measuring work; The DC power supply (3) is located inside the device housing (5) and is electrically connected to the measuring camera (1), the detection camera (2), the Raspberry Pi (4), the supplementary lighting unit and the motor device (9) to provide working power for the entire automatic knife measuring device; The pre-processing tool measurement is performed after manual or automatic tool changing on the machine tool, and includes the following steps: S1, the machine tool CNC system sends a tool preparation signal to the Raspberry Pi (4). After receiving the tool preparation signal, the Raspberry Pi (4) starts its internal main program to test the tool testing hardware function of the automatic tool testing device. S2, Raspberry Pi (4) uses an interactive registration method in conjunction with the machine tool CNC system to move the machine tool spindle (12) to a pre-set measurement point to prepare for measurement; S3, Raspberry Pi (4) controls the measuring camera (1) and the detection camera (2) to capture the side images of the tool holder (13) and the tool (14) and the end face image of the tool (14) respectively, and to measure the parameters of the tool (14) for the first time based on the side image and the end face image; S4, the position of the machine tool spindle (12) in the automatic tool measuring device is calibrated by a pre-designed tool tip position adaptive calibration strategy, and after the position calibration of the machine tool spindle (12) is completed, a time series image is acquired based on the image captured by the measuring camera (1). Among them, acquiring time series images The method is as follows: the machine tool CNC system controls the machine tool spindle (12) to start rotating at the lowest speed, and at the same time sends a remeasurement signal to the Raspberry Pi (4). After receiving the remeasurement signal, the Raspberry Pi (4) controls the measuring camera (1) to start capturing images. The measuring camera (1) captures time series images at the maximum frame rate. and time series images Save the corresponding number of images using... express; S5, based on time series images The second measurement of the tool (14) parameters includes the following steps: S51, to obtain A time series image For each time series image to be analyzed... By selecting the region where its geometric center is distributed as the study area, we obtain... cropped image ; S52, for cropping images Random noise in the image is filtered out. S53, based on image capture Create a new blank image of the same size and color space as the first image, starting from the original image. The accumulation begins in the blank image, and the principle of accumulation is the representation area of grayscale pixels of the tool (14) at different angles when the main axis (12) rotates. width The image is obtained after iteration. ; S54, based on the same structure factor and different coordinate grayscale differences, obtains the image. The corner feature curve, composed of a series of pixels with varying curvature, is used to obtain the radius value of the corner based on the least squares fitting method. That is, to complete the second measurement of the tool (14) parameters; S6, evaluate the parameters of the corresponding tool (14) and tool holder (13) after tool change based on the measurement parameters; S7. Based on the evaluation results, decide whether to perform a tool change again. If yes, perform the tool change again and return to step S1. If no, the tool test before machining is completed and the CNC machine tool performs the part machining. The post-processing tool testing: after the part processing is completed, repeat steps S1 to S7, and judge whether the tool (14) is abnormal based on the evaluation result of step S7. If the tool (14) is not abnormal, the tool (14) is put into storage normally; otherwise, the corresponding tool (14) is replaced.
2. The automatic tool measuring method for a CNC machine tool as described in claim 1, characterized in that: The automatic knife measuring device includes a planar light-filling component (11) located on the opposite side of the measuring camera (1) and an annular light-filling component (10) located centered on the detection camera (2). The planar light-filling component (11) includes a planar scattering film (11.1) and an LED light strip (11.2) is laid on the planar scattering film (11.1).
3. The automatic tool measuring method for a CNC machine tool as described in claim 1, characterized in that, In step S1, the detection of the tool testing hardware function of the automatic tool testing device includes the following steps: S11, Configuration Activation: Activation based on The developed camera calls the test code and enables the supplementary lighting unit; by default, the ID number corresponding to the measurement camera (1) is 0 and the ID number corresponding to the detection camera (2) is 1. Let the images obtained by the measurement camera (1) and the detection camera (2) be respectively... and express; S12, Camera and lighting function test: The current measurement space is obtained by measuring camera (1) and detecting camera (2). Images and Images, and on Images and The image quality is evaluated; if the quality evaluation result does not meet the requirements, the supplementary lighting unit, measurement camera (1) and detection camera (2) are restarted, and then the process returns to step S11; if the quality evaluation result meets the requirements, it means that the image capture hardware function detection is completed, and the measurement camera (1), detection camera (2) and supplementary lighting unit are turned off, and then the process proceeds to step S13. S13, Automation Auxiliary Function Test: The Raspberry Pi (4) controls the motor device (9) to open the top plate (6) of the device, and at the same time open the dust cover (7) on the measuring camera (1) and the detection camera (2) to prepare for the test tool operation; during this period, if the top plate (6) and the dust cover (7) can be opened smoothly, it indicates that the automation auxiliary function has not failed and the test tool hardware function test is completed. If the top plate (6) and / or the dust cover (7) cannot be opened smoothly, it indicates that the automation auxiliary function has failed. After repairing the corresponding failure, return to step S1.
4. The automatic tool measuring method for a CNC machine tool as described in claim 3, characterized in that, In step S12, for Images and The method for image quality assessment is as follows: evaluation is based on the random distribution differences in global pixel brightness values. The evaluation formula for a satisfactory image quality assessment result is expressed as follows: ;in, This is a function that sorts the grayscale values of pixels. This represents an image that has undergone analysis and processing. The number representing the object image. This indicates the row number of the image pixels. This indicates the number of columns for the image pixels. Indicates the distance between adjacent pixels. This indicates a pre-set brightness threshold for the percentage of pixel positions.
5. The automatic tool measuring method for a CNC machine tool as described in claim 1, characterized in that, In step S2, moving the machine tool spindle (12) to a pre-set measurement point to prepare for measurement includes the following steps: S21, Raspberry Pi (4) sends a ready-to-complete signal to the machine tool CNC system. After receiving the ready-to-complete signal, the machine tool CNC system controls the machine tool spindle (12) to move to the measurement point of the automatic tool measuring device preset in the CNC system. Fixed point directly above Among them, measurement points and fixed point All are coordinate points in the machine tool coordinate system, and the measurement points The geometric center of the automatic tool measuring device; S22, the machine tool CNC system sends an initial position signal to the Raspberry Pi (4). After receiving the initial position signal, the Raspberry Pi (4) starts the measuring camera (1), the detection camera (2) and the supplementary light unit based on the main measurement program preset in the Raspberry Pi (4). S23, the Raspberry Pi (4) sends a start measurement signal to the machine tool CNC system. After receiving the start measurement signal, the machine tool CNC system controls the machine tool spindle (12) to move from the fixed point. Move down to the measurement point At the designated location, interactive registration is completed; S24, the machine tool CNC system sends a trigger signal to the Raspberry Pi (4). After the Raspberry Pi (4) receives the trigger signal, it controls the automatic tool measuring device to start the measurement work.
6. The automatic tool measuring method for a CNC machine tool as described in claim 1, characterized in that, In step S3, the first measurement of the tool (14) parameters based on the side image and end face image includes the following steps: S31, the program controlling the measuring camera (1) and the detection camera (2) respectively reads the configuration files para1.txt and para2.txt stored in the memory of the Raspberry Pi (4) in advance at the agreed location, and initializes the built-in parameters of the measuring camera (1) and the detection camera (2) based on the configuration files para1.txt and para2.txt, so as to obtain clear and high-resolution images of the side of the tool holder (13) and the tool (14) image1 and the end face of the tool (14) image2; S32, for image1 and image2 respectively, a set of measurement samples consisting of a number of images is obtained, and the image1 and image2 with better quality are selected from the batch of images of the measurement samples based on a pre-set image optimization strategy; S33, from the preferred image1, complete the measurement of the non-angular parameters of the tool holder (13) and the tool (14); from the preferred image2, complete the detection of abnormal conditions of the tool (14).
7. The automatic tool measuring method for a CNC machine tool according to claim 1, characterized in that, In step S4, calibrating the position of the machine tool spindle (12) in the automatic tool measuring device includes the following steps: S41, the Raspberry Pi (4) sends a position calibration signal to the machine tool CNC system. After receiving the position calibration signal, the machine tool CNC system controls the machine tool spindle (12) to move an initial distance along the negative Z-axis of the machine tool coordinate system, thereby changing the coordinates of the machine tool spindle (12). value; S42, the machine tool CNC system sends a Z-axis displacement signal to the Raspberry Pi (4). After receiving the Z-axis displacement signal, the Raspberry Pi (4) starts an adaptive calibration program to calibrate the position of the machine tool spindle (12) on the Z-axis. S43, keep the machine tool spindle (12) aligned with the coordinates of the machine tool coordinate system. With the value unchanged, the Raspberry Pi (4) uses communication interaction to enable the CNC system of the machine tool to control the movement of the machine tool spindle (12), changing the X-axis and / or Y-axis coordinates of the machine tool spindle (12) in the machine tool coordinate system, so that the distance between the end point of the tool (14) and the lens of the measuring camera (1) is the minimum viewing distance of the camera. This means completing the position calibration of the machine tool spindle (12).
8. The automatic tool measuring method for a CNC machine tool according to claim 7, characterized in that, In step S42, calibrating the position of the machine tool spindle (12) on the Z-axis includes the following steps: S421, Start the measuring camera (1) to capture images and obtain image dst; S422, Identify the coordinates of the tool (14) endpoint on the Y-axis in image dst. coordinate values Used to represent the features of the cutting tool (14), for the machine tool in the captured image When the value changes, it is synchronized to the corresponding tool (14) feature in the dst image. Regarding the changes; S423, based on coordinate values Calculate the Y-axis distance deviation between the end point of the tool (14) and the geometric center of the image dst. ; S424, Determine the distance deviation value The positive and negative values; if the coordinate value of the end point of the tool (14) on the Y-axis is directly above the center of the image dst, the corresponding distance deviation value is negative; if the coordinate value of the tip of the tool (14) on the Y-axis is below the center of the image dst, the corresponding distance deviation value is positive. S425, based on distance deviation value The sign of the positive or negative value is used to correct the Z-axis position of the machine tool spindle (12) in the machine tool coordinate system, that is: If the distance deviation value A negative value indicates the coordinates of the machine tool spindle (12). If the value is greater than the target value, the Raspberry Pi (4) uses communication interaction to enable the machine tool CNC system to control the machine tool spindle (12) to move along the negative direction of the machine tool coordinate system Z axis. The single movement distance does not exceed 1 / 50 of the total length of the automatic tool measuring device. If the distance deviation value A positive value indicates the coordinates of the machine tool spindle (12). If the value is less than the target value, the Raspberry Pi (4) uses communication interaction to enable the machine tool CNC system to control the machine tool spindle (12) to move along the positive direction of the Z-axis of the machine tool coordinate system. The single movement distance does not exceed 1 / 100 of the total length of the automatic tool measuring device. S426, repeat steps S421 to S425. In this way, through continuous communication and interaction between the Raspberry Pi (4) and the machine tool CNC system, the adaptive calibration of the tool tip position is achieved until the corresponding distance deviation value is reached. This means the calibration is complete; among them, To pre-set a distance deviation threshold.
Citation Information
Patent Citations
Method and device for automatically setting tool correction value of machine tool
CN105598743A
Automatic tool measuring device and method for numerical control machining tool
CN118372086A
Cutter parameter measurement device based on CCD
CN205497128U
Procedure and device to measure the contours of an object
EP0403908A2
Recyclable garbage collecting truck with open and closing
KR102240431B1