Automatic tool measuring device and method for numerical control machine tool
By integrating the measurement camera, inspection camera and automatic tool measuring device controlled by Raspberry Pi on the CNC machining machine tool, the shortcomings of the laser tool measuring device are solved, and efficient and accurate detection of CNC machining tools is achieved, reducing costs and improving efficiency. Parts quality.
Patent Information
- Application Number
- CN202410781193.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-06-18
AI Technical Summary
Existing laser tool measuring devices in the aerospace field have problems such as limited measurement parameters, inability to measure local anomalies, large environmental impact, high price, and difficulty in domestic substitution, resulting in insufficient accuracy and reliability in quality inspection of CNC machining tools.
An automatic tool measuring device for CNC machining tools is designed. It uses a measurement camera and an inspection camera combined with Raspberry Pi control. Through interactive registration and adaptive calibration strategies, it can capture and analyze the image of the tool side and end face, and identify the tool. anomalies and perform automated detection.
It achieves efficient and accurate identification of cutting tools, reduces human intervention, reduces costs, improves the processing quality and economic benefits of parts, and has stronger market competitiveness.
Smart Images

Figure CN118372086B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of numerical control machining, and in particular relates to an automatic tool measuring device and method for a numerical control machining machine tool. Background Art
[0002] In the aerospace industry, CNC machining is often used to produce well-designed parts. The core component of CNC machining tools is the cutting tool, so the quality of the cutting tool directly affects the quality of the machined part. Surface defects or anomalies in the cutting tool pose a significant risk to the quality of the part. Furthermore, since quality issues caused by tool defects are directly related to surface anomalies, surface quality evaluation can be used to measure the tool to determine whether it meets the requirements.
[0003] Laser tool measuring devices are currently the mainstream product in the industry for surface quality-based tool inspection. However, lasers have major limitations, including limited measurable parameters, an inability to detect local anomalies, and significant susceptibility to harsh CNC machining environments. Furthermore, in the aerospace sector, these products are almost entirely imported, costing hundreds of thousands of yuan. The import cycle for laser tool measuring equipment is long, and there's a risk of supply disruption. Consequently, domestically produced CNC machining tools are urgently needed.
[0004] With the successful application of computer vision technology in various fields, and the advantages of low-cost core components, it has provided guiding methods and strategies for using visual methods to measure tools. However, visual tool measurement methods are relatively understudied in the industry, and no relevant patent technology system has been established. Laser tool measurement methods also have many shortcomings. Against this backdrop, establishing reliable tool measurement technology is of great significance to the development of the industry, increasing tool life during machining, reducing or avoiding component scrapping due to tool quality abnormalities, and improving economic benefits. Summary of the Invention
[0005] In response to the above-mentioned deficiencies in the prior art, the present invention proposes an automatic tool measuring device and method for CNC machine tools, which can realize the automatic, efficient and accurate identification of tool abnormalities, while reducing human intervention in the part processing process to achieve the purpose of reducing costs and meet the needs of industry development.
[0006] The technical solutions adopted to achieve the above objectives are as follows:
[0007] An automatic tool measuring device for a CNC machine tool, characterized in that it includes a measuring camera, a detection camera, a DC power supply, a Raspberry Pi, a fill light unit, and a device housing with an open top, wherein the detection camera and the detection camera are respectively provided with dust covers; a device top plate is provided at the top opening of the device housing, the device top plate is rotatably connected to the device housing via a hinge, and a motor device for controlling the opening and closing of the device top plate is also installed on the device housing; the measuring camera is installed on the inner wall of one side of the device housing and is used to obtain a side image of the tool handle and the tool from a radial direction; the detection camera is installed outside the device The inner wall of the bottom of the shell is used to obtain the end face image of the tool from the axial direction; the fill light unit is arranged on the device housing and is used to fill light when the measuring camera and the detection camera capture images; the Raspberry Pi is installed inside the device housing and is communicated with the measuring camera, the detection camera, the fill light 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 arranged inside the device housing and is electrically connected with the measuring camera, the detection camera, the Raspberry Pi, the fill light unit and the motor device, and is used to provide working power for the entire automatic tool measuring device.
[0008] Preferably, the fill light unit includes a planar fill light component arranged on the opposite side of the measuring camera and an annular fill light component arranged with the detection camera as the center, and the planar fill light component includes a planar scattering film, on which an LED light strip is laid.
[0009] Based on the above-mentioned automatic tool measuring device for CNC machining machines, this technical solution proposes an automatic tool measuring method for CNC machining machines, including tool measuring before machining and tool measuring after machining.
[0010] The tool measurement before machining is to start the tool measurement work after manual or automatic tool change of the machine tool, and includes the following steps:
[0011] S1: The CNC system of the machine tool sends a tool measuring preparation signal to the Raspberry Pi. After receiving the tool measuring preparation signal, the Raspberry Pi starts its internal main program to test the tool measuring hardware function of the automatic tool measuring device.
[0012] In S2, the Raspberry Pi cooperates with the machine tool CNC system based on the interactive registration method to move the machine tool spindle to the pre-set measurement point to prepare for measurement;
[0013] In step S3, the Raspberry Pi controls the measuring camera and the inspection camera to capture the side images of the tool holder and tool, as well as the end face image of the tool, and performs the first tool parameter measurement based on the side images and the end face images.
[0014] S4, calibrates the spindle position of the machine tool in the automatic tool measuring device through the pre-designed tool tip position adaptive calibration strategy, and obtains time series images based on the images captured by the measurement camera after the spindle position calibration is completed ;
[0015] S5, based on time series images Carry out the second measurement of tool parameters;
[0016] S6, evaluating the corresponding tool and tool holder parameters after the tool change based on the measurement parameters;
[0017] S7, based on the evaluation result, decide whether to perform a tool re-change process; if so, the tool is re-changed and the process returns to step S1; if not, the tool probing work before machining is completed and the CNC machine tool performs part machining;
[0018] The post-processing tool measurement: after the part processing is completed, steps S1 to S7 are repeated, and based on the evaluation result of step S7, whether the tool is abnormal is judged. If the tool is normal, the tool is put into storage normally, otherwise the corresponding tool is replaced.
[0019] Preferably, in step S1, detecting the tool measuring hardware function of the automatic tool measuring device includes the following steps:
[0020] S11, Configuration Activation: Activation based on The developed camera calls the test code and turns on the fill light unit; the default ID number corresponding to the measurement camera is 0, and the ID number corresponding to the detection camera is 1. The images obtained by the measurement camera and the detection camera are used respectively. and express;
[0021] S12, camera and fill light function test: Get the current measurement space through the measurement camera and detection camera Image and Image, and Image and The image quality is evaluated; if the quality evaluation result does not meet the requirements, the fill light unit, the measuring camera, and the detection camera are turned on again, and the process returns to step S11; if the quality evaluation result meets the requirements, the image capture hardware function test is completed, and the measuring camera, the detection camera, and the fill light unit are turned off, and the process proceeds to step S13;
[0022] S13, automated auxiliary function test: The Raspberry Pi controls the motor device to open the top plate of the device and simultaneously open the dust covers on the measuring camera and the detection camera to prepare for the tool measuring operation. During this period, if the top plate and the dust cover can be opened smoothly, it indicates that the automated auxiliary function has not failed and the tool measuring hardware function test is completed. If the top plate and / or the dust cover of the device cannot be opened smoothly, it indicates that the automated auxiliary function has failed. After the corresponding fault is repaired, the process returns to step S1.
[0023] Preferably, in step S12, Image and The method for image quality evaluation is to evaluate the difference in the random distribution of global pixel brightness. The evaluation formula for image quality evaluation results that meet the requirements is expressed as ;in, is a function for sorting pixel gray values. Represents an image with analytical processing; Indicates the number of the object image, Indicates the number of rows of image pixels, Indicates the number of columns of image pixels, Represents the distance between adjacent pixels. Indicates the preset pixel position ratio brightness threshold.
[0024] Preferably, in step S2, moving the machine tool spindle to a preset measuring point to prepare for measurement includes the following steps:
[0025] S21, the Raspberry Pi sends a ready signal to the CNC system of the machine tool. After receiving the ready signal, the CNC system controls the machine tool spindle to move to the measurement point of the automatic tool measuring device pre-set in the CNC system. The fixed point directly above ; Among them, the measurement point and fixed points are all coordinate points in the machine tool coordinate system, and the measurement points It is the geometric center of the automatic tool measuring device;
[0026] S22, the CNC system of the machine tool sends a preliminary arrival signal to the Raspberry Pi. After receiving the preliminary arrival signal, the Raspberry Pi starts the measuring camera, the detection camera, and the fill light unit based on the main measurement program pre-set in the Raspberry Pi.
[0027] S23, the Raspberry Pi sends a start measurement signal to the CNC system of the machine tool. After receiving the start measurement signal, the CNC system of the machine tool controls the spindle of the machine tool from the fixed point Move down to the measuring point At the position, interactive registration is completed;
[0028] In step S24, the CNC system of the machine tool 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 measuring.
[0029] Preferably, in step S3, measuring the tool parameters for the first time based on the side image and the end face image includes the following steps:
[0030] S31, respectively controlling the measurement camera and the inspection camera to read the configuration files para1.txt and para2.txt stored in advance in the designated location of the Raspberry Pi memory, and initialize the built-in parameters of the measurement camera and the inspection camera based on the configuration files para1.txt and para2.txt to obtain clear and high-resolution images image1 of the tool handle and tool side surface, and image2 of the tool end surface;
[0031] S32, obtaining a set of measurement samples consisting of a number of images for image 1 and image 2, and selecting image 1 and image 2 with better quality from the batch of images of the measurement samples based on a pre-set image optimization strategy;
[0032] S33, completing the measurement of the non-rotational parameters of the tool handle and the tool from the preferred image1; completing the detection of abnormal conditions of the tool from the preferred image2.
[0033] Preferably, in step S4, calibrating the position of the machine tool spindle in the automatic tool measuring device includes the following steps:
[0034] S41, the Raspberry Pi sends a position calibration signal to the CNC system of the machine tool. After receiving the position calibration signal, the CNC system controls the machine tool spindle to move an initial distance along the negative direction of the Z axis of the machine tool coordinate system, changing the coordinates of the machine tool spindle. value;
[0035] S42: The CNC system of the machine tool 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: Keep the machine tool spindle along the coordinates of the machine tool coordinate system The value remains unchanged. The Raspberry Pi uses communication interaction to enable the CNC system to control the movement of the machine tool spindle, change the X-axis and / or Y-axis coordinates of the machine tool spindle in the machine tool coordinate system, and make the distance between the tool end point and the measurement camera lens the minimum viewing distance of the camera. , that is, the machine tool spindle position calibration is completed.
[0037] Preferably, in step S42, calibrating the position of the machine tool spindle on the Z axis includes the following steps:
[0038] S421, start the measurement camera to capture an image and obtain an image dst;
[0039] S422, identifying the coordinate value of the tool endpoint on the Y axis in the image dst , coordinate values Used to represent tool 14 features; for changes in the machine tool z value in the captured image, synchronize it with the corresponding tool 14 features in the dst image on the changes in
[0040] S423, based on coordinate values Calculate the Y-axis distance deviation between the tool endpoint and the geometric center of the image dst ;
[0041] S424, determine the distance deviation value If the coordinate value of the tool end point 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, according to the distance deviation value Correct the Z-axis position of the machine tool spindle in the machine tool coordinate system, that is:
[0043] If the distance deviation value If it is negative, it means the coordinate of the machine tool spindle If the value is greater than the target value, the Raspberry Pi controls the CNC system of the machine tool to move the spindle along the negative direction of the Z axis of the machine tool coordinate system based on communication interaction. 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 Is positive, indicating the coordinates of the machine tool spindle If the value is less than the target value, the Raspberry Pi controls the CNC system of the machine tool to move the spindle along the positive direction of the Z axis of the machine tool coordinate system based on communication interaction. 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, so that the Raspberry Pi and the CNC system of the machine tool can continuously communicate and interact to achieve the adaptive calibration of the tool end position until the corresponding distance deviation value is reached. , that is, the calibration is completed; among them, The distance deviation threshold is preset.
[0046] Preferably, in step S4, a time series image is acquired based on the image captured by the measurement camera. The method is as follows: the CNC system of the machine tool controls the spindle of the machine tool to start rotating at the lowest speed, and at the same time sends a re-measurement signal to the Raspberry Pi. After receiving the re-measurement 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 for time series images To save, the corresponding number of images is express.
[0047] Preferably, in step S5, based on the time series image The second measurement of tool parameters includes the following steps:
[0048] S51, to obtain Re-time series images For each time series image to be analyzed, , intercept its geometric center distribution area as the study area, and obtain Recapture the image ;
[0049] S52, intercepting the image Filter and remove random noise in the image;
[0050] S53, based on the captured image Create a new blank image of the same size and color space as the first image you captured. Start accumulating in the blank image. The accumulation principle is to represent the grayscale pixel points of the tool at different angles when the spindle rotates. again After iteration, we get the image ;
[0051] S54, based on the same structure factor and different coordinate grayscale differences, the image is obtained The corner characteristic curve with radian difference characteristics composed of a series of pixel points is obtained, and then the radius value r of the corner is obtained based on the least square fitting method, thus completing the second measurement of the tool parameters.
[0052] Beneficial effects of the present invention:
[0053] This technical solution strictly limits the movement range of the machine tool spindle during the tool measurement process, ensuring collision and error prevention caused by abnormalities during the interaction process. Compared with existing methods, it demonstrates better autonomous decision-making capabilities, and its reliability and safety are also significantly improved.
[0054] This technical solution not only determines whether the tool and tool holder meet process parameter specifications, but also identifies tool defects, effectively avoiding quality issues in processed parts caused by tool anomalies. The entire tool measuring device is inexpensive, significantly lower than similar foreign products. The device also produces low-noise images that are conducive to analysis, resulting in more reliable measured parameters and a stronger competitive advantage in the market. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 The present invention is a flowchart for implementing an automatic tool measuring method for a CNC machine tool;
[0056] Figure 2 The present invention is a structural diagram of an automatic tool measuring device for a CNC machine tool;
[0057] Figure 3 This is a tool measuring principle diagram of an automatic tool measuring device for a CNC machine tool;
[0058] Figure 4 Schematic diagram of the imaging range of the measurement 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 fill light assembly; 11. Planar fill light assembly; 11.1. Planar scattering film; 11.2. LED light strip; 12. Spindle; 13. Tool handle; 14. Cutting tool; 15. Device inner wall; 16. Measuring camera imaging range. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solutions and advantages of the invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.
[0062] Therefore, the following detailed description of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention as claimed, but merely represents selected embodiments of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without creative effort shall fall within the scope of protection of the present 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 method of this technical solution, such as Figure 2As shown, it includes a measuring camera 1, a detection camera 2, a DC power supply 3, a Raspberry Pi 4, a fill light unit, and a device housing 5 with an open top. The detection camera 2 and the detection camera 2 are respectively provided with dust covers 7.
[0065] A device top plate 6 is provided at the top opening of the device housing 5 , and 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 obtain side images of the tool handle 13 and the tool 14 from a radial direction.
[0067] The detection camera 2 is installed on the inner wall of the bottom of the device housing 5 and is used to obtain the end face image of the tool 14 from the axial direction.
[0068] The fill light unit is arranged on the device housing 5 and is used to provide fill light 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 is in communication with the measuring camera 1, the detection camera 2, the fill light 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 disposed inside the device housing 5 and is electrically connected to the measuring camera 1 , the detection camera 2 , the Raspberry Pi 4 , the fill light unit and the motor device 9 , so as to provide working power for the entire automatic tool measuring device.
[0071] Based on the hardware structure of the aforementioned automatic tool measuring device, the software parameters involved in this technical solution are as follows:
[0072] The software runs on Windows 7 64-bit, with an Intel(R) Xeon(R) W-2223 3.60GHz processor, 32GB of RAM at 3200MHz, and a 256GB hard drive. The software was developed using Visual Studio 2019, C++, and OpenCV 4.5.5, an image processing library. The software runs on a ReleaseX64 platform, and the corresponding system version for the Raspberry Pi 4 is Ubuntu 16.08. The SDK version is 10.0.22000.0.
[0073] Example 2
[0074] This embodiment discloses an automatic tool measuring device for a CNC machine tool (hereinafter referred to as the automatic tool measuring device), as a preferred embodiment of the present technical solution, such as Figure 3As shown, it includes a measuring camera 1, a detection camera 2, a DC power supply 3, a Raspberry Pi 4, a fill light unit, and a device housing 5 with an open top. The detection camera 2 and the detection camera 2 are respectively provided with dust covers 7.
[0075] The top opening of the device housing 5 is provided with a top plate 6, which is rotatably connected to the device housing 5 via a hinge 8. A motor unit 9 is also mounted on the device housing 5 to control the opening and closing of the top plate 6. A measurement camera 1 is mounted on the inner wall of one side of the device housing 5 and is used to capture radial side images of the tool handle 13 and tool 14. An inspection camera 2 is mounted on the inner wall of the bottom of the device housing 5 and is used to capture axial end-face images of the tool 14. A fill light unit is mounted on the device housing 5 to provide supplemental illumination when the measurement and inspection cameras 1 and 2 capture images. A Raspberry Pi 4 is mounted inside the device housing 5 and is in communication with the measurement camera 1, inspection camera 2, fill light unit, and motor unit 9. It controls the automatic tool probing device by communicating with the machine tool's numerical control system to complete the tool probing operation. A DC power supply 3 is mounted inside the device housing 5 and is electrically connected to the measurement camera 1, inspection camera 2, Raspberry Pi 4, fill light unit, and motor unit 9 to provide power to the entire automatic tool probing device.
[0076] More specifically, the fill light unit includes a planar fill light component 11 arranged on the opposite side of the measuring camera 1 and an annular fill light component 10 arranged with the detection camera 2 as the center, and the planar fill light 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 length, width, and height of the automatic tool measuring device are all 30 cm, meaning that the device housing 5 is a cube with a side length of 30 cm. Based on this, a measuring camera 1 is located at the geometric center of one inner wall of the device housing 5. A planar fill light assembly 11 is laid across the entire surface of the device housing 5 opposite the surface where the measuring camera 1 is located. Within this fill light assembly 11, a planar scattering film 11.1 is used to achieve uniform lighting. A DC power supply 3 is located at a bottom corner within the device housing 5, with a corresponding output voltage of 12V. An inspection camera 2 is located at the center of the bottom surface of the device housing 5 and is used to capture images of the end face of the tool 14. A Raspberry Pi 4 is also located at a bottom corner of the device housing 5, forming a symmetrical relationship with the DC power supply 3 at the bottom angle. An annular fill light assembly 10 surrounds the inspection camera 2, resting against the bottom surface of the device housing 5. Its function is to illuminate the end face of the tool 14, enabling the inspection camera 2 to capture a clearer image.
[0078] Motor assembly 9 controls the opening and closing of the device's top plate 6. When the automatic tool measuring device is not operating, top plate 6 is closed to prevent the ingress of debris such as cutting fluid. When the automatic tool measuring device is in the measuring state, motor assembly 9 opens the entire top plate 6. A dust cover 7 on the measuring camera 1 blocks debris from inside the device housing 5, preventing it from adhering to the camera lens and obscuring the image. When not measuring, this cover is closed and only opens when measuring. The dust cover 7 on the inspection camera 2 blocks debris and cutting fluid from the machine tool's spindle 12, tool holder 13, and tool 14, preventing them from adhering to the lens and obscuring the image. This cover is closed when not inspecting and only opens when inspecting. The entire measuring device is rigidly connected to the machine tool. The automatic tool measuring device is mounted vertically, without any tilt, and connection is achieved through the connecting holes.
[0079] Example 3
[0080] This embodiment discloses an automatic tool measuring method for a CNC machine tool, as a preferred implementation of this technical solution, such as Figure 1 As shown, it includes the probing tool before processing and the probing tool after processing.
[0081] Pre-processing tool measurement is to start the tool 14 measurement work after manual or automatic tool change of the machine tool, including the following steps:
[0082] S1: The CNC system of the machine tool 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, wireless communication is used to transmit signal data between the Raspberry Pi 4 and the CNC system of the machine tool.
[0083] In step S2, the Raspberry Pi 4 cooperates with the machine tool CNC system to move the machine tool spindle 12 to a pre-set measurement point based on the interactive registration method to prepare for measurement;
[0084] S3, Raspberry Pi 4 controls the measuring camera 1 and the inspection camera 2 to capture the side images of the tool handle 13 and the tool 14 and the end face image of the tool 14, and performs the first measurement of the parameters of the tool 14 based on the side image and the end face image;
[0085] S4, calibrating the position of the machine tool spindle 12 in the automatic tool measuring device through a pre-designed tool tip position adaptive calibration strategy, and after completing the machine tool spindle 12 position calibration, acquiring a time series image based on the image captured by the measuring camera 1 , measure the imaging range of the image captured by camera 1 when capturing the image as Figure 4 As shown;
[0086] S5, based on time series images Perform a second measurement of tool 14 parameters;
[0087] S6, evaluating the parameters of the corresponding tool 14 and tool holder 13 after the tool change based on the measured parameters; specifically, the measured tool holder 13 and tool 14 parameters obtained from the first and second tool 14 parameter measurements are compared and judged based on the numbers of the tool 14 and tool holder 13 in the CNC machining program of the workpiece after the tool change is completed, and combined with the parameters of the corresponding numbered tool 14 and tool holder 13 in a previously stored database, to achieve the purpose of tool measurement;
[0088] S7, based on the evaluation result, decide whether to perform a tool re-change process; if so, the tool is re-changed and the process returns to step S1; if not, the tool probing work before machining is completed and the CNC machine tool performs part machining;
[0089] The post-processing tool measurement: that is, after the part processing is completed, steps S1 to S7 are repeated, and based on the evaluation result of step S7, it is judged whether the tool 14 has any abnormality. If the tool 14 has no abnormality, 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 probing method for a CNC machine tool. As a preferred implementation of this technical solution, based on Example 3, in step S1, testing the tool probing hardware function of the automatic tool probing device includes the following steps:
[0092] S11, Configuration Activation: Activation based on The developed camera calls the test code and turns on the fill light 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. The images obtained by the measurement camera 1 and the detection camera 2 are respectively used and Indicates that the resolution of the obtained image is the same, that is, the number of image rows and columns is equal;
[0093] S12, camera and fill light function test: Get the current measurement space by measuring camera 1 and detecting camera 2 Image and Image, and Image and The image quality is evaluated; if the quality evaluation result does not meet the requirements, the fill light unit, measurement camera 1 and detection camera 2 are restarted, and the process returns to step S11; if the quality evaluation result meets the requirements, the image capture hardware function test is completed, and the measurement camera 1, detection camera 2 and fill light unit are turned off, and the process proceeds to step S13;
[0094] S13, automated auxiliary function test: The Raspberry Pi 4 controls the motor device 9 to open the device top plate 6 and simultaneously open the dust covers 7 on the measuring camera 1 and the detection camera 2 to prepare for the tool probing operation. During this period, if the device top plate 6 and the dust cover 7 can be opened smoothly, it indicates that the automated auxiliary function has not failed and the tool probing hardware function test is completed. If the device top plate 6 and / or the dust cover 7 cannot be opened smoothly, it indicates that the automated auxiliary function has failed. After the corresponding fault is repaired, the process returns to step S1.
[0095] Example 5
[0096] This embodiment discloses an automatic tool measuring method for a CNC machine tool. As a preferred embodiment of this technical solution, based on Example 4, in step S12, Image and The method for image quality evaluation is to evaluate the difference in random distribution of global pixel brightness. Specifically, the total number of evaluation mark pixels is , divide the total number of pixels into Line and The distance between each pixel is equal. , the evaluation mark pixels are evenly distributed with the center position of the image as the reference. On this basis, Image and Read the pixels distributed at the marked point in the image, sort them from small to large based on the sum of the grayscale values of each pixel channel, and only more than 1 / 3 of the pixel positions have brightness values greater than the set threshold The image quality meets the requirements. If the corresponding image does not meet the requirements, the fill light unit and the camera are restarted.
[0097] Therefore, the evaluation formula for the image quality evaluation result to meet the requirements is expressed as ;in, It is a function that sorts the grayscale values of pixels. Based on the evaluation formula, it can be used to determine whether the camera imaging quality meets the requirements. At the same time, it can also be used to determine whether the fill light unit is turned on normally. Represents an image with analytical processing; Indicates the number of the target image, Indicates the number of rows of image pixels, Indicates the number of columns of image pixels, Represents the distance between adjacent pixels. Indicates the preset pixel position ratio brightness threshold.
[0098] Example 6
[0099] This embodiment discloses an automatic tool measuring method for a CNC machine tool. As a preferred embodiment of the present technical solution, based on Embodiment 3, 4, or 5, in step S2, moving the machine tool spindle 12 to a preset measuring point to prepare for measurement includes the following steps:
[0100] S21, Raspberry Pi 4 sends a ready signal to the CNC system of the machine tool. After receiving the ready signal, the CNC system controls the machine tool spindle 12 to move to the measurement point of the automatic tool measuring device pre-set in the CNC system. The fixed point directly above ; Among them, the measurement point and fixed points are all coordinate points in the machine tool coordinate system, and the measurement points is 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 origin of the machine tool 、 、 data;
[0101] S22, the CNC system of the machine tool sends a preliminary arrival signal to the Raspberry Pi 4. After receiving the preliminary arrival signal, the Raspberry Pi 4 starts the measuring camera 1, the detection camera 2, and the fill light unit based on the main measurement program pre-set in the Raspberry Pi 4;
[0102] S23, Raspberry Pi 4 sends a start measurement signal to the CNC system of the machine tool. After receiving the start measurement signal, the CNC system of the machine tool controls the spindle 12 of the machine tool from the fixed point Move down to the measuring point Position, the interactive registration is completed; for the measurement point At a fixed point middle and The values are the same, the only difference is in In terms of value, during the entire movement process, there is no spatial interference between the machine tool spindle 12, the tool 14 and other hardware and the tool measuring device;
[0103] S24, the CNC system of the machine tool sends a trigger signal to the Raspberry Pi 4. After receiving the trigger signal, the Raspberry Pi 4 controls the automatic tool measuring device to start measuring.
[0104] Example 7
[0105] This embodiment discloses an automatic tool measuring method for a CNC machine tool. As a preferred implementation of this technical solution, based on Embodiment 3, 4, 5, or 6, in step S3, the first measurement of tool 14 parameters based on the side image and the end face image includes the following steps:
[0106] S31, respectively controlling the programs of the measuring camera 1 and the inspection camera 2 to read the configuration files para1.txt and para2.txt stored in advance in the designated locations of the Raspberry Pi 4 memory, and initializing the built-in parameters of the measuring camera 1 and the inspection camera 2 based on the configuration files para1.txt and para2.txt, so as to obtain clear and high-resolution side images image1 of the tool handle 13 and the tool 14, and image2 of the end face of the tool 14;
[0107] S32, obtaining a set of measurement samples consisting of a plurality of images for each of image 1 and image 2, and selecting image 1 and image 2 of better quality from the batch of images of the measurement samples based on a pre-set image optimization strategy; wherein the better quality specifically refers to images with less background noise, high contrast at the tool 14 boundary, and a larger first-order derivative as reflected in the numerical value;
[0108] S33: Measure the non-corner parameters of tool holder 13 and tool 14 from the selected image 1; and detect any abnormalities in tool 14 from the selected image 2. Non-corner parameters include parameters other than the corner values, such as tool 14 diameter and tool 14 length, and are used to measure tool 14 parameters. Abnormalities include incorrect tool 14 handling or selection, or incorrect tool holder 13 handling or selection, and are not directly related to the parameters of measurement camera 1 or inspection camera 2.
[0109] Example 8
[0110] This embodiment discloses an automatic tool measuring method for a CNC machine tool. As a preferred implementation of this technical solution, based on Embodiments 3, 4, 5, 6, or 7, in step S4, calibrating the position of the machine tool spindle 12 in the automatic tool measuring device includes the following steps:
[0111] S41, Raspberry Pi 4 sends a position calibration signal to the CNC system of the machine tool. After receiving the position calibration signal, the CNC system of the machine tool controls the machine tool spindle 12 to move an initial distance along the negative direction of the Z axis of the machine tool coordinate system, changing the coordinate of the machine tool spindle 12 value;
[0112] S42: The machine tool numerical control 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.
[0113] S43, keep the machine tool spindle 12 along the coordinates of the machine tool coordinate system The value remains unchanged. The Raspberry Pi 4 uses the communication interaction to enable the CNC system of the machine tool to control the movement of the machine tool spindle 12, change the X-axis and / or Y-axis coordinates of the machine tool spindle 12 in the machine tool coordinate system, and make the distance between the end point of the tool 14 and the lens of the measuring camera 1 the minimum viewing distance of the camera. , that is, the machine tool spindle 12 position calibration is completed. Among them, the minimum sight distance This allows the tool 14 to occupy a larger area within the imaging range of the measuring camera 1, magnifying the tip of the tool 14 while maintaining a clear image. This improves the accuracy of measuring the angle of the tool 14. During 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 a CNC machine tool. As a preferred implementation of this technical solution, based on Example 8, in step S42, calibrating the position of the machine tool spindle 12 on the Z axis includes the following steps:
[0116] S421, start the measuring camera 1 to capture an image and obtain an image dst;
[0117] S422, identifying the coordinate value of the tool endpoint on the Y axis in the image dst , coordinate values Used to represent tool 14 features; for changes in the machine tool z value in the captured image, synchronize it with the corresponding tool 14 features in the dst image on the changes in
[0118] S423, based on coordinate values Calculate the Y-axis distance deviation between the tool 14 endpoint and the geometric center of the image dst ;
[0119] S424, determine the distance deviation value 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;
[0120] S425, according to the distance deviation value The positive or negative value of calibrates the Z-axis position of the machine tool spindle 12 in the machine tool coordinate system, that is:
[0121] If the distance deviation value If it is negative, it means the coordinate of the machine tool spindle 12 If the value is greater than the target value, the Raspberry Pi 4 controls the machine tool CNC system to move the machine tool spindle 12 along the negative direction of the Z axis of the machine tool coordinate system based on communication interaction. 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 Is positive, indicating the coordinates of the machine tool spindle 12 If the value is less than the target value, the Raspberry Pi 4 controls the machine tool CNC system to move the machine tool spindle 12 along the positive direction of the Z axis of the machine tool coordinate system based on communication interaction. 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, so that the Raspberry Pi 4 and the CNC system of the machine tool can continuously communicate and interact to achieve the adaptive calibration of the tool end position until the corresponding distance deviation value is reached. , that is, the calibration is completed; among them, The distance deviation threshold is preset.
[0124] In this technical solution, the designed adaptive calibration strategy only changes The value of and remains unchanged, while the corresponding The value sets the maximum single step increase and decrease limit, ensuring collision and error prevention problems caused by abnormalities during the interaction process, and effectively ensuring the reliability and safety of the adaptive calibration process.
[0125] Example 10
[0126] This embodiment discloses an automatic tool measuring method for a CNC machine tool. As a preferred embodiment of this technical solution, based on Embodiments 3, 4, 5, 6, 7, 8 or 9, in step S4, a time series image is obtained based on the image captured by the measuring camera 1. The method is as follows: the CNC system of the machine tool controls the spindle 12 of the machine tool to start rotating at the lowest speed, and at the same time sends a re-measurement signal to the Raspberry Pi 4. After receiving the re-measurement 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 for time series images To save, the corresponding number of images is express.
[0127] Example 11
[0128] This embodiment discloses an automatic tool measuring method for a CNC machine tool, which is a preferred embodiment of the present technical solution. That is, based on Example 10, the time series images are obtained. For the image to be analyzed, the area where the geometric center of the image is cut off is the area of study. The basis for the cut is the geometric center of the image after the tip of the tool 14 is processed by adaptive calibration. The cut method can obtain a more focused area of interest, which is conducive to feature extraction. Based on this, in step S5, based on the time series image The second measurement of the tool 14 parameters includes the following steps:
[0129] S51, to obtain Re-time series images For each time series image to be analyzed, , intercept its geometric center distribution area as the study area, and obtain Recapture the image The specific method of capturing the image is as follows: according to the statistical database marked in advance, the regional coordinates of each CNC machine tool tool 14 library and the corresponding tool tip point in the second magnified image are determined to capture the image. The image area in the figure is determined according to the type of tool 14 specified in the NC machining program to determine the corresponding area coordinates in the statistical database, and the intercepted image is obtained from the coordinates. ;
[0130] S52, intercepting the image The random noise in the image is filtered and removed to improve the difference between the tool 14 features and the background;
[0131] S53, based on the captured image Create a new blank image of the same size and color space as the first image you captured. Start accumulating in the blank image. The accumulation principle is to represent the grayscale pixel points of the tool 14 at different angles when the spindle 12 rotates. again After iteration, we get the image ;
[0132] S54, based on the same structure factor and different coordinate grayscale differences, the image is obtained The corner characteristic curve with curvature differences, which is composed of a series of pixel points, is then used to obtain the corner radius r based on the least squares fitting method, thus completing the second measurement of the tool 14 parameters. Among them, the radius r value is compared with the database to determine whether the tool 14 corner meets the requirements.
[0133] Example 12
[0134] This embodiment discloses an automatic tool measuring method for a CNC machine tool. As a preferred implementation of this technical solution, the specific operations are as follows:
[0135] The first step is to start measurement after a tool change is completed, either manually or automatically. The CNC machine tool's CNC system sends a tool-testing readiness signal to the Raspberry Pi 4 in the automatic tool-testing device, using wireless communication to transmit the signal data.
[0136] In the second step, after the Raspberry Pi 4 in the automatic tool measuring device receives the tool measuring preparation signal, it activates The developed camera calls the test code and turns on the plane fill light component 11; the default ID number corresponding to the measurement camera 1 is 0, and the ID number corresponding to the detection camera 2 is 1. The camera images obtained are respectively and Indicates that the resolution of the obtained image is the same, that is, the number of image rows and columns is equal.
[0137] The third step is and Image evaluation method uses the random distribution value difference of the global pixel brightness of the image to evaluate. The total number of evaluation mark pixels is , divide the total number of pixels into Line and The distance between each pixel is equal. , the evaluation mark pixels are evenly distributed with the center position of the image as the reference. The evaluation method is: and Read the pixels distributed at the marked point in the image, sort them from small to large based on the sum of the grayscale values of each pixel channel, and only more than 1 / 3 of the pixel positions have brightness values greater than the set threshold The image quality meets the requirements. If the corresponding image does not meet the requirements, the fill light unit and the camera (measurement camera 1 and detection camera 2) are restarted. The corresponding evaluation formula can be expressed as:
[0138] ;
[0139] in, Sort the pixel grayscale values. Based on the evaluation formula, you can determine whether the camera's image quality meets the requirements. You can also use the formula to determine whether the fill light unit is working properly.
[0140] In the fourth step, after the cameras (measuring camera 1 and inspection camera 2) and the fill light unit are tested and found to be normal, they are turned off. The 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 the measuring camera 1 and the dust cover 7 of the inspection camera 2 are opened, preparing for the tool measurement work.
[0141] Step 5: When the Raspberry Pi 4 receives signals from the cameras (measuring camera 1 and inspection camera 2), the fill light unit, and the motor device 9 and determines that the hardware is normal, the Raspberry Pi 4 sends a ready signal to the machine tool CNC system. After the CNC system receives the ready signal, it will automatically measure the tool based on the measurement points of the machine tool set in advance. , measuring point The geometric center of the tool measuring device relative to the origin of the machine tool 、 、 Data, move the machine tool spindle 12 to the fixed point just above the tool measuring device relative to the measuring point At a fixed point middle and The values are the same, the only difference is in In fact, during the entire movement process, there is no spatial interference between the machine tool spindle 12, the tool 14 and other hardware and the tool measuring device.
[0142] Step 6: The machine tool spindle 12 moves to the upper fixed point of the tool measuring device Afterwards, the CNC system sends a preliminary arrival signal to the Raspberry Pi 4. After receiving the corresponding signal, the main measurement program written into the Raspberry Pi 4 is started, and the measuring camera 1, the inspection camera 2, the plane fill light component 11, and the annular fill light component 10 are turned on again to prepare for the tool measurement.
[0143] In the seventh step, the Raspberry Pi 4 sends a start measurement signal to the CNC system of the machine tool. After receiving the corresponding signal, the CNC system controls the machine tool spindle 12 to move from the fixed point Move down to the measuring point Position, fixed position above the tool measuring device With measuring point of and Same value, only The change reflects a relative decrease in value. The corresponding tool 14 and tool handle 13 have moved to the interior of the tool measuring device.
[0144] Step 8: The machine tool spindle 12 reaches the measuring point After the interactive registration is completed, the CNC system of the machine tool sends a trigger signal to the Raspberry Pi 4, and the Raspberry Pi 4 starts measuring after receiving the signal.
[0145] Step 9 begins the measurement, corresponding to the first parameter measurement strategy. The program controlling measurement camera 1 reads the configuration file para1.txt, which has been pre-stored in the Raspberry Pi 4's memory. Based on this configuration file, the program initializes the internal parameters of measurement camera 1 (including brightness, gain, white balance, focus, exposure, and other parameters) to obtain a clear, high-resolution image (image 1) of the tool handle 13 and tool 14. Similarly, the program initializes the internal parameters of inspection camera 2 based on the configuration file para1.txt to obtain image 2 perpendicular to the tool tip.
[0146] In the tenth step, a set of measurement samples consisting of a number of images are obtained for the image image1 of the tool handle 13 and the tool 14 and the image image2 in the direction perpendicular to the tool tip view. Based on the set image optimization strategy, images with better quality are selected from the batch of images, and measurement is performed based on the optimized images.
[0147] In the eleventh step, the non-rotational parameters of the tool handle 13 and the tool 14 are measured from the preferred image 1; and the abnormality of the tool 14 is detected from the preferred image 2.
[0148] Step 12: After completing the first parameter measurement, the Raspberry Pi 4 sends a signal to the machine tool that the first measurement is completed. After receiving the signal, the CNC system of the machine tool changes the coordinates of the spindle 12, which corresponds to 、 The value remains unchanged and decreases slowly At the same time, the CNC system of the machine tool sends the value to the Raspberry Pi 4. The value changes signal, and the Raspberry Pi 4 starts the adaptive calibration process after receiving the signal:
[0149] 1) Start the image capture function of measurement camera 1 and identify the coordinate value 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;
[0150] 2) Calculation The distance deviation between the value and the center of the image dst ,like If the value is above the center of the image dst, the corresponding deviation value is negative. If the value is below the center of the image dst, the corresponding deviation value is positive;
[0151] 3) Determine the distance deviation value If the corresponding value is negative, the Raspberry Pi 4 will give the machine tool CNC system a reduced feedback. Not enough value, The value needs to be further reduced. The single reduction step length of the value during the reduction process exceeds 1 / 50 of the total length of the device;
[0152] 4) Determine the distance deviation value If the corresponding value is positive, the Raspberry Pi 4 will give the machine tool CNC system feedback of the reduced Excessive value, The value needs to be increased. The single increase step length of the value during the increase process exceeds 1 / 100 of the total length of the device;
[0153] 5) Through the continuous communication and interaction between the Raspberry Pi 4 and the machine tool, the adaptive calibration of the tool tip position is achieved until the corresponding approaches 0, due to is an integer, so set the threshold ,make satisfy Calibration stops when the relationship is reached.
[0154] The designed adaptive calibration strategy only changes The value corresponding to and remains unchanged, while the corresponding The value sets the maximum single step increase and decrease limit, ensuring collision and error prevention problems caused by abnormalities during the interaction process, and effectively ensuring the reliability and safety of the adaptive calibration process.
[0155] Step 13: Complete in an adaptive manner After calibration, keep The value remains unchanged based on the fixed value change and The value makes the distance between the tool tip and the measuring camera 1 lens equal to the minimum viewing distance of the camera , minimum viewing distance This allows the tool 14 to occupy a larger area within the imaging range of the measuring camera 1, magnifying the tip of the tool 14 while maintaining a clear image. This improves the accuracy of measuring the angle of the tool 14. During the movement, there is no spatial interference between the machine tool spindle 12 and the tool measuring device.
[0156] Step 14: After completing the position calibration, the CNC system of the machine tool sends a measurement signal to the Raspberry Pi 4. When the Raspberry Pi 4 receives the corresponding measurement signal, the measurement camera 1 starts to capture images. At the same time, the CNC system of the machine tool controls the spindle 12 to start rotating at the lowest speed, and the measurement camera 1 captures images at the maximum frame rate and performs time series image processing. To save, the corresponding number of images is express.
[0157] Step 15: Get the time series images For the image to be analyzed, the area where the geometric center of the image is located is intercepted as the area of study. The interception is based on the geometric center of the tool tip of the tool 14 in the image after adaptive calibration. The interception method can obtain a more focused area of interest, which is conducive to feature extraction. The interception method is: based on the pre-marked statistical database, the regional coordinates of each CNC machine tool tool 14 library and the corresponding tool tip point in the second magnified image are determined to intercept the image. That is, the corresponding area coordinates in the statistical database are determined according to the type of tool 14 specified in the NC machining program, and the intercepted image is obtained from the coordinates. .
[0158] Step 16: Design a filtering method to remove the intercepted image Random noise is added to enhance the difference between tool 14 features and background.
[0159] Step 17: Based on the captured image Resize a new blank image with the same scale and color space , from the first image captured Start in The accumulation starts in the middle. The accumulation principle is to represent the grayscale pixel points of the tool 14 at different angles when the spindle 12 rotates. again After iteration, we get image.
[0160] Step 18: Get images based on the same structure factor polar coordinate grayscale difference in different ways The corner characteristic curve with curvature difference characteristics composed of a series of pixel points can be used to obtain the radius r value of the corner based on the least squares fitting method. The radius r value is compared with the database to determine whether the tool 14 corner meets the requirements. After obtaining the radius r value, the second parameter measurement step is completed. The radius r fitting formula based on the obtained pixel points is:
[0161]
[0162] In the equation of a circle Is an unknown quantity and requires further calculation. The transformation of the formula is:
[0163]
[0164] Further order The equation of the circle can be rearranged as follows:
[0165]
[0166] in is the coordinate of the circle center, and we can solve The equation of the circle can be obtained by numerical value. All the points on the line segment that plots the relationship between the point on the circle and the center of the circle constitute the point set on the circle. , The size 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 of the circle and the square of the radius can be expressed as:
[0167]
[0168] That is: tangent length The square of the distance from the tangent point to the center of the circle is equal to The square of the radius r is subtracted from the square of the radius r. Solving the equation yields The value of the angle r can be obtained.
[0169] In the nineteenth step, the parameters of the tool holder 13 and the tool 14 obtained for the first and second measurements are compared and judged based on the numbers of the tool 14 and the tool holder 13 in the CNC machining program of the workpiece after the tool change is completed, and combined with the parameters of the tool 14 and the tool holder 13 with the corresponding numbers in the previously existing database to achieve the purpose of tool measurement.
[0170] In the twentieth step, after judging the parameters of the tool probe, whether they meet the requirements is determined, and whether the tool is replaced or the processing is performed. If the parameters of the tool probe meet the requirements, the spindle 12 of the machine tool is reset and the predetermined component processing is completed based on the designed NC program. If the corresponding tool probe parameters do not meet the requirements, the tool holder 13, the tool 14, or the tool holder 13 and the tool 14 are replaced. After the replacement is completed, the tool probe step is completed again based on the pre-processing tool probe step described above.
[0171] Furthermore, in order to further prevent the occurrence of economic losses due to defects or abnormalities in the tool 14 during the parts processing process, a time interval tool detection step can be set according to the needs of the actual situation. That is, during the parts processing process, the tool 14 is regularly detected and judged by the designed device to see if there are defects, so as to reduce the processing abnormality problems caused by defects in the tool 14.
[0172] In the 21st step, after the corresponding parts are processed according to the established procedures, the stored tool 14 needs to be further judged to see if there are any abnormalities or defects. This is called post-processing tool probing in the present invention. The corresponding steps from "tool probing hardware function detection" to "parameter judgment and evaluation method" are the same as those for pre-processing tool probing.
[0173] Furthermore, after the tool measurement is completed after processing, the "parameter judgment and evaluation method" needs to be evaluated again to see if there is any abnormality in the tool 14. If there is any abnormality in the tool 14, the tool 14 needs to be replaced. If there is no abnormality in the tool 14, the tool 14 can be put into storage normally, and the entire process of tool measurement is completed based on this.
[0174] The entire measurement process needs to record the process and result files, including the total usage time of the corresponding tool 14, the type and brand of the defective and abnormal tool 14, the number of times the tool 14 is used, the measurement time, etc., to meet the targeted improvement of the processing technology of the parts or the optimization of the tool 14.
[0175] After the measurement is complete, the machine tool's CNC system sends a measurement completion signal to the Raspberry Pi 4. Upon receiving this signal, the Raspberry Pi 4 activates the fill light unit and the camera shutdown command. After the corresponding hardware is shut down, the Raspberry Pi 4 sends a command to the motor device 9 to close the device's top plate 6, and simultaneously closes the dust covers 7 of both measurement camera 1 and inspection camera 2. Finally, the Raspberry Pi 4 shuts down all peripherals, retaining only the most basic communication functions with the machine tool's CNC system. This allows the entire measurement device to be restarted in time for subsequent measurements, completing the tool measurement process.
Claims
1. An automatic tool measuring method for a CNC machine tool, characterized in that: An automatic tool measuring device of a numerical control machine tool is used to measure the tool before and after processing; wherein the automatic tool measuring device comprises a measuring camera (1), a detection camera (2), a DC power supply (3), a Raspberry Pi (4), a fill light unit, and a device housing (5) with an open top, and dust covers (7) are respectively provided on the detection camera (2) and the detection camera (2); 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); The measuring camera (1) is mounted on an inner wall of one side of the device housing (5) and is used to obtain side images of the tool handle (13) and the tool (14) from a radial direction; The detection camera (2) is arranged and installed on the inner wall at the bottom of the device housing (5) and is used to obtain an end face image of the tool (14) from the axial direction; The fill light unit is arranged on the device housing (5) and is used to fill light 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 fill light unit and the motor device (9) for controlling the automatic tool measuring device to complete the tool measuring work by communicating and interacting with the machine tool numerical control system; The DC power supply (3) is arranged inside the device housing (5) and is electrically connected to the measuring camera (1), the detection camera (2), the Raspberry Pi (4), the fill light unit and the motor device (9), so as to provide working power for the entire automatic tool measuring device; The tool measurement before processing is to start the tool (14) measurement work after the manual or automatic tool change of the machine tool, including the following steps: S1, the CNC system of the machine tool sends a tool measuring preparation signal to the Raspberry Pi (4), and after receiving the tool measuring preparation signal, the Raspberry Pi (4) starts its internal main program to detect the tool measuring hardware function of the automatic tool measuring device; S2, the Raspberry Pi (4) cooperates with the machine tool numerical control system to move the machine tool spindle (12) to a pre-set measuring point to prepare for measurement based on an interactive registration method; S3, the Raspberry Pi (4) controls the measuring camera (1) and the inspection camera (2) to respectively capture the side images of the tool handle (13) and the tool (14) and the end face image of the tool (14), and performs the first measurement of the parameters of the tool (14) based on the side image and the end face image; S4, calibrating the position of a machine tool spindle (12) in the automatic tool measuring device through a pre-designed tool tip position adaptive calibration strategy, and after completing the machine tool spindle (12) position calibration, acquiring a time series image based on an image captured by a measuring camera (1) ; Among them, obtain time series images The method is as follows: the CNC system of the machine tool controls the main shaft (12) of the machine tool to start rotating at the lowest speed, and at the same time sends a re-measurement signal to the Raspberry Pi (4); after receiving the re-measurement 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 for time series images To save, the corresponding number of images is express S5, based on time series images The second measurement of the tool (14) parameters includes the following steps: S51, to obtain Time series images For each time series image , intercept its geometric center distribution area as the study area, and obtain Capture image ; S52, capturing the image Filter and remove the random noise in the image; S53, based on captured images Create a new blank image of the same size and color space as the first image you captured. The accumulation starts in the blank image. The accumulation principle is to represent the grayscale pixel points of the tool (14) at different angles when the spindle (12) rotates. frame After iteration, we get the image ; S54, based on the same structure factor and different coordinate grayscale differences, the image is obtained The corner characteristic curve with curvature difference characteristics composed of a series of pixel points is obtained, and then the radius value r of the corner is obtained based on the least square fitting method, that is, the second measurement of the tool (14) parameters is completed; S6, evaluating the parameters of the corresponding tool (14) and tool holder (13) after the tool change based on the measured parameters; S7, based on the evaluation result, decide whether to perform a tool change again; if yes, after the tool change is performed again, return to step S1; if no, the tool measurement work before processing is completed, and the CNC machine tool performs part processing; The post-processing tool measurement: that is, after the part processing is completed, steps S1 to S7 are repeated, and based on the evaluation result of step S7, it is judged whether the tool (14) has any abnormality; if the tool (14) has no abnormality, 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 according to claim 1, characterized in that: The fill light unit of the automatic tool measuring device comprises a planar fill light component (11) arranged on the opposite side of the measuring camera (1) and an annular fill light component (10) arranged with the detection camera (2) as the center, and the planar fill light component (11) comprises 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 claimed in claim 1, characterized in that: In step S1, detecting the tool measuring hardware function of the automatic tool measuring device includes the following steps: S11, Configuration Activation: Activation based on The developed camera calls the test code and turns on the fill light 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. The images obtained by the measurement camera (1) and the detection camera (2) are respectively used and express; S12, camera and fill light function test: obtain the current measurement space through the measurement camera (1) and the detection camera (2) Images and Image, and Images and The image is evaluated for quality; if the quality evaluation result does not meet the requirements, the fill light unit, the measuring camera (1) and the detection camera (2) are turned on again, and the process returns to step S11; if the quality evaluation result meets the requirements, it indicates that the image capture hardware function test is completed, and the measuring camera (1), the detection camera (2) and the fill light unit are turned off, and the process goes to step S13; S13, automated auxiliary function test: the Raspberry Pi (4) controls the motor device (9) to open the device top plate (6), and at the same time opens the dust cover (7) on the measuring camera (1) and the detection camera (2), in preparation for the tool measuring operation; during this period, if the device top plate (6) and the dust cover (7) can be opened smoothly, it indicates that the automated auxiliary function has not failed, and the tool measuring hardware function test is completed; if the device top plate (6) and / or the dust cover (7) cannot be opened smoothly, it indicates that the automated auxiliary function has failed, and after the corresponding failure is repaired, the process returns to step S1.
4. The automatic tool measuring method for a CNC machine tool as claimed in claim 3, characterized in that: In step S12, Images and The method for image quality evaluation is to evaluate the difference in the random distribution of global pixel brightness in the image. The evaluation formula for image quality evaluation results that meet the requirements is expressed as ;in, is a function for sorting pixel gray values. Represents an image with analytical processing; represents the number of the object image, Indicates the number of rows of image pixels. Indicates the number of columns of image pixels, Represents the distance between adjacent pixels. Indicates the preset pixel position ratio brightness threshold.
5. The automatic tool measuring method for a CNC machine tool as claimed in claim 1, characterized in that: In step S2, moving the machine tool spindle (12) to a preset measuring point to prepare for measurement includes the following steps: S21, the Raspberry Pi (4) sends a preparation completion signal to the CNC system of the machine tool. After receiving the preparation completion signal, the CNC system of the machine tool controls the machine tool spindle (12) to move to the measurement point of the automatic tool measuring device pre-set in the CNC system. The fixed point directly above ; Among them, the measurement point and fixed point are all coordinate points in the machine tool coordinate system, and the measurement points It is the geometric center of the automatic tool measuring device; S22, the machine tool numerical control system sends an initial arrival signal to the Raspberry Pi (4), and after the Raspberry Pi (4) receives the initial arrival signal, it starts the measuring camera (1), the detection camera (2) and the fill light unit based on the main measurement program pre-set in the Raspberry Pi (4); S23, the Raspberry Pi (4) sends a measurement start signal to the machine tool numerical control system. After receiving the measurement start signal, the machine tool numerical control system controls the machine tool spindle (12) to move from a fixed point Move down to the measuring point At the position, interactive registration is completed; S24, the machine tool numerical control system sends a trigger signal to the Raspberry Pi (4), and after the Raspberry Pi (4) receives the trigger signal, it controls the automatic tool measuring device to start measuring.
6. The automatic tool measuring method for a CNC machine tool as claimed in claim 1, characterized in that: In step S3, the first measurement of tool (14) parameters based on the side image and the end face image comprises the following steps: S31, respectively controlling the measuring camera (1) and the detection camera (2) to read the configuration files para1.txt and para2.txt stored in advance at the agreed location in the memory of the Raspberry Pi (4), and to initialize 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 side images image1 of the tool handle (13) and the tool (14) and an end face image image2 of the tool (14); S32, obtaining a set of measurement samples consisting of a number of images for image 1 and image 2 respectively, and selecting image 1 and image 2 with better quality from the batch of images of the measurement samples based on a preset image optimization strategy; S33, completing the measurement of non-rotational parameters of the tool handle (13) and the tool (14) from the optimally selected image 1; and completing the detection of abnormal conditions of the tool (14) from the optimally selected image 2.
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 comprises the following steps: S41, the Raspberry Pi (4) sends a position calibration signal to the machine tool numerical control system. After receiving the position calibration signal, the machine tool numerical control system controls the machine tool spindle (12) to move an initial distance along the negative direction of the Z axis of the machine tool coordinate system, thereby changing the coordinate of the machine tool spindle (12). value; S42, the machine tool numerical control system sends a Z-axis displacement signal to the Raspberry Pi (4), and 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: Maintain the coordinates of the machine tool spindle (12) along the machine tool coordinate system The value remains unchanged, and the Raspberry Pi (4) controls the CNC system of the machine tool to move the machine tool spindle (12) based on communication interaction, changes the X-axis and / or Y-axis coordinates of the machine tool spindle (12) in the machine tool coordinate system, and makes the distance between the end point of the tool (14) and the lens of the measuring camera (1) the minimum viewing distance of the camera. , that is, the position calibration of the machine tool spindle (12) is completed.
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 an image and obtain an image dst; S422, identifying the coordinate value of the end point of the tool (14) in the image dst on the Y axis , coordinate value Used to represent the tool (14) feature, for the machine tool in the captured image The value changes and is synchronized with the corresponding tool (14) feature in the dst image. on changes in 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 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, according to the distance deviation value The positive and negative values of the machine tool spindle (12) are used to calibrate the Z-axis position of the machine tool coordinate system, that is: If the distance deviation value If it is negative, it means the coordinate of the machine tool spindle (12) The value is greater than the target value, and the Raspberry Pi (4) controls the machine tool CNC system to move the machine tool spindle (12) along the negative direction of the Z axis of the machine tool coordinate system based on communication interaction, and the single movement distance does not exceed 1 / 50 of the total length of the automatic tool measuring device; If the distance deviation value is positive, indicating the coordinates of the machine tool spindle (12) The value is less than the target value, and the Raspberry Pi (4) controls the machine tool CNC system to move the machine tool spindle (12) along the positive direction of the Z axis of the machine tool coordinate system based on communication interaction, and the single movement distance does not exceed 1 / 100 of the total length of the automatic tool measuring device; S426, repeating steps S421 to S425, so that the Raspberry Pi (4) and the CNC system of the machine tool can continuously communicate and interact to achieve the adaptive calibration of the tool end position until the corresponding distance deviation value is , that is, the calibration is completed; among them, To pre-set the distance deviation threshold.
Citation Information
Patent Citations
Rotary cutter failure state on-machine monitoring system and detection method thereof
CN111830906A
Machine vision-based cutter type discrimination and geometric parameter detection method and system
CN112683193A
