Machine tool online foresight anti-collision and safety control method
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIHANG UNIV
- Filing Date
- 2026-05-13
- Publication Date
- 2026-08-04
AI Technical Summary
这种技术缺失使得操作员必须持续监督来防止执行过程中的配置事故,不仅增加了操作员的认知负荷,也影响了自动化加工系统的运行鲁棒性和设备综合效率
1) 实现了无需依赖传感器的主动安全方案,极大地降低了硬件成本与环境敏感度需求。本发明打破了传统防碰撞系统对视觉、力矩等物理传感器的依赖,通过数字孪生状态同步实现纯模型驱动。补充了对易受高压冷却液、切屑遮挡等恶劣加工环境干扰的传感器方案的局限,使中小企业在零硬件改造成本下即可实现智能化改造。
Smart Images

Figure CN122507019A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of motion control and active safety technology in CNC machining. Specifically, it relates to a method for online proactive collision avoidance and safety control of machine tools. Background Technology
[0002] Accidental collisions during CNC machining are a major cause of production downtime and equipment damage. Although computer-aided manufacturing (CAM) systems can generate ideal collision-free toolpaths before machining, collisions still occur frequently in actual workshop operations. This is mainly due to unavoidable differences between offline-verified programs and the actual operating conditions of the machine tool (i.e., the simulation-reality gap). For example, uncertainties in operations such as incorrect input of tool length compensation parameters by the operator or misjudgment of safety clearance can unpredictably trigger collisions during execution.
[0003] Currently, to avoid illegal collisions, the industry mainly uses the following control and monitoring technologies, but they all have certain limitations in practical applications: (1) Existing technology 1: Preprocessing verification based on offline simulation: Currently, mainstream simulation software mainly relies on geometric intersection algorithms (such as hierarchical bounding box, voxelization method, etc.) to verify the preprogrammed logic before processing.
[0004] Limitations and causes: Lack of real-time response capability.
[0005] Offline prediction methods rely on an idealized assumption: that the physical machine tool's clamping position, tool parameters, and motion behavior are perfectly consistent with the virtual environment. However, this static verification cannot eliminate the risk of occasional interference during actual execution. When operational deviations occur at the machining site (such as errors in manual input compensation), even G-code programs that have passed offline simulation can still cause equipment collisions during actual physical machining.
[0006] (2) Existing technology 2: Real-time monitoring based on external vision / optical sensors: In order to make up for the limitations of offline simulation schemes, some schemes capture real-time status by installing external vision sensors in the processing area.
[0007] Limitations and causes: Poor robustness under adverse conditions such as coolant overflow.
[0008] The interior of a CNC machine tool is a typical harsh industrial environment. The splashing of high-pressure coolant, the dispersion of oil mist, and the metal chips generated during machining can obstruct and interfere with optical sensing, leading to a decrease in the spatial perception stability of the vision sensor. Furthermore, this technology is costly to implement and carries the risk of false alarms or missed alarms during actual operation.
[0009] (3) Existing technology three: passive defense based on feedback signal (torque / current): Existing machine tool servo control systems usually rely on monitoring abnormal motor current or torque to achieve safety protection.
[0010] Limitations and causes: The response is delayed and can cause secondary damage. This monitoring mechanism is a typical passive defense, meaning that an emergency stop is only triggered after the tool or spindle makes substantial physical contact with an obstacle and generates an overload. This intervention after contact cannot fundamentally prevent damage to the mechanical structure or workpiece. In addition, traditional hard emergency stop operations can cause the spindle to jam momentarily, and this sudden emergency stop recoil force introduces additional mechanical stress damage to the machine tool.
[0011] In summary, current CNC systems and related controller hardware generally lack explicit, closed-loop kinematics-based active safety mechanisms during motion execution. Existing safety solutions either overly rely on upper-level offline software (detached from physical reality), depend on expensive external sensing hardware (unreliable under harsh conditions), or are limited to passive power-off protection of the underlying servo system. The industry urgently needs an active safety control device that can be deeply coupled with the CNC underlying layer, providing millisecond-level anti-collision and autonomous tool retraction capabilities without adding complex external sensors. This technological deficiency forces operators to continuously monitor the process to prevent configuration accidents, increasing operator cognitive load and impacting the robustness and overall efficiency of automated machining systems. Summary of the Invention
[0012] To address the aforementioned technical problems, this invention proposes an online forward-looking collision avoidance and safety control method for machine tools, which does not rely on external physical sensors. This invention acquires the machine tool's underlying axis coordinates in real time, driving an upper-level high-fidelity predictive model. This active virtual spatiotemporal forward-looking deduction replaces traditional passive physical sensor detection, thereby achieving millisecond-level predictive collision avoidance and autonomous trajectory replanning without human intervention during the machining process, all with zero hardware modification costs.
[0013] This invention discloses an online proactive collision avoidance and safety control method for machine tools, the specific steps of which are as follows: Construct a dual-loop synchronous control architecture that includes a lower-level physical execution loop and an upper-level virtual prediction loop; The upper-level virtual prediction loop periodically acquires the real-time axis coordinates and speed status information of the physical machine tool fed back by the lower-level physical execution loop, and synchronizes it to the digital twin system to eliminate real-time offset errors. Using a second-order kinematic state extrapolation model, a predictive image model that is ahead of the physical machine tool in a fixed time domain is generated in real time in the digital twin system. When a collision risk is predicted between the predicted image model and the virtual environment data, the upper-layer virtual prediction loop sends a predictive stop command to the lower-layer physical execution loop and plans a collision-free retreat path. The collision-free retreat path is compiled into a patch G code file, which is loaded and executed by the underlying physical execution ring to achieve autonomous recovery of the machine tool.
[0014] Optionally, the underlying physical execution ring runs on the hard real-time kernel of the machine tool CNC system, responsible for interpolation instruction execution and servo drive control; the upper virtual prediction ring runs on a non-real-time edge computing environment, including a high-fidelity digital twin model, a collision detection engine, and a path planner; the underlying physical execution ring and the upper virtual prediction ring synchronize data with each other through an automated industrial communication protocol at a fixed polling cycle.
[0015] Optionally, the second-order kinematic state extrapolation model is an online trajectory generation algorithm that uses the current non-zero velocity and constrained acceleration of the physical machine tool as input to calculate the future trajectory points that satisfy the machine tool dynamics in real time; the predictive model is a dynamic virtual mapping that leads the physical entity by a preset period on the time axis and is used to perform collision detection in virtual space.
[0016] Optionally, the upper-layer virtual prediction ring issues a predictive stop command to the lower-layer physical execution ring, specifically including: The upper-layer virtual prediction loop sends a feed rate zeroing command to the lower-layer physical execution loop's real-time kernel via an automated industrial communication protocol. This guides the physical machine tool to perform smooth deceleration without interrupting power or cutting off servo enable, entering a soft-hover state, and locking the kinematic state at the moment of full braking as a safety anchor point.
[0017] Optionally, planning the collision-free retreat path specifically includes: The optimal pullback point is obtained based on rule-based geometric verification and heuristic local feature sampling. If the optimal retreat point cannot generate a collision-free path, then a global voxelized path search is initiated to obtain a discrete global collision-free geometric path. Optionally, the heuristic local feature sampling includes: expanding the bounding box of obstacles to construct a local free space, and using a multi-objective heuristic evaluation function to screen candidate retreat points.
[0018] Optionally, the global voxelization path search includes: Extract the dynamic bounding box containing the start point, end point and obstacle cluster and divide it into a three-dimensional voxel mesh. Introduce a conservative volume compensation mechanism to mark the voxels occupied by obstacle patches as occupied. A global path search algorithm is executed on the voxel grid, triggering dual intersection verification of volume probing and continuous swept spherical rays only when the search front extends to a suspicious node; A greedy direct connection check strategy based on anchor points is adopted to eliminate redundant waypoints and output discrete global collision-free geometric paths.
[0019] Optionally, after compiling the collision-free retreat path into a patch G code file, a spatial threshold switching strategy is introduced and explicitly mapped to a continuous path mode, driving the machine tool to achieve smooth and non-stop physical recovery between multiple retreat paths.
[0020] Optionally, the spatial threshold switching strategy is as follows: real-time monitoring of the remaining Euclidean distance between the current position of the machine tool's physical axis and the local target point; when the distance is less than a preset spatial threshold, the non-zero final state velocity of the previous segment is directly used as the initial state input for the next segment, and the underlying online trajectory generator calculates the transition trajectory in real time.
[0021] Compared with the prior art, the present invention has at least the following beneficial effects: 1) This invention achieves a sensor-free active safety solution, significantly reducing hardware costs and environmental sensitivity requirements. It breaks away from the reliance of traditional collision avoidance systems on physical sensors such as vision and torque sensors, achieving pure model-driven operation through digital twin state synchronization. It overcomes the limitations of sensor solutions susceptible to interference from harsh processing environments such as high-pressure coolant and chip obstruction, enabling SMEs to achieve intelligent transformation with zero hardware modification costs.
[0022] 2) Overcoming the response lag problem of physical sensors, millisecond-level deterministic collision avoidance is achieved. Through adjustable look-ahead time windows, the system can detect hazards before physical contact occurs. Experiments show that the communication latency under this dual-loop control architecture is only about 1.159 ms, the total physical safety reaction time is compressed to 136 ms, and the sliding distance under experimental speed measurement is strictly controlled within 1.73 mm, thus effectively reducing the risk of damage to the spindle and precision workpieces.
[0023] 3) A technical solution for autonomous fault recovery in CNC machining was proposed, significantly improving the safety of real-time equipment operation. Traditional emergency stop protection requires operators to perform tedious manual reset operations for several minutes after a collision. This invention utilizes a hierarchical adaptive programming algorithm, which can automatically complete the closed loop from path search, patch G-code generation to safe retreat within approximately 2029 ms after the alarm is triggered. This achieves safe autonomous recovery without human intervention from the occurrence of interference to safe retreat, greatly shortening the unplanned downtime caused by accidents.
[0024] 4) It exhibits high kinematic compliance and smoothness. Unlike traditional hard emergency stop strategies that trigger a deadlock, the preemptive soft hovering mechanism and continuous trajectory propagation strategy based on spatial thresholds proposed in this invention can achieve a smooth transition without disabling servo enable. This effectively mitigates the mechanical stress impact caused by severe braking and helps extend the machine tool's lifespan.
[0025] 5) It has extremely high geometric scalability and extremely low computational requirements. Through heuristic local sampling and underlying BVH tree pruning mechanism, this invention greatly reduces the search overhead of three-dimensional configuration space, and can compress the anti-collision calculation latency of industrial-grade complex curved surfaces (such as impellers with tens of thousands of facets) to less than 4 milliseconds, clearly ensuring stable operation on resource-constrained industrial edge controllers. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the embodiments will be briefly introduced below. The features and advantages of the present invention can be more clearly understood by referring to the accompanying drawings. The accompanying drawings are schematic and should not be construed as limiting the present invention in any way. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 The flowchart shows the active obstacle avoidance and autonomous recovery method for CNC machining based on digital twins according to the present invention. Figure 2 This is a schematic diagram of the edge-based real-time active avoidance framework of the present invention; Figure 3 This is a schematic diagram of the rule-based geometric avoidance strategy of the present invention; Figure 4 This is a schematic diagram of the network physical synchronization dual-loop control architecture of the present invention; Figure 5 This describes the physical implementation and hardware topology of the experimental testing platform of the present invention. Figure 6 The results of hardware-in-the-loop experiments on the active safety loop of the method of the present invention are presented. Detailed Implementation
[0028] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments of the present invention and the features thereof can be combined with each other.
[0029] A specific embodiment of the present invention, such as Figures 1-6 As shown, a method for online proactive collision avoidance and safety control of machine tools is disclosed, which specifically includes the following steps: Step 1. Construct a dual-loop synchronous control architecture based on digital twins and obtain the predictive shadow model; See Figure 4 Based on the underlying communication protocols of the machine tool CNC system (such as the ADS protocol), a dual-loop control architecture is constructed, comprising a lower-level physical execution loop and an upper-level virtual prediction loop. Without the need for external sensors, the upper-level virtual prediction loop periodically acquires the real-time axis coordinates and velocity status information of the physical machine tool and synchronizes it to the digital twin system to eliminate real-time offset errors, thus solving the time lag and spatial drift problems between the virtual prediction model and the physical machine tool. Subsequently, using the online trajectory generation (OTG) algorithm combined with machine tool kinematic constraints, a second-order kinematic state extrapolation model is constructed, generating a real-time predictive image model of the physical CNC machine tool in a fixed time domain, ahead of its actual operation, within the digital twin system.
[0030] Specifically, the underlying physical execution loop runs in the hard real-time (RT) kernel of the machine tool CNC system (e.g., the TwinCAT3 system). This loop is responsible for interpolation instruction execution, servo drive control, and high-frequency feedback of encoder status (e.g., 1ms control cycle).
[0031] Furthermore, the underlying physical execution loop is composed of a PLC logic controller and an NC / CNC numerical interpolation channel. Data sent from the upper-level virtual prediction loop (such as the upper-level C++ terminal) is routed to these two independent modules respectively: 1. Inputs (control flow) to the PLC logic controller: Status trigger instruction: This is the only upper-level virtual predictive loop instruction received by the PLC logic controller (i.e., the core control logic). For example, an emergency stop / interrupt request boolean variable sent from the C++ side via the ADS protocol. The PLC logic controller only executes the logic flow of precise hijacking -> soft hovering -> release ready based on this signal, without directly processing any coordinate and trajectory data.
[0032] 2. Direction to the input (data flow) of the NC / CNC numerical interpolation channel: Trajectory and control parameters (patch G code): After generating the risk avoidance or regular retreat path, the upper-level virtual prediction loop packages it together with the continuous trajectory mode instructions (such as G64) and saves it directly as a local patch G code file.
[0033] Furthermore, the loading and execution mechanism is as follows: after the PLC logic controller completes soft hovering and releases the hijacking, and outputs a ready signal, the underlying NC / CNC numerical interpolation channel directly loads the patch G code file from the local machine for interpolation execution.
[0034] Specifically, the upper-layer virtual prediction loop is a prediction simulation engine running in a non-real-time edge computing environment (such as an active safety module developed in C++) on an industrial computing platform. This loop includes a high-fidelity digital twin model, a collision detection engine, and a path planner.
[0035] Furthermore, the upper-level virtual prediction loop of this invention is completely decoupled from the machine tool's original machining code. Its complete data flow and processing mechanism are as follows: 1. Input data: Real-time status feedback at the physical layer: The absolute position coordinates and velocity vector of the machine tool are obtained in real time from the underlying physical execution loop via communication protocols such as ADS at a high frequency (e.g., 8ms). This invention does not rely on or input the original machining geometry path data of the machine tool; the prediction is driven entirely by the real-time physical motion state of the underlying layer.
[0036] Virtual environment data: 3D geometric / bounding box data of the machine tool itself and its surrounding environment, fixtures and other potential interference objects maintained in the system memory (used for subsequent spatial collision detection).
[0037] 2. Internal processing logic: Dynamic prediction model generation: Using the absolute position coordinates and velocity vector of the machine tool obtained from the underlying physical execution loop, a second-order kinematic state extrapolation model (such as an online trajectory generator OTG) is directly used to extrapolate and predict several prediction spatial points in the look-ahead time domain, under the premise of machine tool acceleration constraints. These prediction spatial points are instantiated in the digital twin system to form the prediction model.
[0038] Advanced Collision Detection: The collision detection engine assesses in real time whether there is interference between the predicted model and the virtual environment data. Because the predicted model precedes the physical entities, the system can detect risks in advance.
[0039] Risk avoidance planning: Once the risk of intervention is anticipated, the internal trajectory planner immediately plans a collision-free retreat path based on the current safe pose using decoupled asynchronous threads.
[0040] 3. Output data: The output of the upper-level virtual prediction loop directly corresponds to the input of the lower-level physical execution loop, including control flow and data flow: Upon detecting a collision risk, a predictive stop command (interrupt request) is sent to the underlying PLC logic controller via the ADS protocol, triggering the underlying PLC to enter soft hover mode.
[0041] Outputting trajectory data to the underlying layer (data flow): The planned safe evacuation path is saved as a patch G code file, and a ready signal is sent down to the underlying physical execution loop for automatic loading and execution after confirming safety.
[0042] Specifically, the loading and execution mechanism is as follows: after the PLC logic controller completes soft hovering and releases the hijacking, and outputs a ready signal, the underlying NC / CNC numerical interpolation channel will directly load the patch G code file from the local machine for interpolation execution.
[0043] Specifically, the state synchronization mechanism is as follows: the underlying physical execution ring and the upper virtual prediction ring synchronize data through an automated industrial communication protocol (such as the ADS protocol) with a fixed polling period (e.g., 8ms).
[0044] The upper-level virtual prediction loop continuously acquires the real-time position and speed of the physical axes of the physical CNC machine tool and synchronizes them to the digital twin model, thereby reducing error accumulation.
[0045] Furthermore, the second-order kinematic state extrapolation model is an online trajectory generation (OTG) algorithm (such as the Reflexxes algorithm) running on the virtual end. It takes the current non-zero velocity and constrained acceleration of the physical CNC machine tool as input and calculates the future trajectory points that satisfy the machine tool's dynamics in real time. The predictive model is a dynamic virtual mapping that leads the physical entity by a certain period on the time axis in the predictive simulation engine on the edge computing side, used to perform collision detection in virtual space. The extrapolation model provides the predictive model with advanced spatiotemporal data, which the predictive model then uses to explore the virtual space and provide collision warnings. The combination of the two achieves a proactive safety collision avoidance closed loop of 'predict first, then execute'. Understandably, before actual machining begins, the dual-loop synchronous control architecture uses the real-time position of the physical CNC machine tool, the geometric / kinematic model of the machine tool and the scene, and coordinate configuration as initial inputs. During operation, the physical execution loop uses servo axis feedback and the execution status of the NC / CNC numerical interpolation channel as periodic inputs, while the virtual prediction loop synchronizes these states via industrial communication and performs interference prediction within the look-ahead window. This periodic cycle continues while the physical CNC machine tool is in automatic / predictive enabled mode until the program ends, mode is switched, or a fault safety trigger occurs. During normal operation, the physical execution loop outputs continuous motion commands to the servo drive. When the virtual prediction loop determines that there is a collision risk, the system output includes: braking or feed holding (hovering) control of the physical execution loop; and converting the local collision-free retreat trajectory into a G-code file and writing it to local storage accessible by the CNC system, then instructing the CNC system to load and execute the local program via the industrial communication interface. The above safety measures continue until the machine tool reaches the predetermined safe position.
[0046] Step S2: Acquire kinematic state data and synchronize the state.
[0047] Specifically, the edge computing node, based on a dual-loop synchronous control architecture, uses an automated industrial communication protocol to read the kinematic state data of the physical CNC machine tool in real time at a preset period (e.g., 8ms). This kinematic state data includes the actual position, velocity, and acceleration of each feed axis. Subsequently, this kinematic state data is forcibly assigned to the virtual shadow model in the digital twin system, establishing a current starting line without spatial drift. This eliminates the integral error accumulated by the digital twin over time, achieving strict state synchronization between the physical space and the virtual space of the digital twin system.
[0048] Understandably, the virtual shadow model represents the virtual entity of the physical CNC machine tool at the current moment. The predicted shadow model is derived using a second-order kinematic extrapolation algorithm based on the current starting line (current speed and position).
[0049] Step S3: Obtain the kinematic prediction trajectory by extrapolating the spatiotemporal state of the predicted image model.
[0050] Specifically, the digital twin system utilizes an online trajectory generation (OTG) algorithm, based on the non-zero velocity and current absolute position (starting point coordinates) of the current physical CNC machine tool, as well as the physical dynamic constraints of the physical CNC machine tool, to construct a look-ahead time window of a preset length along the time axis. For example, the kinematic prediction trajectory (e.g., 0.5s).
[0051] Furthermore, the length of the preset look-ahead time window is greater than the sum of the collision detection and system communication delay and the maximum braking time of the physical machine tool; the physical dynamics constraint of the physical CNC machine tool is the maximum acceleration / deceleration vector allowed by the physical CNC machine tool servo system.
[0052] The kinematic prediction trajectory is a set of future spatial coordinates (covering a future forward time window). The kinematic prediction trajectory gives the predicted model its future spatiotemporal coordinates, enabling the predicted model to move in virtual space.
[0053] Step S4: Perform multi-level dynamic collision detection.
[0054] Specifically, within the prediction time domain, discrete keyframe sampling is performed on the kinematic prediction trajectory according to kinematic constraints. First, wide-phase detection is performed using dynamic hierarchical bounding boxes (AABB trees). Then, narrow-phase detection is called to perform precise intersection at the 3D mesh level of physical CNC machine tools / tools for possible collision pairs to obtain dynamic collision detection results.
[0055] Among them, the dynamic hierarchical bounding box (AABB tree) is a spatial tree-like data structure used in step S4 global collision detection. It contains hundreds or thousands of bounding boxes of all objects such as machine tools, cutting tools, and fixtures, and is used for fast wide-phase detection.
[0056] Step S5: Determine if there is a collision risk within the lookout window. If there is no collision risk, return to step S2; if a collision risk is detected, trigger step S6.
[0057] Furthermore, if the dynamic collision detection result in step S4 is that the three-dimensional mesh surface of the physical CNC machine tool / tool overlaps with the three-dimensional mesh surface of the environment / fixture / workpiece in terms of spatial geometric coordinates, it is determined that there is a collision risk and an obstacle exists.
[0058] Step S6: Trigger the physical machine tool's active safety braking and soft hovering.
[0059] Specifically, the upper-level virtual prediction loop sends a feed rate zeroing command to the underlying real-time kernel of the lower-level physical execution loop via an automated industrial communication protocol. This guides the physical CNC machine tool to perform smooth deceleration without interrupting power or cutting off servo enable, until it enters a soft-hover state without mechanical shock, and locks the kinematic state at the moment of full braking as a safety anchor point.
[0060] Step S7: Initiate hierarchical adaptive obstacle avoidance replanning to obtain the obstacle avoidance trajectory.
[0061] Specifically, the system asynchronously activates the hierarchical path planning module to generate obstacle avoidance trajectories, including: S71: Obtain the optimal pullback point through rule-based geometric verification and heuristic local feature sampling.
[0062] Specifically, if the geometric verification of the rule (ray beam or vertical lift verification) fails, the heuristic local feature sampling scheme is adopted. The steps are as follows: first, the obstacle bounding box AABB is expanded to construct a local free space. Then, the candidate retreat points generated near the center, edge and corner of the local free space are screened using a multi-objective heuristic evaluation function to obtain the optimal retreat point.
[0063] If successful, directly adopt the simple path (such as retreating directly along the vertical direction to the safe plane) and skip the complex heuristic sampling to save computational resources.
[0064] Furthermore, the evaluation function comprehensively assesses the overall utility score of the candidate withdrawal points, and its expression is:
[0065] in, This represents the overall utility score of the candidate pullback point p; express The basic weights corresponding to the evaluation indicators; It represents the utility of safe distance and is used to assess the Euclidean distance between a candidate point and the nearest obstacle (or its bounding box), aiming to guide the tool to actively move away from high-risk areas; express The basic weights corresponding to the evaluation indicators; It represents the lateral avoidance effectiveness and is used to evaluate the lateral distance of the candidate retreat point from the original collision path; express The basic weights corresponding to the evaluation indicators; It represents the lateral avoidance effectiveness and is used to evaluate the lateral distance of the candidate retreat point from the original collision path; express The basic weights corresponding to the evaluation indicators; It represents the high stability utility, used to assess the degree of fluctuation of the Z-axis height of candidate retreat points relative to the mean safety plane, and to avoid unnecessary violent Z-axis movements; express The basic weights corresponding to the evaluation indicators; It represents the local continuity utility and is used to evaluate the distance between candidate retreat points and the current starting point, so as to avoid large leaps in local planning; Furthermore, the expression for the utility of a safe distance is:
[0066] In the formula, The Euclidean distance from the candidate pullback point to the nearest obstacle bounding box (AABB); The parameter represents the maximum sensing boundary.
[0067] The method of this invention follows the "safety first" principle, assigning the highest basic weight to this item. ( This is to guide the cutting tool away from high-risk interference zones.
[0068] Furthermore, the expression for lateral avoidance utility is:
[0069] In the formula, The horizontal and vertical distance of the candidate point relative to the original blocked path; This is the set horizontal offset reference value; this item (weight as follows) The goal is to reward candidate points that deviate significantly from the collision trajectory, thereby accelerating the tool's lateral escape process; Furthermore, the expression for directional consistency utility is: ,
[0070] in, This represents the step direction vector from the current safe anchor point to the candidate pullback point; Indicates the coordinates of the candidate pullback points currently being assessed; This indicates the spatial coordinates of the current safe anchor point (retreat starting point); This represents the global direction vector from the current safe anchor point to the final target point.
[0071] Cosine similarity is used to calculate the angle between the sampling step direction and the global target direction. This term (with weights as follows) This is used to ensure that while the machine tool is performing local obstacle avoidance actions, it still maintains the overall trend of approaching the target endpoint; Furthermore, the expression for high stability utility is:
[0072] In the formula, The Z-axis height of the candidate pullback point; This represents the average safe plane height. This is a height normalization factor (e.g., taking the absolute value of the Z-axis height difference between the target and the starting point). This term (weight) This is used to punish severe height fluctuations and reduce unnecessary frequent fluctuations in the Z-axis, thereby improving the kinematic smoothness of the machine tool during retraction; Furthermore, the expression for local continuity utility is:
[0073] In the formula, The Euclidean distance between the candidate pullback point and the current safe anchor point (starting point); This is the set reference length for the local segment. This item (weight as follows) This is used to make small spatial adjustments that are close to the current position, preventing large spatial jumps in local planning and ensuring the robustness of the trajectory generation algorithm.
[0074] S72: Determine whether the optimal retreat point generates a collision-free path. If the optimal retreat point generates a feasible path in S71, proceed to S8; if the optimal retreat point does not generate a feasible path, trigger step S73.
[0075] Specifically, a feasible path is considered to have been generated only when the optimal pullback point p simultaneously meets the following two conditions: There is no interference between the straight line segment from the current safe anchor point to the optimal retreat point p; there is no interference between the straight line segment from the optimal retreat point p to the local target point (or the global target point).
[0076] S73: Global voxelization path search to obtain discrete global collision-free geometric paths, proceed to step S8.
[0077] Specifically, a voxelized A* global search (global path search algorithm) with a hybrid probe inspection mechanism is initiated, and the path points are smoothed after ray projection. The specific steps are as follows: 1) Dynamic Local C-Space Voxelization: Extract the dynamic bounding box containing the start point, end point, and obstacle clusters of the envelope space of the task to be searched and divide it into a 3D voxel mesh. Introduce a conservative volume compensation mechanism (the compensation radius is the sum of the tool radius, safety margin, and half-diagonal length of the voxel). If an obstacle patch overlaps with the compensated probe sphere, the voxel is marked as occupied, thus eliminating mesh discretization errors from a physical perspective.
[0078] The envelope space of the task to be searched is the minimum axial envelope space that includes the current machine tool position (starting point), the final machining target point (end point), and the geometric model of all obstacles around the paths of the two that may interfere with each other.
[0079] 2) Delayed Collision Assessment A* Global Search: An A* global search is performed on a 26-connected voxel grid. To reduce computational cost, only voxels falling within the obstacle expansion boundary are marked as suspicious, and physical intersection calculations are delayed. Dual intersection verification of volume probing and continuous sweep spherical rays is triggered only when the A* global search front extends to the suspicious node, thereby quickly finding topologically connected grid paths.
[0080] 3) Greedy Shortcut Path Optimization: To eliminate the jagged effect of grid paths, a greedy direct connection checking strategy based on anchor points is adopted. Sub-voxel-level ray tracing technology is introduced to perform fine-grained sampling between directly connected grid points and map them back to occupied grids to verify visibility. This eliminates redundant waypoints and outputs discrete, globally collision-free geometric paths, subsequently proceeding to step S8.
[0081] Step S8: Dynamic trajectory smoothing and online trajectory generation. The collision-free geometric path output in step S7 is transformed into a time-optimal continuous trajectory that satisfies the maximum speed and acceleration constraints, and then proceeds to step S9.
[0082] Step S9: Safe trajectory reload and autonomous recovery execution.
[0083] Specifically, the safe path is compiled into a patch G code file, triggering the CNC kernel to read the instructions. A space threshold switching strategy is introduced and explicitly mapped to a continuous path mode (G64), driving the machine tool to achieve smooth, non-stop physical recovery between multiple retraction paths.
[0084] Furthermore, by introducing a spatial threshold switching strategy and explicitly mapping it to a continuous path mode, the specific steps for driving the machine tool to achieve smooth, non-stop physical recovery between multiple retreat paths are as follows: 1) Spatial Threshold Switching Strategy: The system relaxes the traditional constraint that intermediate waypoints must be reduced to zero. During execution, the remaining Euclidean distance between the current position of the machine tool's physical axis and the local target point is monitored in real time. When this distance is less than a preset spatial threshold, deceleration and stopping are not triggered. Instead, the non-zero final state velocity of the previous segment is used as the initial state input for the next segment, and the underlying online trajectory generator calculates an efficient transition trajectory that satisfies the kinematic constraints in real time.
[0085] 2) Multi-dimensional Virtual-Real Consistency Mapping Mechanism: At the state layer, the virtual trajectory execution module periodically obtains the actual feed axis position and speed of the underlying servo drive through real-time fieldbus communication, and overwrites the state vector of the online trajectory generator in real time accordingly. This closed-loop correction mechanism strictly anchors the virtual model to each control frame of the physical machine tool, ensuring that all forward prediction calculations originate from the real physical state. At the instruction semantic layer, the spatial switching logic in the virtual domain is explicitly mapped to the continuous path mode (such as G64 mode) instruction in the kernel of the physical CNC system, thereby actively suppressing the precise stopping behavior of the physical servo system at intermediate waypoints and forcing the execution of the physical spindle to be non-zero with the virtual end. The smooth cornering motion, matched with the speed transition, strictly controls the spatiotemporal deviation between prediction and execution within a safe margin. At the kinematic level, the virtual trajectory extrapolation process strictly follows the physical topology of the target machine tool, decoupling the motion increment space into independent kinematic chains corresponding to different feed axis groups. That is, decoupling into the tool motion chain receiving the first axis group component and the table motion chain receiving the reverse second axis group component (for example, for a specific machine tool configuration, the tool motion chain receives the X / Y axis component, and the table motion chain receives the reverse Z axis component), thereby ensuring that the spatial geometry of the digital twin mirror and the physical machine tool remains absolutely consistent throughout the entire obstacle avoidance and tool retraction maneuver.
[0086] The multi-dimensional virtual-real consistency mapping mechanism of this invention can ensure that the continuous transition in the digital twin environment can be reproduced with high fidelity on the physical entity. Experimental verification and performance analysis are as follows: To verify the effectiveness of the method of the present invention, tests were conducted in an experimental environment equipped with a three-axis vertical milling platform (e.g., Figure 5(Left). First, the communication efficiency of the experimental platform based on protocols such as ADS was tested. The overall standard deviation of communication was limited to within 0.297 ms, and the maximum latency was strictly controlled to within 2.224 ms. In a dynamic collision interception experiment with a feed rate of 25 mm / s: based on adjustable look-ahead time window detection, the system achieved deterministic preemption of the underlying state machine after triggering a danger alarm. The total physical downtime of the system was measured to be 136 ms, and the relative sliding braking distance was strictly controlled to 1.73 mm, effectively avoiding physical contact and meeting the millisecond-level timing requirements of active safety blocking. In addition, in the autonomous recovery test, from triggering a collision stop to completing the new G-code planning in the background and re-controlling the servo axis acceleration retreat, the entire fully automatic heavy load recovery time was approximately 2029 ms. (See attached image.) Figure 6 The diagram shows the sequence of events during synchronized operation of the actual machine and its digital twin. This effectively demonstrates that the present invention, while ensuring smooth movement, replaces the traditional manual troubleshooting and reset process that takes several minutes, achieving highly available autonomous recovery without human intervention.
[0087] On the other hand, see the figure: (1) Fiber-based safety corridor verification. The system approximates the tool's safety corridor using discrete ray beams with a safety margin. Figure 3 Scenario 1). If the linear path has no collisions, it is directly adopted, terminating subsequent high-cost calculations. Starting from, The endpoint.
[0088] (2) Vertical lifting verification. If the straight path fails, the system defaults to executing the CNC standard vertical retraction, lifting the tool to the dynamic safety height. Figure 3 Scenario 2), and the same ray mechanism was used for verification. Starting from, As the point of elevation, The endpoint.
[0089] 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 the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be covered within the scope of the claims and specification of the present invention.
Claims
1. A method for online proactive collision avoidance and safety control of machine tools, characterized in that, The specific steps are as follows: Construct a dual-loop synchronous control architecture that includes a lower-level physical execution loop and an upper-level virtual prediction loop; The upper-level virtual prediction loop periodically acquires the real-time axis coordinates and speed status information of the physical machine tool fed back by the lower-level physical execution loop, and synchronizes it to the digital twin system to eliminate real-time offset errors. Using a second-order kinematic state extrapolation model, a predictive image model that is ahead of the physical machine tool in a fixed time domain is generated in real time in the digital twin system. When a collision risk is predicted between the predicted image model and the virtual environment data, the upper-layer virtual prediction loop sends a predictive stop command to the lower-layer physical execution loop and plans a collision-free retreat path. The collision-free retreat path is compiled into a patch G code file, which is loaded and executed by the underlying physical execution ring to achieve autonomous recovery of the machine tool.
2. The method according to claim 1, characterized in that, The underlying physical execution ring runs in the hard real-time kernel of the machine tool CNC system, responsible for interpolation instruction execution and servo drive control; the upper virtual prediction ring runs in a non-real-time edge computing environment, including a high-fidelity digital twin model, a collision detection engine, and a path planner; the underlying physical execution ring and the upper virtual prediction ring synchronize data with a fixed polling period through an automated industrial communication protocol.
3. The method according to claim 1, characterized in that, The second-order kinematic state extrapolation model is an online trajectory generation algorithm that uses the current non-zero velocity and constrained acceleration of the physical machine tool as input to calculate the future trajectory points that satisfy the machine tool dynamics in real time. The prediction model is a dynamic virtual mapping that leads the physical entity by a preset period on the time axis and is used to perform collision detection in virtual space.
4. The method according to claim 1, characterized in that, The upper-layer virtual prediction ring issues a predictive stop command to the lower-layer physical execution ring, specifically including: The upper-layer virtual prediction loop sends a feed rate zeroing command to the lower-layer physical execution loop's real-time kernel via an automated industrial communication protocol. This guides the physical machine tool to perform smooth deceleration without interrupting power or cutting off servo enable, entering a soft-hover state, and locking the kinematic state at the moment of full braking as a safety anchor point.
5. The method according to claim 4, characterized in that, The planned collision-free retreat path specifically includes: The optimal pullback point is obtained based on rule-based geometric verification and heuristic local feature sampling. If the optimal retreat point cannot generate a collision-free path, then a global voxelized path search is initiated to obtain a discrete global collision-free geometric path.
6. The method according to claim 5, characterized in that, The heuristic local feature sampling includes: constructing a local free space by expanding the bounding box of obstacles, and using a multi-objective heuristic evaluation function to screen candidate retreat points.
7. The method according to claim 5, characterized in that, The global voxelization path search includes: Extract the dynamic bounding box containing the start point, end point and obstacle cluster and divide it into a three-dimensional voxel mesh. Introduce a conservative volume compensation mechanism to mark the voxels occupied by obstacle patches as occupied. A global path search algorithm is executed on the voxel grid, triggering dual intersection verification of volume probing and continuous swept spherical rays only when the search front extends to a suspicious node; A greedy direct connection check strategy based on anchor points is adopted to eliminate redundant waypoints and output discrete global collision-free geometric paths.
8. The method according to claim 1, characterized in that, After compiling the collision-free retreat path into a patch G code file, a spatial threshold switching strategy is introduced and explicitly mapped to a continuous path mode, driving the machine tool to achieve smooth and non-stop physical recovery between multiple retreat paths.
9. The method according to claim 8, characterized in that, The spatial threshold switching strategy is as follows: real-time monitoring of the remaining Euclidean distance between the current position of the machine tool's physical axis and the local target point; when the distance is less than the preset spatial threshold, the non-zero final state velocity of the previous segment is directly used as the initial state input of the next segment, and the underlying online trajectory generator calculates the transition trajectory in real time.