Tool replacement method, device and computer storage medium
By identifying the positions of tools and obstacles to be replaced and calculating the shortest path without collision, the problem of fixed path planning during tool replacement of CNC machine tools is solved, and the replacement success rate and operation efficiency are improved.
Patent Information
- Application Number
- CN202411112266.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-08-14
AI Technical Summary
During the replacement of CNC machine tool tools, the path planning is fixed and cannot effectively adapt to changes in the working environment, resulting in a decrease in replacement success rate and operating efficiency.
By identifying the status image of the tool to be replaced, determining the target storage coordinates, and calculating the shortest collision-free path in combination with the obstacle position coordinates, and generating control instructions to drive the actuator to complete the replacement action.
It realizes efficient and accurate tool replacement, improves the automation level and operation efficiency of CNC machine tools, and adapts to complex or changing working environments.
Smart Images

Figure CN118650471B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of automated control systems, and in particular to a tool replacement method, device and computer storage medium. Background Art
[0002] In the automated operation of CNC machine tools, the accuracy and efficiency of tool replacement are crucial and directly affect the improvement of production efficiency. In related technologies, the tool replacement process is mainly limited by the preset mechanical program, and the tool change path planning is fixed, so the tool replacement method lacks the ability to adapt to the dynamic changes in the working environment. This limitation leads to the possibility that the preset path may conflict with the actual spatial layout in complex or changing working environments, thereby reducing the success rate of tool change operations and the overall operating efficiency of the machine tool. Summary of the invention
[0003] The main purpose of the present application is to provide a tool replacement method, device and computer storage medium, aiming to solve the technical problem that the tool replacement process of a CNC machine tool cannot effectively adapt to changes in the working environment due to fixed path planning.
[0004] To achieve the above-mentioned purpose, an embodiment of the present application provides a tool replacement method, which is applied to a CNC machine tool, and the method comprises:
[0005] Identify the tool to be replaced based on the status image of the tool on the machine;
[0006] Determine the storage coordinates of the target tool corresponding to the tool to be replaced according to the coordinate database of the tool library;
[0007] Receiving image data of a machine tool workspace and acquiring the coordinates of obstacles in the machine tool workspace;
[0008] Calculate the collision-free shortest path from the current coordinates to the storage coordinates using the current coordinates of the tool to be replaced, the storage coordinates, and the obstacle position coordinates;
[0009] A corresponding control instruction is generated based on the collision-free shortest path, and the control instruction is sent to an actuator to drive the actuator to complete a tool replacement action.
[0010] In one embodiment, before the step of identifying the tool to be replaced based on the status image of the tool on the machine, the following steps are included:
[0011] Collecting tool image data, the tool image data includes an image of a machine tool and an image of a tool in the tool library;
[0012] Performing normalization processing on the tool image data;
[0013] Determine the bounding box of each tool in the normalized tool image data, and mark the upper left corner coordinates and the lower right corner coordinates of each of the bounding boxes, as well as the tool category and tool status of the corresponding bounding box;
[0014] Data enhancement is performed on the annotated tool image data, and the brightness and contrast of the annotated tool image data are adjusted, and blur and noise are added to obtain an enhanced data set of the annotated tool image data.
[0015] In one embodiment, after the step of obtaining the enhanced data set of the annotated tool image data, the following steps are included:
[0016] Selecting tool images and corresponding annotations in predetermined batches from the enhanced data set to form an input batch;
[0017] Inputting the tool images of the input batch into the model in sequence and performing forward propagation to obtain prediction results of the tool images;
[0018] Determine the loss value of the prediction result and the corresponding annotation by using the loss function;
[0019] Based on the loss value, gradient calculation is performed on the model parameters, a back propagation algorithm is executed, and the model parameters are updated to minimize the loss function;
[0020] If the loss value corresponding to the input batch is lower than the preset performance improvement threshold in a set number of consecutive iterations, the performance of the model is judged to be stable;
[0021] When the performance of the model is stable or reaches a preset number of iterations, the iteration is completed and the final model parameters are determined to construct a tool recognition model.
[0022] In one embodiment, the step of identifying the tool to be replaced based on the status image of the tool on the machine includes:
[0023] Collecting a state image of the on-machine tool and inputting the state image into a tool recognition model;
[0024] Based on the tool recognition model, obtaining the on-machine tool category and on-machine tool state corresponding to the state image;
[0025] The tool to be replaced is determined according to the type of the tool on the machine and the state of the tool on the machine.
[0026] In one embodiment, the step of determining the storage coordinates of the target tool corresponding to the tool to be replaced according to the coordinate database of the tool library includes:
[0027] Determine the tool number of the tool to be replaced according to the on-machine tool category of the tool to be replaced;
[0028] Based on the tool number, a matching query is performed in a tool library to determine the target tool;
[0029] Based on the target tool, the storage coordinates of the target tool in a coordinate database are determined.
[0030] In one embodiment, the step of receiving image data of a machine tool workspace and obtaining the coordinates of obstacles in the machine tool workspace comprises:
[0031] Inputting the image data into a tool recognition model to obtain a classification result of the image data;
[0032] extracting non-tool objects as obstacle data according to the classification result;
[0033] The position information of the obstacle data in the image data is converted into coordinate points in the machine tool coordinate system to obtain the obstacle position coordinates.
[0034] In one embodiment, the step of calculating the collision-free shortest path from the current coordinates to the storage coordinates using the current coordinates of the tool to be replaced, the storage coordinates, and the obstacle position coordinates comprises:
[0035] Dividing the machine tool workspace into a plurality of grid units, each grid unit corresponding to a coordinate point;
[0036] Marking the current coordinates of the tool to be replaced, the storage coordinates of the target tool, and the coordinates of the obstacle position on the grid unit;
[0037] Using a path planning algorithm to traverse all paths from the current coordinates to the stored coordinates, and excluding paths that overlap with the obstacle position coordinates, to obtain optional paths;
[0038] Among the optional paths, the shortest path is selected as the collision-free shortest path from the current coordinate to the stored coordinate.
[0039] In one embodiment, the step of generating a corresponding control instruction based on the collision-free shortest path, sending the control instruction to an actuator, and driving the actuator to complete the tool replacement action includes:
[0040] The actuator is a bionic mechanical claw, which receives the control instruction and drives itself to move to the storage coordinates of the target tool according to the control instruction;
[0041] The bionic mechanical claw is integrated with a sensing feedback system, and can adjust movement parameters according to force feedback during movement to ensure the actual contact force between the tool and the machine tool.
[0042] An embodiment of the present application also provides a tool replacement device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the tool replacement method as described above.
[0043] An embodiment of the present application further provides a computer storage medium, which is a computer-readable storage medium. A computer program is stored on the computer storage medium. When the computer program is executed by a processor, the steps of the tool replacement method described above are implemented.
[0044] The embodiment of the present application discloses a tool replacement method, which identifies the tool to be replaced according to the status image of the tool on the machine; determines the storage coordinates of the target tool corresponding to the tool to be replaced according to the coordinate database of the tool library; receives the image data of the machine tool workspace, and obtains the obstacle position coordinates in the machine tool workspace; uses the current coordinates of the tool to be replaced, the storage coordinates, and the obstacle position coordinates to calculate the collision-free shortest path from the current coordinates to the storage coordinates; generates corresponding control instructions based on the collision-free shortest path, and sends the control instructions to the actuator to drive the actuator to complete the tool replacement action. The present application locates the storage coordinates of the tool to be replaced and its target tool, and combines the obstacle position coordinates to calculate the collision-free shortest path for tool replacement, thereby achieving efficient and accurate tool replacement and improving the automation level and operating efficiency of CNC machine tools. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 It is a flow chart of an embodiment of a method for replacing a tool involved in an embodiment of the present application;
[0046] Figure 2 It is an iterative training process of a tool recognition model based on a YOLOV8 model in an embodiment of a tool replacement method according to an embodiment of the present application;
[0047] Figure 3 This is a flow chart of another embodiment of the tool replacement method involved in the embodiment of the present application;
[0048] Figure 4 This is a schematic diagram of the structure of the tool changing equipment for this application.
[0049] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0050] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0051] In the automated operation of CNC machine tools, the accuracy and efficiency of tool identification and tool replacement are crucial, directly affecting the improvement of CNC machine tool production efficiency. In related technologies, tool identification is mainly achieved through sensor technology, such as using RFID tags and barcodes. However, sensor technology requires precise marking of each tool, and may be constrained by physical location and environmental factors during the identification process. The tool replacement process is mainly limited by the preset mechanical program, and the tool change path planning is fixed, so the tool replacement method lacks the ability to adapt to dynamic changes in the working environment. This limitation leads to the possibility that the preset path may conflict with the actual spatial layout in complex or changing working environments, thereby reducing the success rate of tool change operations and the overall operating efficiency of the machine tool.
[0052] In addition, current automatic tool changing systems are mostly operated by simple robotic arms. These systems are often limited to preset paths in terms of motion control and lack advanced control of operational finesse, such as force feedback or bionic feel, making it difficult to accurately handle the tool during tool change.
[0053] In order to solve the above-mentioned defects existing in the related art, the embodiment of the present application proposes a tool replacement method, which identifies the tool to be replaced according to the state image of the tool on the machine; determines the storage coordinates of the target tool corresponding to the tool to be replaced according to the coordinate database of the tool library; receives the image data of the machine tool workspace, and obtains the obstacle position coordinates in the machine tool workspace; uses the current coordinates of the tool to be replaced, the storage coordinates and the obstacle position coordinates to calculate the collision-free shortest path from the current coordinates to the storage coordinates; generates corresponding control instructions based on the collision-free shortest path, and sends the control instructions to the actuator to drive the actuator to complete the tool replacement action. The present application locates the storage coordinates of the tool to be replaced and its target tool, and combines the obstacle position coordinates to calculate the collision-free shortest path for tool replacement, thereby achieving efficient and accurate tool replacement and improving the automation level and operating efficiency of CNC machine tools.
[0054] In the embodiment of the present application, the control system, as the core part of the tool change monitoring solution, integrates a computerized numerical control (CNC) system or a machine tool control system, and is responsible for real-time communication with the visual sensor and the image processing unit. During the tool change process, the control system triggers the visual sensor or collects images through the camera according to the CNC program or the operator's instructions. The collected image data is transmitted to the image processing unit, and the processed feature information is returned to the control system. The control system performs real-time analysis on the various collected image data to ensure the correct identification and status monitoring of the tool. In addition, the control system is also responsible for monitoring the movement path of the tool and comparing the actual path tracked by the visual sensor with the preset planned path. When a deviation is detected, the control system will make timely adjustments to ensure the accuracy and safety of the tool change process. The control system has a data recording function, which records the key data in each tool change process in detail, including timestamps, tool information, and path deviations. At the same time, the control system achieves close monitoring of the entire operation process through its monitoring and feedback mechanism. Once any abnormal situation is found, such as tool identification errors or path deviations, the control system will immediately issue an alarm and take corresponding measures to avoid potential risks.
[0055] For ease of understanding, the technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0056] For the tool replacement method of the first embodiment proposed in this application, please refer to Figure 1 The method comprises steps S10 to S50:
[0057] S10: Identify the tool to be replaced based on the status image of the tool on the machine.
[0058] In an optional embodiment, before the step of identifying the tool to be replaced based on the status image of the machine tool, tool image data can be collected first, the tool image data including images of the machine tool in a worn state and a normal state, and images of the tool in the tool library.
[0059] For example, cameras are equipped in key areas of CNC machine tools, including the tool magazine entrance, tool transfer path, and tool change installation position, so as to provide comprehensive visual monitoring of the on-machine tools, tool magazine, and machine tool workspace. The acquisition process of the status image of the on-machine tool is triggered by a timer in the machine tool control system and is automatically executed at preset time intervals. In the machine tool control system, the timer setting can be dynamically adjusted according to the operating status of the machine tool to adapt to different processing tasks and tool wear rates. For example, in the case of high-intensity processing or rapid tool wear, the timer can increase the frequency of image acquisition and monitor the status of the on-machine tool more closely to ensure timely and accurate identification of any possible replacement needs.
[0060] After the acquisition is triggered, the camera will capture the current state image of the tool on the machine and convert the current state image into a digital signal. The digital signal is transmitted to the control system of the machine tool via industrial Ethernet or wireless communication technology. After receiving the image data, the control system stores the data in the cache and starts the image processing algorithm at the same time to pre-process the image data, including denoising, contrast enhancement and other operations to improve the accuracy of subsequent image recognition. The pre-processed image data is sent to the tool recognition model to identify the state of the tool on the machine.
[0061] It can be understood that the state image acquisition of the machine tool includes not only images in the wear state and the normal state, but also image data of various types of tools in the tool library.
[0062] Optionally, the control system is equipped with a machine learning-based condition monitoring algorithm that can analyze the operating data of the machine tool's in-machine tools in real time and trigger image acquisition immediately once signs of tool wear or damage are detected.
[0063] Then, the collected tool image data is normalized so that the pixel value of each image in the tool image data is distributed in the interval [0, 1].
[0064] For example, the collected tool image data is first input into an image processing unit in the control system, which is responsible for normalizing the pixel values of the tool image data to ensure uniform and standardized input for subsequent processing.
[0065] During the normalization process, the control system automatically determines the range of pixel values in the tool image data, from the minimum value to the maximum value. The control system then applies the normalization algorithm to transform the pixel values of each tool image data so that the pixel values are mapped to the [0,1] interval.
[0066] After the normalization algorithm is executed, the control system verifies all pixel values to ensure that all pixel values have been correctly converted to the specified interval.
[0067] In the normalized tool image data, the bounding box of each tool is identified, and the upper left corner coordinates and lower right corner coordinates of the bounding box are marked. At the same time, the tool category and tool status of each bounding box are marked. Finally, the marked tool image data is enhanced. By adjusting the brightness and contrast of the marked tool image data and adding blur and noise, the tool images taken under different shooting conditions and environmental factors can be simulated to obtain an enhanced data set of the tool image data.
[0068] Specifically, the image processing unit in the control system applies an image segmentation algorithm to separate the area of each tool in the image from the background. After the separation is completed, the control system identifies the outline of the tool and determines the bounding box of the tool. The upper left corner coordinates and the lower right corner coordinates of the bounding box are accurately marked, and these two coordinates define the position and range of the tool in the image. Next, the control system marks the category and status of the tools in each bounding box. The category marking is used to identify the number or type of the tool, and the status marking is used to identify the wear or normal state of the tool. The marking information is combined with the bounding box coordinates to form the metadata of the tool image data. Finally, the image processing unit realizes the accurate identification and positioning of the tools in the image, and provides detailed attribute information for each tool, thereby constructing a tool image dataset containing rich metadata.
[0069] After completing the recognition and annotation of the bounding box, the image processing unit continues to perform data enhancement on the tool image data set. The image processing unit first adjusts the brightness level of the tool image data to simulate the image performance under different lighting environments. Then, the contrast of the tool image data is enhanced to simulate the visual effect of the image under different clarity conditions. In addition, the image processing unit also adds a blur effect to the tool image data to simulate the image blur caused by camera shake or focusing problems. At the same time, random noise can also be injected into the tool image data to simulate the image quality degradation that may be encountered in an undesirable shooting environment. By performing data enhancement on the tool image data, the image processing unit is able to generate a series of tool image data variants, which are visually different from the original tool image data but consistent in content. The tool image data variants are combined with the original tool image data to form an enhanced data set of tool image data, thereby obtaining a wider range of image samples.
[0070] In another optional implementation, after obtaining the enhanced data set of tool image data, the control system can use the YOLOV8 model to identify the tool type and state, please refer to Figure 2 , Figure 2 The iterative training process of the tool recognition model based on the YOLOV8 model in the embodiment of the present application specifically includes the following steps:
[0071] S101: Selecting tool images and corresponding annotations in predetermined batches from the enhanced data set to form an input batch.
[0072] For example, the control system automatically selects images from the enhanced data set of tool image data according to the preset batch size. For example, if the batch size is set to 32, the control system will randomly or in a specific order select 32 tool image data. The selected tool image data includes various tool image data variants generated by data enhancement, such as images with different brightness, contrast, blur and noise levels, as well as original tool image data, to ensure that the model can learn under diverse visual conditions.
[0073] During the tool image data selection process, the control system not only considers the image itself, but also ensures that each tool image data has corresponding annotation information. The annotation information includes the tool's bounding box coordinates, category (such as drill, milling cutter, etc.) and status (such as new, worn, etc.). The control system matches the annotation information with the image one by one to ensure that each tool image data has accurate annotation information for reference during model training.
[0074] After forming the input batch, the control system combines the tool image data and annotation information of the input batch into a format suitable for model training. For example, the image data is converted to a specific data type or normalized to a specific numerical range, and the annotation information is converted into a format that the model can understand, such as one-hot encoding or a specific representation method of a bounding box.
[0075] It is understandable that the predetermined batch size and input batch can be set according to the amount of actual image data or specific scenarios, and this embodiment does not impose any limitation.
[0076] S102: Inputting the tool images of the input batch into the model in sequence and performing forward propagation to obtain prediction results of the tool images.
[0077] For example, the control system extracts the tool image data and corresponding annotation information of the first input batch from the input batch generated in step S101. Then the tool image data of the first input batch is input into the YOLOV8 model to start the forward propagation process. During the forward propagation process, the tool image data flows through multiple layers of the model, and each layer is responsible for extracting and converting the image features of the tool image data until the output layer generates a prediction result.
[0078] It should be noted that the YOLOV8 model is a deep learning model that predicts the location and category of objects in an image through a single forward propagation, thereby achieving rapid detection. The YOLOV8 model usually contains multiple convolutional layers and fully connected layers, and uses deep learning technology to extract features from image data and identify and locate objects.
[0079] It can be understood that the prediction results of the model include the prediction of the bounding box position, category and state of the tool in the tool image data.
[0080] S103: Determine the loss value of the prediction result and the corresponding annotation using a loss function.
[0081] For example, the control system first receives the prediction results from the forward propagation, and then uses the loss function to compare the prediction results with the actual annotation information to calculate the loss value. In the YOLOV8 model, the mean square error loss function or the cross entropy loss function is usually used to measure the difference between the predicted bounding box coordinates, category probabilities, tool states, and object confidence and the actual annotations. For example, if the model predicts the location of a bounding box, but there is a deviation between that location and the actual annotated bounding box, the loss function will calculate the size of this deviation. Similarly, if the category probability or tool state predicted by the model does not match the actual annotation, the loss function will also calculate the degree of this mismatch. The calculation of the loss value involves evaluating all predicted images and summarizing these evaluation results to obtain the total loss value for the entire batch.
[0082] It can be understood that the loss value not only reflects the difference between a single prediction and the annotation information, but also reflects the model performance of the entire batch. The control system guides the back propagation and update process of the model parameters by using the loss value.
[0083] S104: Based on the loss value, perform gradient calculation on the model parameters, execute a back propagation algorithm, and update the model parameters to minimize the loss function.
[0084] For example, when the loss value is calculated, the control system enters the back-propagation phase. In the back-propagation phase, the control system differentiates the loss function to obtain the gradient of the loss relative to the model parameters. Next, the control system updates the parameters of the model using the gradient descent method based on the gradient information. The control system then multiplies the calculated gradient value by a preset learning rate to determine the step size for updating the model parameters. After updating the parameters, the predictive performance of the model will be improved, reducing the difference with the actual labeled information. The control system will continue to monitor changes in the loss value to ensure that the parameter update has a positive impact on the model performance. If the loss value does not decrease significantly in consecutive iterations, or fluctuates, the control system can adjust the learning rate or other hyperparameters to ensure that the model converges stably to the minimum loss value.
[0085] It can be understood that the gradient is a vector, the direction of the vector points to the direction where the loss function grows fastest, and the opposite direction of the vector points to the steepest path to reduce the loss. Therefore, the gradient provides the specific direction and magnitude of adjusting the model parameters, and the control system will update the parameters along the direction of the gradient vector.
[0086] It is understandable that the learning rate is a hyperparameter that controls the amplitude of parameter updates. Too small a learning rate may lead to slow model training, while too large a learning rate may lead to instability during training.
[0087] S105: If the loss value corresponding to the input batch is lower than a preset performance improvement threshold in a set number of consecutive iterations, it is determined that the performance of the model is stable.
[0088] For example, after completing the image data processing, loss value calculation and model parameter update of a batch, the control system does not immediately enter the processing of the next batch, but continues to perform further iterative processing on the image data of the same batch to optimize the model parameters. The iterative process will be repeated until the image data of the corresponding batch has been processed, the loss value is calculated and the model parameters are updated.
[0089] Optionally, after completing the loss calculation and model parameter update for each batch, the control system will evaluate whether the model performance has stabilized. The evaluation of model performance is based on the change in the loss value. The control system will preset a performance improvement threshold and observe whether the loss value decreases below the preset performance improvement threshold in a preset number of consecutive iterations.
[0090] Specifically, after each iteration, the control system calculates and records the new loss value. If after several iterations, the reduction in the loss value has been very small, that is, the loss value reduction in the consecutive preset number of iterations is lower than the preset performance improvement threshold, the control system will determine that the performance of the model has reached a stable state. This means that the model has fully learned the tool image data in the current batch, and further training may not significantly improve performance. For example, the preset performance improvement threshold is 1% of the loss value reduction, and the preset number of times is set to three. If the loss value is reduced by less than 1% in three consecutive iterations, the control system will consider that the performance of the model has stabilized. At this point, the control system will stop further iterations of the current batch, and instead process a new batch to continue optimizing the model.
[0091] In the new batch, the control system repeats the process of forward propagation, loss value calculation and model parameter update to continue training the model. This iterative process is repeated until all batches of image data have been processed or the improvement of model performance is no longer significant, reaching the predetermined training goal.
[0092] S106: When the performance of the model is stable or reaches a preset number of iterations, the iteration is completed and the final model parameters are determined to construct a tool recognition model.
[0093] Specifically, after step S105 is completed, the control system will evaluate whether the conditions for ending iterative training are met. If the reduction in the loss value of the model in the preset number of iterations has been lower than the preset performance improvement threshold, or the model has completed the preset number of iterations, that is, the number of iterations of the input batch, the control system will consider that the performance of the model has stabilized and is ready to end the training.
[0094] At this point, the control system will use the currently updated model parameters as the final parameters. The final parameters are obtained through multiple iterations and parameter updates, which enable the model to achieve the best performance when processing training data. The control system solidifies these parameters to build a complete tool recognition model that can accurately identify the type and status of the tool in the image.
[0095] Optionally, after constructing the tool recognition model, the model can be evaluated for performance. The model can be tested under a variety of simulated environmental conditions, including different lighting intensities, shadows and other environmental factors. Then, by predicting the tool image data collected in the simulated environment, the prediction results of the corresponding tool image data are generated. Subsequently, the control system will automatically compare the predicted output of the model with the annotation information of the corresponding tool image data to determine the accuracy of the prediction. Ultimately, the performance evaluation results can be used to guide the fine-tuning and parameter adjustment of the model. During the evaluation process, model evaluation data and feedback are collected and used for iterative improvement of the model to ensure that the model can continuously adapt to the dynamic changes in the working environment.
[0096] Optionally, based on the status image of the on-machine tool, the step of identifying the tool to be replaced may also include: acquiring the status image of the on-machine tool, and inputting the status image into a tool recognition model; based on the tool recognition model, obtaining the on-machine tool category and on-machine tool status corresponding to the status image; and determining the tool to be replaced based on the on-machine tool category and the on-machine tool status.
[0097] For example, the control system performs the step of identifying the tool to be replaced and starts to collect the status image of the tool on the machine. After the camera captures the status image of the tool on the machine, the status image is transmitted to the control system, which loads the tool recognition model. Then, the status image is input into the tool recognition model, and analysis is performed to identify the tool category and tool status in the image to obtain a prediction result, including the tool type and tool status label. The prediction result is then directly fed back to the control system. Based on the prediction result, the control system determines whether the tool on the machine meets the replacement conditions. For example, if the tool recognition model identifies that the tool status is "worn" and the wear status exceeds the preset wear threshold, the control system will mark the tool as a tool to be replaced.
[0098] S20: Determine the storage coordinates of the target tool corresponding to the tool to be replaced according to the coordinate database of the tool library.
[0099] It should be noted that the coordinate database is a system that stores the storage location information of each tool in the tool library of a CNC machine tool. The coordinate database records the number of each tool in the tool library and the corresponding storage coordinates, which are based on the reference point of the machine tool. A unified machine tool coordinate system is used to define the position of each tool. The coordinate database enables the control system of the CNC machine tool to quickly and accurately query the specific storage coordinates of each tool, providing the necessary spatial positioning information for automated tool changing.
[0100] It can be understood that the storage coordinates refer to the specific location of the tool in the tool library, which is determined by the values of the three coordinate axes X, Y, and Z. The storage coordinates are the position information in the machine tool workspace, which are used to guide the tool changer or other actuators to accurately move to the target tool storage point during the tool change process to perform tool removal or replacement operations.
[0101] In an optional implementation scheme, before obtaining the storage coordinates of the target tool, the tool number of the tool to be replaced is first determined according to the on-machine tool category of the tool to be replaced. Then, a query is performed in the coordinate database of the tool library according to the tool number of the tool to be replaced. During the query process, the control system will find the target tool with the same number for replacement according to the tool number of the tool to be replaced. When the target tool is determined, the control system directly extracts the storage coordinates of the target tool from the coordinate database.
[0102] S30: receiving image data of a machine tool workspace, and acquiring the coordinates of obstacles in the machine tool workspace.
[0103] In an optional embodiment, the control system receives image data captured by a visual sensor or camera from the machine tool workspace. The image data is then input into a pre-trained tool recognition model to classify the image data content, distinguish between tool objects and non-tool objects in the image, and output the classification results. The control system extracts non-tool objects based on the classification results and regards non-tool objects as potential obstacles. Subsequently, the control system converts the position information of the obstacles identified in the image data, maps the coordinates of the obstacles from the image coordinate system to the machine tool coordinate system, and obtains the obstacle position coordinates.
[0104] It should be noted that tool objects refer to cutting tools used to process workpieces, such as milling cutters, drills, etc. Non-tool objects refer to all other objects except cutting tools used to process workpieces, including: the workpiece itself, such as materials or parts being processed or waiting to be processed; fixtures and other devices used to fix workpieces; machine tool parts, such as the machine bed, guide rails, slides, etc.; tools and auxiliary equipment, such as equipment used to measure or collect images; and parts or material fragments scattered in the work area.
[0105] It can be understood that the purpose of unifying the obstacle coordinates into the machine tool coordinate system is to keep the obstacle coordinates, the current coordinates of the tool to be replaced, and the storage coordinates of the target tool in the same coordinate system, so as to facilitate the positioning and calculation of the tool replacement operation.
[0106] Optionally, the control system can use multi-sensor fusion technology to combine visual sensors and laser radar or ultrasonic sensors to achieve comprehensive monitoring of the machine tool workspace. First, the visual sensor captures the image data of the machine tool workspace, and then provides the distance and shape information of the objects in the machine tool workspace through the laser radar or ultrasonic sensor. The control system fuses the image data, the distance data of the object, and the shape data of the object to identify and locate the obstacle, and maps the position of the obstacle to the coordinate point of the machine tool coordinate system to obtain the obstacle position coordinates.
[0107] S40: Calculate a collision-free shortest path from the current coordinates to the storage coordinates using the current coordinates of the tool to be replaced, the storage coordinates, and the obstacle position coordinates.
[0108] In an optional implementation scheme, based on the current coordinates of the tool to be replaced, the storage coordinates of the target tool, and the coordinates of the obstacle position in the machine tool workspace, the shortest path from the current coordinates of the tool to be replaced to the storage coordinates of the target tool can be calculated. First, the machine tool workspace is divided into a plurality of grid units, each grid unit corresponding to a coordinate point. On the grid unit, the current coordinates of the tool to be replaced, the storage coordinates of the target tool, and the coordinates of the obstacle position are marked. Then, a path planning algorithm is used to traverse all possible paths from the current coordinates to the storage coordinates, and the paths that intersect with the obstacle position coordinates are excluded from the possible paths to screen out collision-free optional paths. Finally, the shortest path is selected from the optional paths as the collision-free shortest path from the current coordinates to the storage coordinates.
[0109] It should be noted that gridding of space is a method of discretizing continuous space, which allows the algorithm to operate in a limited and well-defined area.
[0110] Optionally, a graph search-based algorithm can be used to implement the shortest path planning. The machine tool workspace is constructed into a weighted graph, in which the key positions in the machine tool workspace are abstracted as nodes in the graph. The nodes specifically include the current position of the tool to be replaced, the storage location of the target tool, and the edge of obstacles or machine tool structure feature points that may affect the moving path. Each node corresponds to a specific coordinate in the machine tool coordinate system. The edge represents a feasible moving path between nodes, and the weight of the edge can be expressed as the length of the path, the time required to pass the path, the energy consumption of passing the path, or the priority based on safety considerations. After the weighted graph is constructed, the optimal path can be found using a graph search algorithm, such as the Dijkstra algorithm or the A* search algorithm, to calculate the shortest path from the current coordinates of the tool to be replaced to the target coordinates, while considering avoiding obstacles.
[0111] For example, the control system identifies key locations in the workspace and defines them as nodes in the graph. These nodes include the current location of the tool to be replaced, the storage location of the target tool, and the edge of obstacles or structural feature points in the machine tool workspace that may affect the movement path. Each node is assigned specific coordinates in the machine tool coordinate system. After the nodes are determined, the control system creates edges between these nodes, and each edge represents a potential movement path between two nodes. The existence of edges not only indicates spatial connectivity, but also reflects specific attributes of the path through weights. For example, the inverse of the straight-line distance between two nodes may be used as a weight to reflect the length of the path; or the weight may be assigned based on the expected movement time, energy consumption, or the size of the safety buffer area. The weight is assigned based on factors such as the length of the path, the expected passing time, energy consumption, or safety priority. For example, a path close to an obstacle may be assigned a higher weight to indicate a lower priority.
[0112] The control system further ensures that the presence of obstacles is reflected through the weight adjustment of the edges. Paths near obstacles may be assigned larger weight values, indicating paths that should be avoided or suboptimally selected in planning.
[0113] As edges are created and weights are assigned, the control system builds a complete weighted graph in which each node and edge together represent the topology and movement cost of the machine tool workspace.
[0114] Optionally, the control system uses the Dijkstra algorithm when determining the optimal path, which finds the shortest path from the source point to all other nodes by gradually relaxing the distances of all edges in the graph. At the beginning of the algorithm, the distance from the source point to itself is set to 0, and the distances of all other nodes are set to infinity. Then, the control system adds the source point to a priority queue, which is arranged in increasing order of node distance. In each iteration, the control system takes out the node with the minimum distance value from the queue, updates the distances of all its unvisited adjacent nodes, and if the distance to the adjacent node through the current node is shorter, updates the distance of the adjacent node and adds it to the priority queue. This process continues until all nodes are visited or the target node is visited.
[0115] For example, if the weighted graph of the machine tool workspace contains multiple nodes, the Dijkstra algorithm will start from the source point and gradually update the distances of all reachable nodes. In each iteration, the control system will consider all edges starting from the current node. If the distance to a new node through an edge is less than the known shortest distance, the distance value of the new node is updated and added to the priority queue. In this way, the algorithm gradually expands until it reaches the target node, at which point the distance to the target node in the queue is the length of the shortest path.
[0116] Optionally, the control system uses an A* search algorithm when determining the optimal path. The A* search algorithm introduces a heuristic function based on the Dijkstra algorithm, which is used to estimate the cost from the current node to the target node. The control system uses the heuristic function to guide the search process. In the A* algorithm, each node has an f value, which consists of two parts: the g value (the actual cost from the source point to the current node) and the h value (the estimated cost of the heuristic function). The control system always selects the node with the smallest f value for expansion, so that it can search faster in the direction of the target node.
[0117] For example, if the layout and obstacle distribution of the machine tool workspace are known, a heuristic function can be designed to estimate the straight-line distance or obstacle-avoiding distance from any node to the target node. The A* algorithm uses this heuristic estimate to reduce the number of node expansions during the search process, thereby improving the efficiency of the algorithm.
[0118] Optionally, real-time path adjustment can be combined with sensor feedback. During tool changes, the machine tool is equipped with sensors that can monitor the dynamic position information of tools and obstacles in real time. Through real-time data processing, the control system can dynamically adjust the path planning to adapt to the immediate changes in the machine tool workspace.
[0119] S50: Generate a corresponding control instruction based on the collision-free shortest path, and send the control instruction to an actuator to drive the actuator to complete a tool replacement action.
[0120] In an optional embodiment, the actuator can be a bionic mechanical claw, which receives control instructions and drives itself to move to the storage coordinates of the target tool according to the control instructions. The control instructions specify the path for the bionic mechanical claw to move from the current position to the current coordinates of the tool to be replaced. In the process of executing the control instructions, the bionic mechanical claw relies on an integrated sensory feedback system, which can monitor and respond to various parameters of the bionic mechanical claw during movement and operation, such as force, position and speed, in real time during the movement. Through the sensory feedback system, the bionic mechanical claw can adjust the movement parameters according to the real-time data of force feedback to ensure the actual contact force between the tool and the machine tool.
[0121] Exemplarily, when the bionic mechanical claw receives a control instruction and starts to perform a tool changing action, its integrated perception feedback system monitors the interaction between the bionic mechanical claw and the machine tool in real time. The bionic mechanical claw moves to the current coordinates of the tool to be replaced along the shortest collision-free path according to the received control instruction. Among them, the perception feedback system integrated in the bionic mechanical claw performs real-time monitoring during this process, using position sensors to ensure that the bionic mechanical claw is accurately aligned with the target, while the force sensor detects the force of contact with the tool in real time. Once the force feedback shows that the contact force exceeds the preset range, the bionic mechanical claw will automatically adjust its gripping force or speed to adapt to the tool replacement needs under different conditions.
[0122] At the same time, the speed sensor regulates the movement speed of the bionic mechanical claw. If it encounters an obstacle, the perception system will immediately feedback information, and the control system will recalculate the path based on the feedback to ensure that the bionic mechanical claw can safely bypass the obstacle.
[0123] Please refer to Figure 3 In another optional implementation scheme, the tool replacement method further includes the following steps S60 to S90:
[0124] S60: During the tool change process, the control system uses real-time data collected by the visual sensor for monitoring.
[0125] Understandably, the control system performs real-time monitoring tasks during tool change, relying primarily on data collected by the vision sensor. The sensor continuously captures images of the machine tool workspace, providing real-time information on tool status and position, as well as visual data on other factors that may affect the change process.
[0126] In an optional embodiment, the control system uses real-time data collected by the visual sensor for monitoring, and pre-processes the image data captured by the sensor to enhance the characteristics of the image data and reduce noise. At the same time, the system combines the tool recognition model to perform pattern recognition on the normal and abnormal states of the tool in the image data. The control system will continuously compare the real-time collected image data with the predefined tool state template to ensure that the tool change process is carried out correctly.
[0127] For example, the control system collects image data of the machine tool work area in real time through visual sensors. The image data captured by these sensors first undergoes a preprocessing stage, including image denoising, contrast adjustment, edge enhancement and other operations, aiming to enhance the characteristics of the tool in the image and reduce the impact of environmental noise. Subsequently, the control system inputs the preprocessed image data into the tool recognition model. The tool recognition model performs pattern recognition on the normal state and abnormal wear state of the tool in the image, and analyzes image features such as the edge, shape and texture of the tool. During the real-time monitoring process, the control system continuously compares the collected image data with the preset tool state template. The preset template represents the standard image features of the tool in different states, including normal working state and known wear state. Through comparison, the control system can quickly identify whether the actual state of the tool matches the template, so as to determine whether the tool needs to be replaced or maintained.
[0128] For example, if the system detects irregular wear or deformation of the tool's edge, these features match the predefined wear state template, and the control system will mark the tool as worn. On the contrary, if the tool's features are consistent with the normal state template, the control system will continue to monitor without taking replacement action.
[0129] S70: When the control system detects a tool identification error or a path planning failure, a problem diagnosis program is automatically triggered, and a diagnosis result is determined based on the real-time data.
[0130] In an optional implementation, when the control system detects a tool recognition error or path planning failure through the data of the visual sensor, the problem diagnosis program is automatically triggered and an alarm is issued. The problem diagnosis program first records detailed data when the error occurs, including timestamps, sensor readings, and image data. The system then uses logic analysis and anomaly detection algorithms to identify the type and degree of deviation, such as tool position deviation, image acquisition anomalies, or logical errors in the path planning algorithm, and determines the diagnosis results based on these data.
[0131] For example, the problem diagnosis program in the control system uses logic analysis and anomaly detection algorithms to conduct in-depth analysis of the recorded data to identify the type and degree of deviation. For example, the control system detects a deviation in the tool position, which may be caused by sensor errors or inaccurate mechanical movement. Or, the control system finds an abnormal image acquisition, which may be caused by changes in lighting conditions or temporary failures in the image processing software. In addition, logical errors in the path planning algorithm may also cause path planning failures, and the system will identify the problem through algorithm review.
[0132] Optionally, the control system implementation optimization focuses on ensuring the long-term stability and accuracy of the entire tool change monitoring system. Regular calibration is a key component, in which the vision sensor is tested and adjusted for accuracy and stability according to a predetermined calibration cycle. The calibration process involves a detailed inspection of the sensor's optics, image capture capabilities, and position positioning functions to ensure that the sensor can provide clear and accurate data when capturing images.
[0133] Environmental control is also crucial in the optimization scheme, because unstable environmental factors, such as light fluctuations or temperature changes, may affect the performance of the visual sensor. Therefore, the control system monitors and adjusts the environmental conditions in the tool change area, using equipment such as shading facilities and temperature control systems to maintain a stable and controlled working environment, thereby reducing the interference of external factors on sensor readings.
[0134] For example, the control system can set automatic reminders to ensure that operators perform sensor calibration and environmental checks on time. At the same time, the maintenance log will record the details of each maintenance activity, including the replaced parts, calibration results and resolved problems, providing a reference for subsequent maintenance.
[0135] S80: According to the diagnosis result, the control system automatically executes a recovery strategy, including re-identifying the tool position data and the tool status data, or re-planning a collision-free shortest path for tool replacement.
[0136] In an optional embodiment, the control system automatically executes a recovery strategy based on the diagnosis results of the problem diagnosis program. The recovery strategy includes recalibrating the visual sensor to ensure the accuracy of the image data; or calling an alternative path planning algorithm to recalculate a new collision-free shortest path. At the same time, the control system may also adjust the movement speed or gripping force of the bionic mechanical claw based on the diagnosis results to adapt to the new operating conditions. In addition, the control system will update the control instructions in real time to ensure that the recovery measures match the current tool status and workspace environment.
[0137] For example, after receiving the results of the problem diagnosis program, the control system will take corresponding measures based on the diagnosis results and automatically execute a series of recovery strategies to ensure the continuity and accuracy of the tool replacement process. If the program abnormality is caused by sensor error, the control system may automatically calibrate the sensor or switch to a backup sensor. If the program abnormality is caused by the image processing software, the control system may restart the image processing software or roll back to the last stable version. For logical errors in the path planning algorithm, the control system may recalculate the shortest collision-free path or remind the operator to intervene manually through an alarm.
[0138] For example, during a tool change, a vision sensor detects a deviation between the actual position of the tool and the expected position. The control system will record this deviation and trigger a problem diagnostic program. The diagnostic program analyzes the deviation data, determines that the deviation is beyond the normal range, and then initiates a calibration program to recalibrate the vision sensor or the alignment of the machine tool to eliminate the deviation. If the deviation is caused by a sensor failure, the system will switch to a backup sensor or adjust the focus or position of the sensor.
[0139] S90: After the recovery measures are executed, the control system will clear the error state and automatically restore to the previous stable point of the tool change process to continue to execute subsequent tool change tasks.
[0140] In an optional implementation, after the recovery strategy is executed, the control system will perform a verification operation to confirm whether the tool change process has returned to a stable state. The verification operation includes re-collecting the image data of the tool, performing tool state identification and position data verification, and checking whether the path planning meets the collision-free requirements. After the verification is passed, the control system will clear the previous error state and automatically restore to the previous stable point of the tool change process based on the latest tool state and path information, and continue to perform subsequent tool change tasks. The control system will continue to monitor the entire process to ensure the continuity and accuracy of the operation.
[0141] The present application provides a tool replacement device, which includes: at least one processor for executing complex algorithms and data processing tasks; and a memory connected to the at least one processor for communication, including a read-only memory (ROM) for storing system firmware and pre-installed programs, and a random access memory (RAM) for temporarily storing data and programs during system operation; wherein the memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor so that the at least one processor can execute the tool replacement method in the above-mentioned embodiment one.
[0142] Reference below Figure 4 , which shows a schematic diagram of the structure of a tool replacement device suitable for implementing the embodiment of the present application. The tool replacement device in the embodiment of the present application may include but is not limited to network element devices such as switches, routers, etc. Figure 4 The tool changing device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0143] like Figure 4As shown, the tool changing device may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to the program stored in the read-only memory 1002 or the program loaded from the storage device 1003 to the random access memory 1004. In the RAM 1004, various programs and data required for the operation of the tool changing device are also stored. The processing device 1001, the ROM 1002, and the RAM 1004 are connected to each other through the bus 1005, forming the core processing and storage system of the device. The input / output (I / O) interface 1006 is also connected to the bus, allowing the device to interact with the outside world. Generally, the following systems can be connected to the I / O interface 1006: including an input device 1007 connected to the input device, such as a touch screen, a touch pad, and a keyboard; including an output device 1008 connected to the output device, such as a liquid crystal display (LCD: Liquid Crystal Display), a speaker, and a vibrator. In addition, the I / O interface also supports connection with an external storage device 1003 for data backup and recovery, such as a tape, a hard disk, etc., and connection with a communication device 1009 to ensure that the device can exchange data with other devices or systems in a wired or wireless manner. Although the figure shows a tool changing device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have instead.
[0144] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0145] In particular, in order to adapt to the real-time monitoring and control of the machine tool workspace, the tool changer includes interfaces with visual sensors, lidar, ultrasonic sensors, etc., to receive and process real-time image data and other sensor data in the machine tool workspace. At the same time, the equipment also has interfaces with actuators such as bionic mechanical claws to send control instructions and receive status feedback.
[0146] In order to ensure the stable operation and safe operation of the system, the tool changing equipment also integrates a power management unit and a safety monitoring unit. The power management unit is responsible for providing stable power to each component in the system, while the safety monitoring unit implements the emergency stop and safety release mechanism to prevent possible damage in abnormal situations.
[0147] In addition, specially developed algorithms are stored in the device, including deep learning models for tool status recognition, path planning algorithms, fault diagnosis procedures and recovery strategies, which together form the basis for the intelligent operation of tool changing equipment.
[0148] Through the above configuration, the tool changing equipment in the embodiment of the present application can achieve high-precision tool identification, dynamic path planning, real-time fault diagnosis and automated recovery operations, significantly improving the automation level and production efficiency of CNC machine tools.
[0149] The tool replacement device provided by the present application adopts the tool replacement device method in the above embodiment, which can solve the technical problem that the tool replacement process of the CNC machine tool cannot effectively adapt to the changes in the working environment due to the fixed path planning. Compared with the prior art, the beneficial effects of the tool replacement device provided by the present application are the same as the beneficial effects of the tool replacement method provided by the above embodiment, and the other technical features in the tool replacement device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0150] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0151] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0152] The present application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions including algorithms and processes for key operations such as automatic identification of tool status, query of a tool library coordinate database, real-time monitoring of obstacles in a machine tool workspace, accurate calculation of a collision-free shortest path, and precise control of an actuator, and are used to execute the tool replacement method in the above-mentioned embodiment.
[0153] The computer-readable storage medium provided in the present application can take a variety of forms, including a portable USB flash drive for easy transfer of programs between different devices; a built-in hard disk for long-term data storage of the machine tool control system; RAM for temporary storage and quick access to data during replacement; and ROM for storing system startup and basic operating instructions.
[0154] In addition, in order to provide flexibility and update capabilities, more specific examples of computer-readable storage media may also use erasable storage devices, such as erasable programmable read-only memory (EPROM: Erasable Programmable ReadOnly Memory or flash memory), allowing the program to be updated and maintained. Optical storage devices such as portable compact disk read-only memory (CD-ROM: CD-Read Only Memory) can be used for program distribution and backup, while magnetic storage devices, including traditional disks and solid-state drives (SSD: Solid State Drive), provide large-scale data storage solutions. Network connectivity, including Ethernet and Wi-Fi, further allows remote access and updating of content on the storage medium.
[0155] The program code on the computer-readable storage medium can be transmitted through various transmission media, including wires, optical cables, and wireless technologies such as Wi-Fi and Bluetooth, ensuring that the program can be safely and efficiently loaded into the control system. This design not only ensures the diversity and compatibility of storage media, but also meets the needs of CNC machine tools for efficient and reliable program storage and transmission in different environments.
[0156] The computer-readable storage medium may be included in the tool changing device; or may exist independently without being assembled into the tool changing device.
[0157] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the tool changing device, the tool changing device: identifies the tool to be replaced based on the status image of the tool on the machine; determines the storage coordinates of the target tool corresponding to the tool to be replaced based on the coordinate database of the tool library; receives the image data of the machine tool workspace, and obtains the obstacle position coordinates in the machine tool workspace; uses the current coordinates of the tool to be replaced, the storage coordinates and the obstacle position coordinates to calculate the collision-free shortest path from the current coordinates to the storage coordinates; generates corresponding control instructions based on the collision-free shortest path, and sends the control instructions to the actuator to drive the actuator to complete the tool changing action.
[0158] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0159] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0160] The modules involved in the embodiments described in the present application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0161] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned tool replacement method, and can solve the technical problem that the tool replacement process of a CNC machine tool cannot effectively adapt to changes in the working environment due to fixed path planning. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the tool replacement method provided by the above-mentioned embodiment, and will not be elaborated here.
[0162] An embodiment of the present application provides a computer program product, including a computer program, which implements the steps of the tool replacement method as described above when the computer program is executed by a processor.
[0163] The computer program product provided by the present application can solve the technical problem that the path planning is fixed and the working environment cannot be effectively adapted to changes during the tool replacement process of the CNC machine tool. Compared with the prior art, the beneficial effects of the computer program product provided by the embodiment of the present application are the same as the beneficial effects of the tool replacement method provided by the above embodiment, which will not be described in detail here.
[0164] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent processing scope of the present application.
[0165] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0166] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.
[0167] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for replacing a tool, characterized in that: Applied to CNC machine tools, the method comprises: Identify the tool to be replaced based on the status image of the tool on the machine; Determine the storage coordinates of the target tool corresponding to the tool to be replaced according to the coordinate database of the tool library; Receiving image data of a machine tool workspace and acquiring the coordinates of obstacles in the machine tool workspace; Calculate the collision-free shortest path from the current coordinates to the storage coordinates using the current coordinates of the tool to be replaced, the storage coordinates, and the obstacle position coordinates; Generate a corresponding control instruction based on the collision-free shortest path, and send the control instruction to the actuator to drive the actuator to complete the tool replacement action; Before the step of identifying the tool to be replaced according to the status image of the tool on the machine, the method includes: Collecting tool image data, the tool image data includes an image of a machine tool and an image of a tool in the tool library; Performing normalization processing on the tool image data; Determine the bounding box of each tool in the normalized tool image data, and mark the upper left corner coordinates and the lower right corner coordinates of each of the bounding boxes, as well as the tool category and tool status of the corresponding bounding box; Performing data enhancement on the annotated tool image data, adjusting the brightness and contrast of the annotated tool image data, and adding blur and noise to obtain an enhanced data set of the annotated tool image data; After the step of obtaining the enhanced data set of the annotated tool image data, the method further comprises: Selecting tool images and corresponding annotations in predetermined batches from the enhanced data set to form an input batch; Inputting the tool images of the input batch into the model in sequence and performing forward propagation to obtain prediction results of the tool images; Determine the loss value of the prediction result and the corresponding annotation by using the loss function; Based on the loss value, gradient calculation is performed on the model parameters, a back propagation algorithm is executed, and the model parameters are updated to minimize the loss function; If the loss value corresponding to the input batch is lower than the preset performance improvement threshold in a set number of consecutive iterations, the performance of the model is judged to be stable; When the performance of the model is stable or reaches a preset number of iterations, the iteration is completed and the final model parameters are determined to construct a tool recognition model.
2. The method according to claim 1, characterized in that The step of identifying the tool to be replaced according to the status image of the tool on the machine includes: Collecting a state image of the on-machine tool and inputting the state image into a tool recognition model; Based on the tool recognition model, obtaining the on-machine tool category and on-machine tool state corresponding to the state image; The tool to be replaced is determined according to the type of the tool on the machine and the state of the tool on the machine.
3. The method according to claim 1, characterized in that The step of determining the storage coordinates of the target tool corresponding to the tool to be replaced according to the coordinate database of the tool library comprises: Determine the tool number of the tool to be replaced according to the on-machine tool category of the tool to be replaced; Based on the tool number, a matching query is performed in a tool library to determine the target tool; Based on the target tool, the storage coordinates of the target tool in a coordinate database are determined.
4. The method according to claim 1, characterized in that The step of receiving the image data of the machine tool workspace and obtaining the coordinates of the obstacle positions in the machine tool workspace comprises: Inputting the image data into a tool recognition model to obtain a classification result of the image data; extracting non-tool objects as obstacle data according to the classification result; The position information of the obstacle data in the image data is converted into coordinate points in the machine tool coordinate system to obtain the obstacle position coordinates.
5. The method according to claim 1, characterized in that The step of calculating the collision-free shortest path from the current coordinate to the storage coordinate using the current coordinate of the tool to be replaced, the storage coordinate and the obstacle position coordinate comprises: Dividing the machine tool workspace into a plurality of grid units, each grid unit corresponding to a coordinate point; Marking the current coordinates of the tool to be replaced, the storage coordinates of the target tool, and the coordinates of the obstacle position on the grid unit; Using a path planning algorithm to traverse all paths from the current coordinates to the stored coordinates, and excluding paths that overlap with the obstacle position coordinates, to obtain optional paths; Among the optional paths, the shortest path is selected as the collision-free shortest path from the current coordinate to the stored coordinate.
6. The method according to claim 1, characterized in that The step of generating a corresponding control instruction based on the collision-free shortest path, sending the control instruction to an actuator, and driving the actuator to complete the tool replacement action includes: The actuator is a bionic mechanical claw, which receives the control instruction and drives itself to move to the storage coordinates of the target tool according to the control instruction; The bionic mechanical claw is integrated with a sensing feedback system, and can adjust movement parameters according to force feedback during movement to ensure the actual contact force between the tool and the machine tool.
7. A tool changing device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the tool replacement method according to any one of claims 1 to 6.
8. A computer storage medium, characterized in that: The computer storage medium is a computer-readable storage medium, and a computer program is stored on the computer storage medium. When the computer program is executed by a processor, the steps of the tool replacement method according to any one of claims 1 to 6 are implemented.
