Flexible tool changing method and system for numerical control machine tool based on feature recognition and trajectory adaptive planning
The flexible tool changing method based on feature recognition and adaptive trajectory planning solves the coordinate offset problem caused by thermal deformation and wear in CNC machine tools, realizes obstacle avoidance and compliant control, and improves machining accuracy and safety.
Patent Information
- Application Number
- CN202611308828.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-27
- Publication Date
- 2026-11-20
AI Technical Summary
The existing rigid tool changing method of CNC machine tools is prone to motion interference, collision and insertion/removal jamming when faced with coordinate offset caused by machine tool thermal deformation and wear, which affects machining accuracy and safety.
A flexible tool changing method based on feature recognition and trajectory adaptive planning is adopted. The initial three-dimensional environment boundary is constructed by reading the coordinates of the machine tool's moving axis. Combined with the three-dimensional shape data of the target tool recognized by vision, a smooth motion trajectory is generated and switched to force-position hybrid control to perform displacement fine adjustment to complete the tool changing action. Error data is recorded for compensation.
It achieves spatial obstacle avoidance and compliant physical contact during tool changing, reduces mechanical wear, establishes an adaptive compensation mechanism, and improves machining accuracy and safety.
Smart Images

Figure CN123137199A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automated control technology for CNC machine tools, and in particular to a flexible tool changing method and system for CNC machine tools based on feature recognition and adaptive trajectory planning. Background Technology
[0002] In modern high-end CNC machining and automated flexible production lines, multi-joint robots or automatic tool changers (ATCs) have been widely used in tool exchange operations between the spindle and tool magazine in machining centers. Currently, most mainstream automatic tool changers rely on pre-taught fixed coordinate points and pre-set rigid paths for large-scale spatial displacement, and use a single absolute position control mode (i.e., rigid position closed-loop control) to complete the tool change task when performing gripping and insertion / removal actions at the end effector.
[0003] However, this rigid tool changing method based on fixed coordinates has significant limitations in practical industrial applications. After long-term, high-intensity continuous cutting operations, thermal deformation caused by internal motor heating, mechanical vibration from heavy cutting, and long-term physical wear of the guide rails inevitably lead to slight shifts in the actual physical positions of the spindle, tool magazine, and fixture. Because existing systems lack the ability to perceive and adapt to dynamic environmental changes, the robot arm will still be forced to perform actions according to the originally set rigid coordinates. This not only easily leads to interference and collisions between the robot arm and workpieces or fixtures of varying sizes during movement, but also causes rigid jamming and friction due to slight coaxiality assembly deviations during the final tool insertion and removal stage. Over time, this rigid interference will not only exacerbate the mechanical wear of the spindle taper hole and tool holder, shortening equipment lifespan, but also seriously affect the continuous machining accuracy and operational safety of the entire automated production line. Summary of the Invention
[0004] In view of the aforementioned existing problems, the present invention is proposed.
[0005] Therefore, in order to solve the problem that existing rigid tool changing methods are prone to motion interference, collision and insertion / removal jamming when facing coordinate offset caused by machine tool thermal deformation and wear, this invention provides a flexible tool changing method and system for CNC machine tools based on feature recognition and trajectory adaptive planning.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution: In a first aspect, the present invention provides a flexible tool changing method for CNC machine tools based on feature recognition and adaptive trajectory planning, comprising the following steps: S1. Receive tool change command, read the coordinate position data of the machine tool moving axis and construct the initial three-dimensional environment boundary; S2. Collect the surface three-dimensional shape data and color image of the target tool, compare it with the pre-stored standard tool three-dimensional shape in space, and calculate the three-dimensional coordinates and tilt angle of the target tool as the target endpoint. S3. Update the target endpoint to the initial three-dimensional environment boundary, delineate the safety isolation zone and generate the corresponding constraint boundary. Within the constraint boundary, generate a motion trajectory that avoids the safety isolation zone from the current stopping position of the tool changing robot and undergoes a smooth transition. S4. Control the tool changing robot to move along the motion trajectory, and switch to force-position hybrid control when it reaches the set critical position. Obtain the contact resistance at the end of the tool changing robot, and make fine-tuning of the displacement according to the contact resistance to complete the tool changing action. S5. Record the error data during the tool change process, and compensate for the coordinates of the initial three-dimensional environment boundary before the next tool change.
[0007] As a preferred embodiment of the flexible tool changing method for CNC machine tools based on feature recognition and adaptive trajectory planning described in this invention, the specific steps for receiving the tool changing command and constructing the initial three-dimensional environment boundary by reading the coordinate position data of the machine tool's moving axis are as follows: The tool change command is parsed to extract the target tool number, and the pneumatic blowing device is controlled to perform directional cleaning operations on the spindle and tool magazine surfaces; the spatial coordinate values of the current location of the machine tool moving axis are read; in the virtual coordinate system, the spatial coordinate values are used to construct geometric bounding box data that covers the spindle, the tool magazine, the workpiece, and the fixture, and the geometric bounding box data is used as the initial three-dimensional environment boundary to define the physical space for subsequent operation.
[0008] As a preferred embodiment of the flexible tool changing method for CNC machine tools based on feature recognition and adaptive trajectory planning described in this invention, the method involves: acquiring the surface three-dimensional shape data and color image of the target tool, performing spatial comparison with the pre-stored standard tool three-dimensional shape, and calculating the three-dimensional coordinates and tilt angle of the target tool as the target endpoint. The specific steps are as follows: The process involves: acquiring a color image processed with polarization filtering to filter reflective pixels on the metal surface; extracting gradient change data of pixels in the color image to obtain geometric edge features; comparing the geometric edge features with a preset shape template to locate and output the two-dimensional pixel coordinates of the V-groove and locating key on the shank of the target tool; extracting local three-dimensional spatial point sets corresponding to the two-dimensional pixel coordinates from the synchronously acquired surface three-dimensional shape data; acquiring a standard spatial point set of the pre-stored standard tool three-dimensional shape; calculating the Euclidean distance between corresponding points in the local three-dimensional spatial point set and the standard spatial point set; minimizing the sum of the Euclidean distances through iterative calculations to solve for the rotation matrix and translation vector required to achieve spatial overlap of the two point sets; performing mathematical coordinate transformation on the current original spatial coordinates using the rotation matrix and translation vector, and outputting the transformed three-dimensional coordinates and tilt angle as the target endpoint.
[0009] As a preferred embodiment of the flexible tool changing method for CNC machine tools based on feature recognition and trajectory adaptive planning described in this invention, the following steps are taken: updating the target endpoint to the initial three-dimensional environment boundary, defining a safety isolation zone and generating a corresponding constraint boundary, and generating a motion trajectory within the constraint boundary that avoids the safety isolation zone from the current stopping position of the tool changing robot and undergoes a smooth transition. The target endpoint is entered into the initial three-dimensional environment boundary to form an environmental topology map; the outer boundary dimensions of the workpiece and the fixture in the environmental topology map are extracted, and the expansion distance value is extended outward along the normal direction by a set value, and the extended area is defined as the safety isolation zone; the maximum torque limit value and the maximum moving speed limit value of the joint motor output inside the tool changing robot are obtained, and the maximum torque limit value, the maximum moving speed limit value and the safety isolation zone are merged to set as the constraint boundary. Taking the current stopping position of the tool changing robot as the starting point and the target endpoint as the ending point, discrete spatial sampling points are generated within the constraint boundary according to the set sampling step size, and interference sampling points falling into the safety isolation zone are eliminated; the retained valid sampling points are connected sequentially by straight line segments to form a preliminary movement path; the spatial turning point at the intersection of the straight line segments in the preliminary movement path is obtained, and a smooth interpolation function containing position, velocity and acceleration boundary conditions is used to fit the spatial turning point and the adjacent straight line segments to solve for a smooth curve with continuous velocity and acceleration as the issued motion trajectory.
[0010] As a preferred embodiment of the flexible tool changing method for CNC machine tools based on feature recognition and trajectory adaptive planning described in this invention, the tool changing robot is controlled to move along the motion trajectory, and when it reaches a set critical position, it switches to force-position hybrid control to obtain the contact resistance at the end of the tool changing robot, and performs fine-tuning of the displacement based on the contact resistance to complete the tool changing action. The specific steps are as follows: The tool-changing robot is controlled to move spatially according to the position command issued by the motion trajectory; the relative distance between the end effector of the tool-changing robot and the tool holder of the target tool is calculated; if the relative distance shrinks to a set critical value, the force-position hybrid control that synchronizes the position command and torque feedback is activated; the triaxial force data of the torque sensor installed at the end effector of the tool-changing robot is read as the contact resistance. The contact resistance is compared with a preset normal force range; if the contact resistance exceeds the normal force range, the force direction corresponding to the contact resistance is extracted, and the yielding fine-tuning coordinate opposite to the force direction is calculated; the tool-changing robot is controlled to superimpose the yielding fine-tuning coordinate to perform spatial yielding fine-tuning; the resistance comparison and spatial yielding fine-tuning are repeatedly executed until the contact resistance falls back and is maintained within the normal force range, and subsequent actions are performed to complete the tool changing action.
[0011] As a preferred embodiment of the flexible tool changing method for CNC machine tools based on feature recognition and adaptive trajectory planning described in this invention, the following steps are taken: Error data during the tool changing process is recorded, and the coordinates of the initial three-dimensional environment boundary are compensated before the next tool change. Extract the first coordinate deviation value generated by the spatial comparison calculation and the second coordinate deviation value generated during the displacement fine-tuning process; vector superposition the first coordinate deviation value and the second coordinate deviation value to obtain a single system error value, which is stored in the experience database as the error data; obtain a preset number of consecutive tool change operation records in the experience database, and calculate the mean change slope of the single system error value; if the mean change slope exceeds a set threshold, calculate the expected error vector for the next tool change based on the extension direction of the mean change slope; before the next tool change action command is issued, use the expected error vector to reverse adjust the reference coordinate system where the initial three-dimensional environment boundary is located to complete the compensation.
[0012] Secondly, the present invention provides a flexible tool changing system for CNC machine tools based on feature recognition and adaptive trajectory planning, comprising: The environment initialization module is used to receive tool change commands, read the coordinate position data of the machine tool's moving axes, and construct the initial three-dimensional environment boundary. The visual detection and comparison module is used to collect the surface three-dimensional shape data and color image of the target tool, and perform spatial comparison with the pre-stored standard tool three-dimensional shape to calculate the three-dimensional coordinates and tilt angle of the target tool as the target endpoint. The boundary generation and trajectory planning module is used to update the target endpoint to define a safety isolation zone in the initial three-dimensional environment boundary and generate a corresponding constraint boundary. Within the constraint boundary, a motion trajectory is generated that avoids the safety isolation zone from the current stopping position of the tool changing robot and undergoes a smooth transition. The force-position hybrid execution module is used to control the tool changing robot to move along the motion trajectory. When it reaches the set critical position, it switches to force-position hybrid control, obtains the contact resistance at the end of the tool changing robot, and performs displacement fine adjustment according to the contact resistance to complete the tool changing action. The error analysis and compensation module is used to record error data during the tool change process and compensate for the coordinates of the initial three-dimensional environment boundary before the next tool change.
[0013] The beneficial effects of this invention are: This invention constructs an initial 3D environment boundary by reading the coordinates of the moving axis; it fuses 2D images and 3D point clouds for registration and calculation of the target endpoint; it combines a safety isolation zone and dynamic limits to set constraint boundaries, and uses an interpolation function to generate a smooth obstacle-avoidance trajectory; it controls the robot arm to move along the trajectory and switches to force-position hybrid control at critical positions, and performs reverse retreat fine-tuning based on contact resistance feedback to complete the tool change; finally, it synthesizes multi-source deviations to calculate the error evolution slope, and uses the expected error vector to adjust the reference coordinate system in reverse. This scheme achieves spatial obstacle avoidance and compliant physical contact during tool changing, reduces mechanical wear, and establishes an adaptive compensation mechanism for long-period coordinate drift. Attached Figure Description
[0014] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0015] Figure 1 Here is the overall flowchart of the flexible tool changing method; Figure 2 Flowchart of visual registration iteration for target pose S2; Figure 3 Flowchart for S3 trajectory adaptive smoothing planning; Figure 4 Flowchart for S4 force-position hybrid execution and tactile fine-tuning; Figure 5 This is a flowchart of the error trend prediction and compensation process for the S5 system. Detailed Implementation
[0016] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0017] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0018] Secondly, the term "one embodiment" or "example" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the invention. The appearance of an embodiment in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that mutually excludes other embodiments. Example 1
[0019] Reference Figures 1-5 This is the first embodiment of the present invention, which provides a flexible tool changing method for CNC machine tools based on feature recognition and trajectory adaptive planning, including the following steps: S1. Receive the tool change command, read the coordinate position data of the machine tool's moving axes, and construct the initial three-dimensional environment boundary, including the following steps: The tool change command is parsed to extract the target tool number, and the pneumatic purging device is controlled to perform directional cleaning operations on the spindle and tool magazine surfaces; the spatial coordinate values of the current location of the machine tool's moving axis are read; in the virtual coordinate system, the spatial coordinate values are used to construct geometric bounding box data that covers the spindle, tool magazine, workpiece, and fixture, and the geometric bounding box data is used as the initial three-dimensional environment boundary to define the physical space for subsequent operation.
[0020] It should be noted that in the initial preparation stage of automated flexible tool changing, the system needs to eliminate interference from machining residues inside the machine tool and establish a collision-avoidance physical barrier in virtual space. The specific operation steps are as follows: Tool Change Command Parsing and Automated Cleaning of the Physical Environment: When the CNC system issues a tool change command, after machining, cutting fluid and metal shavings remain on the spindle and tool magazine surfaces. These residues can interfere with subsequent visual recognition accuracy and affect mechanical connection. While parsing the target tool number, the main control computer simultaneously triggers a pneumatic cleaning device, using high-pressure airflow to quickly and directionally clean the spindle mating surfaces and tool surfaces, restoring the physical cleanliness of the area to be operated.
[0021] Real-time reading and virtual mapping of machine tool movement axis spatial coordinates: The internal space of a machine tool is small and dynamically changing. The main control computer reads the absolute spatial coordinate values of the X, Y, and Z movement axes and rotary axes from the encoders of the motors in real time through the servo communication bus at the bottom of the machine tool. These real physical values are directly mapped to the virtual three-dimensional coordinate system of the CNC system as reference anchor points for constructing obstacle boundaries.
[0022] Construction and boundary definition of geometric bounding boxes in the virtual coordinate system: To prevent interference and collisions during subsequent movements of the tool-changing robot, the system utilizes the aforementioned coordinate values and employs the Axial Bounding Box (AABB) algorithm to simplify complex, irregular solid components such as the spindle, tool magazine, workpiece, and fixture into circumscribed geometric blocks. These geometric bounding boxes constitute the initial three-dimensional environment boundary in the control system, clearly defining the physical no-go zones that the tool-changing robot must never intrude upon.
[0023] S2. Acquire the surface three-dimensional shape data and color image of the target tool, compare it spatially with the pre-stored standard tool three-dimensional shape, and calculate the three-dimensional coordinates and tilt angle of the target tool as the target endpoint. This includes the following steps: A color image processed with polarization filtering is acquired to filter reflective pixels on the metal surface. Gradient change data of pixels in the color image is extracted to obtain geometric edge features. These geometric edge features are compared with a preset shape template to locate and output the two-dimensional pixel coordinates of the V-groove and locating key on the tool holder of the target tool. From the synchronously acquired surface three-dimensional shape data, a local three-dimensional spatial point set corresponding to the two-dimensional pixel coordinates is extracted. A standard spatial point set of a pre-stored standard tool three-dimensional shape is acquired. The Euclidean distance between corresponding points in the local three-dimensional spatial point set and the standard spatial point set is calculated. Through iterative calculation, the sum of the Euclidean distances is minimized, and the rotation matrix and translation vector required to achieve spatial overlap of the two point sets are solved. The rotation matrix and translation vector are used to perform mathematical coordinate transformation on the current original spatial coordinates, and the transformed three-dimensional coordinates and tilt angle are output as the target endpoint.
[0024] It should be noted that before the robotic arm performs its actions, the system needs to overcome the interference of local overexposure of the sensors caused by metal reflection, fuse two-dimensional and three-dimensional visual data, and achieve high-precision calculation of the spatial pose of the target tool. The specific operation steps are as follows: Anti-reflective 2D image acquisition and precise feature localization: An RGB-D depth camera is used to capture images of the area where the target tool is located. To address the high gloss reflections easily generated on the tool's metal surface, the system acquires a de-reflective color image using a polarizing filter positioned in front of the lens. Subsequently, the vision processing module calculates the grayscale gradient changes of pixels in the image, extracts clear geometric edge features, and matches them with a pre-set tool holder contour template to precisely locate the 2D pixel coordinates of the V-groove and positioning key on the tool holder used for alignment.
[0025] Local 3D spatial point set extraction under multidimensional data fusion: Since 2D images cannot provide depth information, the system maps the locked 2D pixel coordinates to the surface 3D shape data (depth point cloud) synchronously acquired by the depth camera, accurately segmenting the local 3D spatial point set that belongs only to the tool holder feature area, and eliminating invalid point cloud data of the background environment, thereby reducing the computational load of subsequent spatial calculation.
[0026] Iterative calculation of endpoint spatial pose based on point cloud registration algorithm: Due to on-site placement errors, the actual acquired point cloud often exhibits tilt or translation. The system retrieves a standard tool space point set from the database and introduces the ICP (Iterative Closest Point) registration algorithm. During this process, the system internally drives the fitting by minimizing the sum of Euclidean distances between two point sets. The objective function formula for its iterative registration is:
[0027] This function represents the sum of the mean square errors of the Euclidean distances projected from a local 3D point set to a standard point set. A smaller value indicates a more precise fit, and its range is [value missing]. .
[0028] This represents the total number of valid feature points extracted from the local 3D spatial point set, and It is a positive integer.
[0029] This represents a three-dimensional rotation matrix used to adjust the spatial tilt angle of the tool point cloud in the field.
[0030] This represents a three-dimensional translation vector used to adjust the spatial position of the tool point cloud in the field.
[0031] Represents the first point in the local 3D spatial point set acquired in real time by the on-site visual depth camera. Coordinates of data points.
[0032] The first point in the standard space point set representing the three-dimensional shape of a pre-stored standard tool Each corresponding reference point coordinate.
[0033] This represents the solution for the Euclidean L2 norm of a three-dimensional vector.
[0034] The system uses singular value decomposition to iteratively update the rotation matrix and translation vector until the sum of their errors reaches a minimum. At this point, the output rotation matrix and translation vector reflect the actual three-dimensional coordinates and tilt angle of the tool, which are used as the final target endpoint for the tool-changing robot.
[0035] S3. Update the target endpoint to the initial 3D environment boundary, define the safety isolation zone and generate the corresponding constraint boundary. Within the constraint boundary, generate a motion trajectory from the current dwell position of the tool-changing robot to avoid the safety isolation zone and pass through a smooth transition, including the following steps: The target endpoint is entered into the initial 3D environment boundary to form an environmental topology map. The outer boundary dimensions of the workpiece and fixture in the environmental topology map are extracted, and the expansion distance value is extended outward along the normal direction. The extended area is defined as a safety isolation zone. The maximum torque limit value and maximum movement speed limit value of the joint motor output inside the tool-changing robot are obtained. The maximum torque limit value, maximum movement speed limit value and the safety isolation zone are merged and set as the constraint boundary. Taking the current dwell position of the tool-changing robot as the starting point and the target endpoint as the ending point, discrete spatial sampling points are generated within the constraint boundary according to the set sampling step size. Interference sampling points falling into the safety isolation zone are removed. The retained valid sampling points are connected sequentially by straight line segments to form a preliminary movement path. The spatial turning points at the intersection of straight line segments in the preliminary movement path are obtained. A smooth interpolation function containing boundary conditions of position, velocity and acceleration is used to fit the spatial turning points and their adjacent straight line segments to solve for a smooth curve with continuous velocity and acceleration as the issued motion trajectory.
[0036] It should be noted that before the tool-changing robot moves, the system must establish a constraint model that takes into account both spatial physical limitations and electromechanical limits, and then plan a motion trajectory with smooth transition characteristics. The specific operation steps are as follows: The system delineates the safe isolation zone and establishes multidimensional constraints using a fusion expansion algorithm: It incorporates the target endpoint into the environmental boundary to construct a topological map. Considering the physical outer diameter of the robot and the extension length of the gripping tool, the system extracts the outer dimensions of the workpiece and the fixture, and extends them outward along the geometric normal direction by a preset buffer distance, forming a physical safe isolation zone. Simultaneously, it reads the maximum torque and maximum speed limits of the robot's motor, merging the static spatial isolation zone with the dynamic electromechanical performance limits to form a comprehensive constraint boundary.
[0037] Discrete spatial sampling and preliminary path generation to avoid interference zones: Starting from the current position of the robotic arm and ending at the precisely calculated target endpoint, the system employs a path planning algorithm to distribute spatial sampling points within the aforementioned constraint boundaries according to a set step size. The algorithm automatically eliminates interference points that fall into the safety isolation zone and connects the remaining valid safety points sequentially with straight line segments to generate a preliminary polyline path that avoids all obstacles.
[0038] High-order smooth trajectory interpolation fitting satisfying kinematic limits: If the robot arm moves directly along a polygonal line, sudden velocity changes will occur at the intersections and turning points of the lines, causing robot arm vibration or motor overload. Therefore, the system extracts these spatial turning points and constructs a high-order smooth interpolation function in the time domain. The formula for generating the position trajectory is as follows:
[0039] Indicates the end effector of the robotic arm at Expected spatial location parameters at any given time.
[0040] The runtime variable represents the trajectory interpolation, and its value range is... , The total time set for reaching the next spatial turning point.
[0041] The coefficients of the fifth-degree polynomial to be solved are uniquely determined by the boundary conditions.
[0042] The system extracts six known boundary conditions—position, velocity, and acceleration—at the intersection of each broken line segment, and substitutes these conditions into the aforementioned formula and its first and second derivative equations to instantly calculate the coefficients. The final trajectory generated after mathematical fitting through this operation is a smooth spatial curve that simultaneously satisfies precise position, continuous velocity, and no abrupt changes in acceleration.
[0043] S4. Control the tool changing robot to move along the motion trajectory. When it reaches the set critical position, switch to force-position hybrid control, obtain the contact resistance at the end of the tool changing robot, and make fine adjustments to the displacement based on the contact resistance to complete the tool changing action. This includes the following steps: The tool-changing robot moves spatially according to the position commands issued by the motion trajectory; the relative distance between the end effector of the tool-changing robot and the tool holder of the target tool is calculated; if the relative distance shrinks to a set critical value, a force-position hybrid control that synchronizes the position command and torque feedback is initiated; the three-axis force data of the torque sensor installed at the end effector of the tool-changing robot is read as the contact resistance. The contact resistance is compared with a preset normal force range; if the contact resistance exceeds the normal force range, the force direction corresponding to the contact resistance is extracted, and the retraction fine-tuning coordinates opposite to the force direction are calculated; the tool-changing robot is controlled to superimpose the retraction fine-tuning coordinates for spatial retraction fine-tuning; the resistance comparison and spatial retraction fine-tuning are cyclically executed until the contact resistance falls back and remains within the normal force range, and the subsequent actions are executed to complete the tool changing action.
[0044] It should be noted that during the physical execution phase, the system needs to address the rigid interference and jamming problem caused by minute assembly errors, and endow the robotic arm with tactile feedback and compliant retraction control capabilities. The specific operation steps are as follows: Dynamic switching of force-position hybrid control based on critical distance threshold: During the initial large-scale movement of the robot arm, pure position control is used to ensure travel efficiency. During the movement, the system monitors the end effector distance in real time; when the distance to the target tool holder shrinks to the set critical value, the system wakes up the six-axis torque sensor at the end effector of the robot arm, and the underlying algorithm switches to a force-position hybrid control mode (such as admittance control strategy) that adjusts position and torque synchronously, in preparation for fine docking.
[0045] Real-time monitoring of end-effector contact resistance and extraction of out-of-tolerance force direction: During the docking process, if the tool experiences rigid contact or jamming due to physical deviations, the torque sensor will capture the step change in the three-axis force data. The system compares and calculates the real-time feedback contact resistance with the pre-calibrated normal force range. Once out-of-tolerance force is detected, the system will accurately extract the specific spatial force direction causing the jamming.
[0046] Compliant yielding fine-tuning and tool change execution based on force feedback: When faced with excessive resistance, the system controls the robotic arm to stop its forward movement. During this process, the underlying algorithm uses force-position hybrid control to virtualize the robotic arm as a spring-like shock absorber system with mass, damping, and stiffness characteristics, thereby converting the resistance deviation into a small, reverse yielding coordinate. The dynamic response formula of the robotic arm's end effector is as follows:
[0047] This represents the virtual mass matrix of the tool-changing robot arm preset by the system.
[0048] This represents the system's preset virtual damping matrix, used to absorb excess kinetic energy and prevent yielding oscillations.
[0049] This represents the system's preset virtual stiffness matrix; the smaller the value, the stronger the system's compliance.
[0050] This represents the actual contact resistance vector read in real time by the six-axis torque sensor.
[0051] This represents the expected contact force within the preset normal stress range.
[0052] These represent the spatial back-off fine-tuning acceleration, back-off fine-tuning velocity, and back-off fine-tuning coordinates calculated by the system, respectively.
[0053] When the actual contact resistance exceeds the normal range, the main control algorithm uses the difference as an excitation source and substitutes it into the above second-order differential equation to solve for the corresponding yielding fine-tuning coordinates in real time. The robotic arm superimposes these coordinates to perform a flexible yielding, relieving the jamming stress before attempting to move forward again. The system performs the resistance comparison and reverse fine-tuning process in a high-frequency loop until the contact resistance falls back and stabilizes within the normal range. The robotic arm then smoothly slides into the target coordinates, completing the closed grasping action.
[0054] S5. Record the error data during the tool change process, and compensate for the coordinates of the initial 3D environment boundary before the next tool change, including the following steps: Extract the first coordinate deviation value generated by spatial comparison calculation and the second coordinate deviation value generated during displacement fine-tuning; vector superposition of the first and second coordinate deviation values to obtain the single system error value, which is stored in the experience database as error data; obtain the continuous tool change operation records of a preset number of times in the experience database, and calculate the mean change slope of the single system error value; if the mean change slope exceeds a set threshold, calculate the expected error vector of the next tool change based on the extension direction of the mean change slope; before the next tool change action command is issued, use the expected error vector to reverse adjust the reference coordinate system where the initial three-dimensional environment boundary is located to complete the compensation.
[0055] It should be noted that after a long period of operation, the machine tool will experience coordinate drift due to thermal deformation and mechanical wear. The system needs to establish a dynamic error learning and prediction compensation mechanism. The specific operation steps are as follows: Extraction of dynamic and static multi-source coordinate deviation values and synthesis of system errors: After a single tool change, the system extracts two parts of data: one is the visual static deviation (first coordinate deviation) caused by physical positioning deviation in stage S2, and the other is the force-controlled dynamic backlash deviation (second coordinate deviation) caused by guide rail or tooling fit clearance in stage S4. The system performs spatial vector superposition of these two multi-source data to obtain the comprehensive system error value of this tool change operation, and archives it into the underlying experience database.
[0056] Error slope calculation and evolution trend judgment based on historical database: The system filters out single random errors, periodically retrieves historical records of a preset number of consecutive times from the experience database, and uses the least squares method to perform linear regression fitting. The formula for calculating the slope of the mean change is as follows:
[0057] This represents the slope of the mean change of the solved single-system error value, reflecting the rate and direction of the physical structure coordinate drift.
[0058] This represents the preset number of consecutive tool change operation records extracted from the experience database, and It is a positive integer.
[0059] Indicates the first Discrete-time series index of the tool change operation.
[0060] This represents the statistical average of the time series indexes within a preset number of iterations.
[0061] Indicates the first The single-cycle systematic error value synthesized by vector superposition during each tool change.
[0062] express The statistical average of systematic errors within each sample.
[0063] The system continuously captures the latest error records in a fixed sliding window in the background and substitutes them into the formula above to calculate the ratio of covariance to variance. Once the system determines that the slope exceeds the set tolerance threshold, it confirms that the machine tool has systematic coordinate drift. This operation allows the system to calculate the expected error vector for the next tool change along the extension direction of the slope, thereby actively counteracting long-term drift in physical dimensions.
[0064] Reverse compensation and calibration of the reference coordinate system based on the expected error vector: Once the system determines that the slope of the mean change exceeds the set tolerance threshold, it confirms that the machine tool has a systematic coordinate drift. The system calculates the expected error vector for the next tool change along the extension direction of this slope. Before the next tool change cycle begins, the system reverse-biases the underlying reference coordinate system of the initial 3D environment boundary based on this vector. Through this feedforward trend compensation mechanism, the machine tool can actively counteract long-term drift in physical dimensions and maintain tool change accuracy in a calibration-free state. Example 2
[0065] This invention provides a flexible tool changing system for CNC machine tools based on feature recognition and adaptive trajectory planning, comprising: The environment initialization module is used to receive tool change commands, read the coordinate position data of the machine tool's moving axes, and construct the initial three-dimensional environment boundary. The visual detection and comparison module is used to acquire the surface three-dimensional shape data and color image of the target tool, and to perform spatial comparison with the pre-stored standard tool three-dimensional shape to calculate the three-dimensional coordinates and tilt angle of the target tool as the target endpoint. The boundary generation and trajectory planning module is used to update the target endpoint to define a safety isolation zone in the initial three-dimensional environment boundary and generate the corresponding constraint boundary. Within the constraint boundary, a motion trajectory is generated that avoids the safety isolation zone from the current stopping position of the tool changing robot and undergoes a smooth transition. The force-position hybrid execution module is used to control the tool changing robot to move along the motion trajectory. When it reaches the set critical position, it switches to force-position hybrid control to obtain the contact resistance at the end of the tool changing robot and make fine adjustments to the displacement based on the contact resistance to complete the tool changing action. The error analysis and compensation module is used to record error data during the tool change process and compensate for the coordinates of the initial three-dimensional environment boundary before the next tool change. Example 3
[0066] To further clarify the technical solution of the present invention, the following is a second embodiment of the present invention, using a specific scenario of high-precision tool changing in a five-axis machining center within a precision aerospace component manufacturing area as an example, to provide a more detailed description of the technical solution of the present invention.
[0067] In this embodiment, the CNC machine tool flexible tool changing system of the present invention is deployed in an automated machining workshop for large aero-engine titanium alloy blades. One day, after eight consecutive hours of high-intensity heavy cutting, the machine tool enters an extremely precise finishing stage, requiring the automatic retrieval of an expensive, ultra-high-precision ball end mill from the tool magazine. Due to thermal deformation caused by prolonged continuous machining and the mechanical vibration from heavy cutting, the absolute physical position of the tool in the tool magazine has subtly shifted.
[0068] Step S1: Initialization of environment boundaries and entity envelope Upon receiving the finishing tool change command, the system first triggers the high-pressure pneumatic purging device on the side of the spindle to perform a 3-second directional airflow cleanup of the spindle taper hole and the surface of the ball end mill to be gripped, removing adhering cutting fluid and tiny titanium alloy debris. The system reads the current absolute coordinates of the machine tool's moving axes (e.g., X: 450.2mm, Y: 320.5mm, Z: 150.0mm) via the servo bus. In virtual space, the system quickly uses these real coordinates as anchor points to cover the spindle box, the disc-shaped tool magazine, and the titanium alloy blade entity with precision clamps below with cuboid and cylindrical geometric bounding boxes, respectively. These invisible digital boundaries constitute an absolute physical barrier to the current three-dimensional environment.
[0069] Step S2: Anti-high-gloss visual detection and fine pose calculation The RGB-D depth camera mounted on the robotic arm quickly moved above the tool holder. Facing the metal tool holder, which was covered in residual cutting oil and highly reflective, the polarizing filter in front of the camera lens automatically filtered out glaring highlights and noise, acquiring an extremely clear color image. The visual algorithm precisely located the features of the tool holder's V-groove and, in the simultaneously acquired 3D depth point cloud, segmented tens of thousands of spatial coordinate points in that area.
[0070] The system performs ICP iterative registration between the point cloud data collected on-site and the perfect standard tool point cloud in the database. After milliseconds of Euclidean distance minimization calculation, the system accurately concludes that due to mechanical vibration, the ball end mill is currently offset by 0.45mm along the X-axis and has a slight yaw angle tilt of 1.2 degrees. The system immediately establishes this three-dimensional coordinate system, which includes the offset and tilt angle, as the target endpoint that the robot arm must reach.
[0071] Step S3: Generating a smooth trajectory under multiple safety constraints To prevent the robotic arm from colliding with expensive titanium alloy blades or grippers during grasping and movement, the system extends a 50mm expansion distance in the outer normal direction of the blade enclosure box as a safety isolation zone; at the same time, the system writes the maximum physical torque (e.g., 50 N·m) and speed limit (e.g., 1.5 m / s) of each joint motor of the robotic arm into the underlying dynamic constraints.
[0072] Between the robot's current starting point and target endpoint, the system distributes discrete sampling points within the remaining space, avoiding the safety isolation zone, to generate a preliminary obstacle avoidance path. To prevent straight-line bends from causing the robot to jerk and potentially damaging the servo motors, the system uses a fifth-order polynomial to perform smooth interpolation fitting on the path's turning points. The system then sends the generated three-dimensional spatial trajectory to the underlying controller. This trajectory not only physically avoids blades and grippers but also kinematically ensures that the robot's speed and acceleration remain continuous without abrupt changes.
[0073] Step S4: Millisecond-level tactile perception and flexible retraction insertion The robotic arm rapidly approaches the tool magazine along this smooth trajectory. When the end effector of the robotic arm is only 5mm away from the ball end mill shank, the system pauses the single position control command, activates the six-axis torque sensor mounted on the flange, and engages the admittance control model.
[0074] During insertion, due to extremely slight thermal expansion deformation of the spindle, the robotic arm did not engage smoothly as usual. The torque sensor detected a severe contact resistance of 18N in the Y-axis direction, far exceeding the preset upper limit of the normal force range of 5N. Faced with this rigid interference, the system immediately calculated a reverse -0.1mm retraction fine-tuning coordinate based on the vector feedback of the Y-axis resistance through the underlying model. The robotic arm retracted slightly to relieve the jamming stress before attempting to move forward again. After only a few milliseconds of trial-retraction-fine-tuning cycles, the contact resistance quickly returned to the normal range of 2N, and the robotic arm smoothly completed the closed gripping of the ball end mill.
[0075] Step S5: Prediction of Drift Trend and Adaptive Compensation of Bottom Coordinates After the tool change was completed safely, the system entered the background self-learning phase. The system extracted the 0.45mm static position deviation detected by visual perception and the 0.1mm dynamic assembly deviation generated during force control retreat fine-tuning, and combined them to determine that the total system error for this tool change was 0.55mm, which was then stored in the experience database.
[0076] The system then retrieved the historical data of the last 50 tool changes for slope calculation. Through least squares fitting, the system found that as the machine tool's continuous machining time increased, the average error in the Y-axis direction was continuously increasing at a slope of +0.005mm per tool change cycle, significantly exceeding the set warning threshold of 0.002mm. The system thus confirmed that the machine tool was experiencing regular coordinate drift due to continuous heat generation. Before the next finishing tool change cycle began, the system directly offset the reference coordinate system of the underlying 3D environment boundary in the opposite direction based on the direction of this slope, corresponding to the expected error vector. This invention achieves self-correction and automatic calibration of the machine tool without stopping it, ensuring flexible tool changing accuracy during long-cycle machining.
[0077] In summary, this invention constructs an initial 3D environment boundary by reading the coordinates of the moving axis; it fuses 2D images and 3D point clouds for registration and calculation of the target endpoint; it combines a safety isolation zone and dynamic limits to set constraint boundaries, and uses an interpolation function to generate a smooth obstacle-avoidance trajectory; it controls the robot arm to move along the trajectory and switches to force-position hybrid control at critical positions, and performs reverse retreat fine-tuning based on contact resistance feedback to complete the tool change; finally, it synthesizes multi-source deviations to calculate the error evolution slope and uses the expected error vector to adjust the reference coordinate system in reverse. This scheme achieves spatial obstacle avoidance and compliant physical contact during tool changing, reduces mechanical wear, and establishes an adaptive compensation mechanism for long-period coordinate drift.
[0078] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A flexible tool changing method for CNC machine tools based on feature recognition and adaptive trajectory planning, characterized in that, Includes the following steps: S1. Receive tool change command, read the coordinate position data of the machine tool moving axis and construct the initial three-dimensional environment boundary; S2. Collect the surface three-dimensional shape data and color image of the target tool, compare it with the pre-stored standard tool three-dimensional shape in space, and calculate the three-dimensional coordinates and tilt angle of the target tool as the target endpoint. S3. Update the target endpoint to the initial three-dimensional environment boundary, delineate the safety isolation zone and generate the corresponding constraint boundary. Within the constraint boundary, generate a motion trajectory that avoids the safety isolation zone from the current stopping position of the tool changing robot and undergoes a smooth transition. S4. Control the tool changing robot to move along the motion trajectory, and switch to force-position hybrid control when it reaches the set critical position. Obtain the contact resistance at the end of the tool changing robot, and make fine-tuning of the displacement according to the contact resistance to complete the tool changing action. S5. Record the error data during the tool change process, and compensate for the coordinates of the initial three-dimensional environment boundary before the next tool change.
2. The flexible tool changing method for CNC machine tools based on feature recognition and adaptive trajectory planning as described in claim 1, characterized in that, S1 specifically includes: The tool change command is parsed to extract the target tool number, and the pneumatic blowing device is controlled to perform directional cleaning operations on the spindle and tool magazine surfaces; the spatial coordinate values of the current location of the machine tool moving axis are read; in the virtual coordinate system, the spatial coordinate values are used to construct geometric bounding box data that covers the spindle, the tool magazine, the workpiece, and the fixture, and the geometric bounding box data is used as the initial three-dimensional environment boundary to define the physical space for subsequent operation.
3. The flexible tool changing method for CNC machine tools based on feature recognition and adaptive trajectory planning as described in claim 1, characterized in that, The acquisition of the three-dimensional shape data and color image of the target tool surface in S2 specifically includes: The color image processed by polarization filtering is acquired to filter reflective pixels on the metal surface; gradient change data of pixels in the color image is extracted to obtain geometric edge features; the geometric edge features are compared with a preset shape template to locate and output the two-dimensional pixel coordinates of the V-groove and positioning key on the shank of the target tool; in the synchronously acquired three-dimensional shape data of the surface, the local three-dimensional spatial point set corresponding to the two-dimensional pixel coordinates is extracted.
4. The flexible tool changing method for CNC machine tools based on feature recognition and adaptive trajectory planning as described in claim 3, characterized in that, In step S2, a spatial comparison is performed using the pre-stored standard tool's three-dimensional shape to calculate the target tool's three-dimensional coordinates and tilt angle as the target endpoint. Specifically, this includes: Obtain the standard spatial point set of the pre-stored standard tool 3D shape; calculate the Euclidean distance between corresponding points of the local 3D spatial point set and the standard spatial point set; minimize the sum of the Euclidean distances through iterative calculations, and solve for the rotation matrix and translation vector required to achieve spatial overlap of the two point sets; use the rotation matrix and translation vector to perform mathematical coordinate transformation on the current original spatial coordinates, and output the transformed 3D coordinates and tilt angle as the target endpoint.
5. The flexible tool changing method for CNC machine tools based on feature recognition and adaptive trajectory planning as described in claim 2, characterized in that, In step S3, the target endpoint is updated to the initial three-dimensional environment boundary, a safety isolation zone is defined, and a corresponding constraint boundary is generated. Specifically, this includes: The target endpoint is entered into the initial three-dimensional environment boundary to form an environmental topology map; the outer boundary dimensions of the workpiece and the fixture in the environmental topology map are extracted, and the expansion distance value is extended outward along the normal direction. The extended area is defined as the safety isolation zone; the maximum torque limit value and the maximum movement speed limit value output by the joint motor inside the tool changing robot are obtained, and the maximum torque limit value, the maximum movement speed limit value and the safety isolation zone are merged and set as the constraint boundary.
6. The flexible tool changing method for CNC machine tools based on feature recognition and adaptive trajectory planning as described in claim 1, characterized in that, In step S3, within the constraint boundary, a motion trajectory is generated that moves from the current stopping position of the tool-changing robot, avoiding the safety isolation zone and undergoing a smooth transition. Specifically, this includes: Starting from the current position of the tool-changing robot and ending at the target endpoint, discrete spatial sampling points are generated within the constraint boundary according to the set sampling step size. Interference sampling points falling into the safety isolation zone are eliminated. The retained valid sampling points are connected sequentially by straight line segments to form a preliminary movement path. The spatial turning point at the intersection of the straight line segments in the preliminary movement path is obtained. A smooth interpolation function containing boundary conditions of position, velocity, and acceleration is used to fit the spatial turning point and its adjacent straight line segments to solve for a smooth curve with continuous velocity and acceleration as the issued motion trajectory.
7. The flexible tool changing method for CNC machine tools based on feature recognition and adaptive trajectory planning as described in claim 6, characterized in that, In step S4, the tool-changing robot is controlled to move along the motion trajectory, and when it reaches a set critical position, it switches to force-position hybrid control, specifically including: The tool-changing robot is controlled to move spatially according to the position command issued by the motion trajectory; the relative distance between the end of the tool-changing robot and the tool holder of the target tool is calculated; if the relative distance shrinks to a set critical value, the force-position hybrid control that synchronously adjusts the position command and torque feedback is activated; the triaxial force data of the torque sensor installed at the end of the tool-changing robot is read as the contact resistance.
8. The flexible tool changing method for CNC machine tools based on feature recognition and adaptive trajectory planning as described in claim 1, characterized in that, In step S4, the displacement is finely adjusted based on the contact resistance to complete the tool change action, specifically including: The contact resistance is compared and calculated with a preset normal force range; if the contact resistance exceeds the normal force range, the force direction corresponding to the contact resistance is extracted, and the retraction fine-tuning coordinate opposite to the force direction is calculated; the tool changing robot is controlled to superimpose the retraction fine-tuning coordinate to perform spatial retraction fine-tuning; the resistance comparison and spatial retraction fine-tuning are repeatedly executed until the contact resistance falls back and remains within the normal force range, and subsequent actions are performed to complete the tool changing action.
9. The flexible tool changing method for CNC machine tools based on feature recognition and adaptive trajectory planning as described in claim 1, characterized in that, S5 specifically includes: Extract the first coordinate deviation value generated by the spatial comparison calculation and the second coordinate deviation value generated during the displacement fine-tuning process; vector superposition the first coordinate deviation value and the second coordinate deviation value to obtain a single system error value, which is stored in the experience database as the error data; obtain a preset number of consecutive tool change operation records in the experience database, and calculate the mean change slope of the single system error value; if the mean change slope exceeds a set threshold, calculate the expected error vector for the next tool change based on the extension direction of the mean change slope; before the next tool change action command is issued, use the expected error vector to reverse adjust the reference coordinate system where the initial three-dimensional environment boundary is located to complete the compensation.
10. A flexible tool changing system for CNC machine tools based on feature recognition and adaptive trajectory planning, characterized in that, The system, which is applied to the flexible tool changing method for CNC machine tools based on feature recognition and adaptive trajectory planning as described in any one of claims 1 to 9, comprises: The environment initialization module is used to receive tool change commands, read the coordinate position data of the machine tool's moving axes, and construct the initial three-dimensional environment boundary. The visual detection and comparison module is used to collect the surface three-dimensional shape data and color image of the target tool, and perform spatial comparison with the pre-stored standard tool three-dimensional shape to calculate the three-dimensional coordinates and tilt angle of the target tool as the target endpoint. The boundary generation and trajectory planning module is used to update the target endpoint to define a safety isolation zone in the initial three-dimensional environment boundary and generate a corresponding constraint boundary. Within the constraint boundary, a motion trajectory is generated that avoids the safety isolation zone from the current stopping position of the tool changing robot and undergoes a smooth transition. The force-position hybrid execution module is used to control the tool changing robot to move along the motion trajectory. When it reaches the set critical position, it switches to force-position hybrid control, obtains the contact resistance at the end of the tool changing robot, and performs displacement fine adjustment according to the contact resistance to complete the tool changing action. The error analysis and compensation module is used to record error data during the tool change process and compensate for the coordinates of the initial three-dimensional environment boundary before the next tool change.
