A loading and unloading control method and system for CNC machining

By acquiring and repairing the image and geometric feature information of the workpiece, and adjusting the robot trajectory in real time, the problem of unstable clamping caused by workpiece position offset and deformation during CNC loading and unloading was solved, achieving stable recognition and safe clamping.

CN121120574BActive Publication Date: 2026-04-28SHENZHEN XIN MAO XIN IND CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN XIN MAO XIN IND CO LTD
Filing Date
2025-09-05
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

During CNC automatic loading and unloading, workpiece position deviation, unclear surface features, or deformation can cause unstable gripping by the robotic arm, easily leading to gripping deviation, grasping failure, and equipment shutdown.

Method used

By acquiring image and geometric feature information of the workpiece, the image information is repaired using polarization filtering, contour fitting, and multi-point feature reconstruction methods. Combined with geometric feature information, a joint verification is performed to generate the motion path of the robot arm. Displacement and force feedback are collected in real time for trajectory adjustment to ensure the stability of clamping.

Benefits of technology

It effectively avoids the influence of light, deformation and occlusion on positioning, realizes stable identification and safe clamping of workpieces, reduces clamping deviation and secondary damage risk, and avoids equipment downtime.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121120574B_ABST
    Figure CN121120574B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of CNC, and discloses a feeding and discharging control method and system for CNC machining, which comprises the following steps: acquiring image information and geometric feature information of a workpiece; performing quality detection based on the information; when there is abnormal reflection, shielding or deformation, respectively adopting polarization filtering, contour fitting or multi-point feature reconstruction to repair the image information, and generating repaired image and geometric feature information; performing template matching and edge detection on the repaired image; when the results are consistent, determining the position and posture of the workpiece; when the results are inconsistent, jointly checking based on the geometric feature information to obtain a corrected positioning result; generating a mechanical hand motion path according to the corrected positioning result, collecting displacement feedback and stress feedback in the clamping process, and adjusting the incident angle and the clamping trajectory according to the feedback change trend. Through multi-source information checking and feedback driving regulation, the application realizes stable identification and clamping control of the workpiece under complex working conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of CNC technology, and more specifically, to a loading and unloading control method and system for CNC machining. Background Technology

[0002] In CNC automated loading and unloading processes, workpieces are typically stored in trays or fixtures. During loading, transfer, or processing, the following situations may occur: slight movement of the workpiece within the tray leading to positional shifts; minor tolerances between different batches or slight deformation due to stress release during processing; unclear image features on the workpiece surface due to residual cutting fluid, oil contamination, or reflective interference; and even thermal deformation on the workpiece surface after high-temperature processing can affect the stability of its geometric contours.

[0003] The above situations can lead to the following problems when the robot arm is performing loading and unloading operations and the gripper is holding the workpiece: When the workpiece position or posture is offset, the robot arm may misalign the gripping point according to the preset path, resulting in the gripper not gripping or the gripping deviation; When the surface features of the workpiece are blurry or the boundaries are unclear, the visual positioning algorithm is prone to failure, making it impossible for the gripper to obtain accurate gripping reference information, resulting in gripping failure; When the workpiece has slight deformation or tolerance accumulation, the gripping force is unevenly distributed, which may cause the gripper to be not firm or cause secondary damage to the workpiece; During the unloading process, if the workpiece is not correctly identified and positioned, the robot arm may shift the placement position, causing the workpiece to fall or be misaligned when stacked.

[0004] Therefore, under the aforementioned complex working conditions, traditional loading and unloading control methods that rely on fixed paths and single visual recognition methods often fail to guarantee the stability and accuracy of clamping actions, easily leading to workpiece gripping failures and, in severe cases, equipment shutdowns. Summary of the Invention

[0005] In view of this, the present invention proposes a loading and unloading control method and system for CNC machining to solve the above problems.

[0006] On one hand, the present invention proposes a loading and unloading control method for CNC machining, comprising:

[0007] Acquire workpiece image information and geometric feature information stored in a material tray or fixture. The geometric feature information includes edge contour data, surface height distribution data, and a set of feature point coordinates.

[0008] Based on the image information and geometric feature information, the workpiece status is inspected for quality. When it is determined that there is abnormal reflection, abnormal surface occlusion, or abnormal deformation, the image information is repaired by polarization filtering method, contour fitting method, or multi-point feature reconstruction method, and the repaired image information and geometric feature information are generated.

[0009] Template matching and edge detection are performed on the repaired image information. When the template matching and edge detection results are consistent, the workpiece position and orientation are determined. When the detection results are inconsistent, joint verification is performed based on the geometric feature information to obtain the corrected positioning result of the workpiece.

[0010] The motion path of the robot is generated based on the corrected positioning result, and displacement feedback and force feedback are collected in real time during the gripping operation of the robot. The incident angle and gripping trajectory of the robot are adjusted according to the changing trends of the displacement feedback and force feedback.

[0011] Furthermore, the quality inspection includes:

[0012] The edge contour data of the workpiece is divided into several continuous edge segment sets, and the endpoint coordinates and curvature change rate are recorded in each continuous edge segment set.

[0013] The workpiece surface is divided into multiple height sampling units to construct a surface height distribution data matrix. Each height sampling unit includes the average height value and the height fluctuation amplitude.

[0014] Extract the set of feature point coordinates of the workpiece and group them according to the distribution density. Each feature point group includes a coordinate vector, local angle value and the rate of change of distance between adjacent points.

[0015] When discontinuous segments appear in the edge contour data, the boundary is completed based on the set of feature point coordinates;

[0016] Subsequently, when the fluctuation range of the surface height distribution data exceeds the preset stable range, the corresponding continuous edge segment is marked as a suspected deformation area; when the local included angle value of the feature point coordinate set continuously exceeds the included angle threshold, the corresponding continuous edge segment is marked as a suspected occlusion area; when there are discontinuous segments in the edge contour data and the number of feature points of the corresponding continuous edge segment is lower than the set reference value, the current continuous edge segment is marked as a suspected reflective area.

[0017] Furthermore, when an abnormal reflection is detected, the image information restoration includes:

[0018] When a reflection anomaly is detected, the continuous edge segment of the anomaly is obtained, and the gray-level difference sequence between adjacent pixels is calculated within the pixel area of ​​the continuous edge segment.

[0019] The grayscale difference sequence is compared with the grayscale difference sequences of other continuous edge segments of the same workpiece, and the zero-crossing density and feature point density of each continuous edge segment are calculated. If the current continuous edge segment is broken, and the zero-crossing density of the current continuous edge segment is the lowest in the set of continuous edge segments and the feature point density of the current continuous edge segment is the lowest in the set of continuous edge segments, then the current continuous edge segment is marked as a reflective area.

[0020] Several sets of image segments were acquired in the reflective area at different polarization angles, and the edge direction of each image segment was extracted. The edge segments with the same edge direction in each image segment were spliced ​​together to form new edge contour data, and the set of feature point coordinates was reconstructed on the splicing result.

[0021] Wherein, the zero-crossing density is the ratio of the number of sign transformations in the gray-level difference sequence to the number of pixels in the continuous edge segment; the feature point density is the ratio of the number of feature points in the continuous edge segment to the length of the continuous edge segment.

[0022] Furthermore, when an abnormal surface occlusion is determined to exist, it includes:

[0023] Extract the continuous edge segments with breaks from the set of continuous edge segments, and identify the break endpoints;

[0024] Compare the local angle change trends of adjacent feature point groups at the fracture endpoint. When the local angle change trend is discontinuous with the angle change trend of adjacent unshaded areas, it is determined to be a shaded area.

[0025] The fitted boundary is generated based on the extension direction of the fracture endpoint, and the fitted boundary is converted into the completed edge contour data.

[0026] Insert the calculated feature point coordinates along the extended path of the fitted boundary, and update the feature point coordinate set.

[0027] Furthermore, when an anomaly in deformation is determined to exist, it includes:

[0028] Obtain the height sampling unit corresponding to the suspected deformation area and compare it with the height change trend of multiple adjacent height sampling units;

[0029] When the change trend of the current height sampling unit deviates from the overall change trend of the adjacent height sampling units, the current height sampling unit is marked as a deformation region;

[0030] A reference curve is generated based on the height change trend of adjacent height sampling units, and the abnormal units are reconstructed based on the continuous change trend of the reference curve.

[0031] The reconstructed data is updated to reflect the surface height distribution data, and the set of feature point coordinates is readjusted in that region.

[0032] Furthermore, when performing template matching and edge detection on the repaired image information, the following steps are included:

[0033] Obtain the preliminary positioning results of template matching and the preliminary positioning results of edge detection, and record the position coordinate vector and attitude angle parameters of the workpiece respectively;

[0034] Calculate the coordinate difference vector and attitude angle difference between the two types of preliminary positioning results, and compare their consistency.

[0035] When the coordinate difference vectors of the two types of preliminary positioning results are in the same direction and the difference in attitude angles is linearly related to the position, the workpiece position and attitude are determined as the combined result of the two types of preliminary positioning results.

[0036] When the coordinate difference vector directions of the two preliminary positioning results are inconsistent or the attitude angle difference shows a nonlinear shift with position change, geometric feature information is invoked for joint verification. The joint verification includes:

[0037] Correcting the spatial height of the workpiece based on surface height distribution data;

[0038] Correcting the rotation direction and attitude angle of the workpiece based on the set of feature point coordinates;

[0039] Correct the workpiece's shape boundary based on edge contour data;

[0040] The correction results are weighted and fused to obtain the corrected positioning result of the workpiece.

[0041] Furthermore, based on the corrected position coordinate vector and attitude angle parameters, the main trajectory based on displacement difference and the compensation trajectory based on attitude angle difference are generated respectively.

[0042] The main trajectory and the compensation trajectory are aligned at nodes to form a dual-channel trajectory set. Each trajectory node includes position coordinates, attitude angle, velocity vector and acceleration transition parameters.

[0043] During the execution of the dual-channel trajectory set by the robotic arm, displacement feedback sequence, force feedback sequence and time sequence are collected simultaneously;

[0044] The displacement feedback sequence is compared node by node with the main trajectory. When the differential direction offsets of three consecutive nodes are consistent, it is marked as path drift.

[0045] The force feedback sequence and the compensation trajectory are compared node by node. When the force direction of adjacent nodes oscillates repeatedly, it is marked as clamping instability.

[0046] When path drift and clamping instability occur simultaneously, the corresponding nodes are reconstructed as a whole, and a new set of nodes is generated to replace the original nodes.

[0047] When only path drift exists, perform an overall translation correction on the group of adjacent nodes;

[0048] When only clamping instability exists, adjust the attitude angle and acceleration transition parameters of the corresponding node.

[0049] Furthermore, generating the motion path of the robotic arm based on the corrected positioning result includes:

[0050] Based on the position coordinate vector in the corrected positioning result, a target displacement difference sequence is generated, and the difference sequence is divided into several segments;

[0051] In each segment, a target angle difference sequence is generated based on the attitude angle parameters in the corrected positioning result, and coupled with the displacement difference sequence to form a segmented pose set.

[0052] Interpolation processing is performed on the segmented pose set to obtain a path set composed of multiple trajectory nodes. Each trajectory node includes position coordinates, attitude angle, velocity vector and clamping incident angle.

[0053] The path set is compared with the kinematic constraints of the robot and the workspace constraints of the fixture, and the nodes with constraint conflicts are marked in the path set.

[0054] For nodes with constraint conflicts, a set of corrected nodes is generated by splitting and inserting nodes or adjusting the velocity vectors and attitude angle parameters of adjacent nodes. The set of corrected nodes is then updated into the path set to obtain the motion path used to perform the clamping operation.

[0055] Furthermore, during the process of the robotic arm executing the motion path, the following are included:

[0056] The displacement feedback sequence and force feedback sequence are acquired in real time, and the displacement feedback sequence is compared node by node with the target displacement difference sequence of the motion path, and the force feedback sequence is compared node by node with the target clamping incident angle of the motion path.

[0057] When the differential directions of multiple consecutive nodes in the displacement feedback sequence show a consistent offset trend, the nodes of the corresponding trajectory segment are subjected to overall translation correction, and the velocity vectors of adjacent nodes are adjusted synchronously.

[0058] When the force feedback sequence oscillates alternately between multiple adjacent nodes, the attitude angle of the nodes in the corresponding trajectory segment is corrected, and a transition node is inserted in the trajectory segment.

[0059] When the displacement feedback sequence and the force feedback sequence both show offset and oscillation trends within the same trajectory segment, the trajectory segment is reconstructed as a whole. The reconstruction results include new position coordinates, attitude angles, velocity vectors, and clamping incident angles.

[0060] Replace the original trajectory set with the corrected trajectory set, and continue to perform the clamping operation on subsequent nodes.

[0061] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0062] This invention categorizes workpiece conditions into three types: reflectivity anomalies, surface occlusion anomalies, and deformation anomalies. For each type, a targeted repair path is designed, employing polarization filtering, contour fitting, and multi-point feature reconstruction methods. This not only repairs image information but also simultaneously updates geometric feature information, ensuring that subsequent recognition processes are unaffected by anomalies. In cases of inconsistency between template matching and edge detection, this invention performs joint verification using geometric feature information. It combines surface height distribution data, feature point coordinate sets, and edge contour data to form a weighted fusion mechanism of position coordinates, attitude angles, and shape boundaries, effectively avoiding positioning errors caused by the sensitivity of a single algorithm to illumination, deformation, or occlusion. This invention not only generates the main trajectory based on the corrected positioning results but also simultaneously establishes a compensation trajectory, forming a dual-channel trajectory set. During execution, when problems such as path drift, clamping instability, or rhythm imbalance occur, it can perform multiple correction methods at the node level, including overall translation, interpolation, and reconstruction. This allows trajectory adjustment to go beyond linear compensation, enabling multi-branch parallel repair capabilities. This invention collects displacement and force feedback in real time during clamping and analyzes their trends. It can distinguish different manifestations of path drift and clamping instability, and adjusts the incident angle, attitude angle, and acceleration transition parameters accordingly to achieve dynamic adjustment and optimization of the clamp trajectory, reducing the risks of empty clamping, slippage, and workpiece damage. When feedback anomalies and image anomalies occur simultaneously, this invention can perform overall reconstruction through cross-channel data fusion. For example, during reflection repair, it simultaneously reconstructs edge contours and feature point coordinates; during trajectory correction, it simultaneously updates position, attitude, and velocity nodes, thereby ensuring the continuity and consistency of positioning repair and motion correction. This closed-loop mechanism enables the robot to achieve stable workpiece identification and safe clamping even under complex working conditions, effectively solving problems such as gripping failure, secondary damage, and equipment downtime caused by light reflection, surface occlusion, deformation, and path drift in existing loading and unloading processes.

[0063] On the other hand, the present invention proposes a loading and unloading control system for CNC machining, comprising:

[0064] The acquisition module is configured to acquire workpiece image information and geometric feature information stored in a tray or fixture. The geometric feature information includes edge contour data, surface height distribution data, and a set of feature point coordinates.

[0065] The quality inspection module is configured to perform quality inspection on the workpiece state based on the image information and geometric feature information. When it is determined that there is abnormal reflection, abnormal surface occlusion, or abnormal deformation, the image information is repaired by polarization filtering method, contour fitting method, or multi-point feature reconstruction method, and the repaired image information and geometric feature information are generated.

[0066] The workpiece processing module is configured to perform template matching and edge detection on the repaired image information. When the template matching and edge detection results are consistent, the workpiece position and orientation are determined. When the detection results are inconsistent, joint verification is performed based on the geometric feature information to obtain the corrected positioning result of the workpiece.

[0067] The motion path of the robot is generated based on the corrected positioning result, and displacement feedback and force feedback are collected in real time during the gripping operation of the robot. The incident angle and gripping trajectory of the robot are adjusted according to the changing trends of the displacement feedback and force feedback.

[0068] It should be noted that the loading and unloading control system for CNC machining of the present invention has the same beneficial effects as its method, and will not be described in detail here. Attached Figure Description

[0069] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0070] Figure 1 This is a flowchart of a loading and unloading control method for CNC machining, provided as an embodiment of the present invention.

[0071] Figure 2 This is a functional block diagram of a loading and unloading control system for CNC machining, provided as an embodiment of the present invention. Detailed Implementation

[0072] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the disclosure to those skilled in the art. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0073] See Figure 1As shown, this embodiment of the invention provides a loading and unloading control method for CNC machining, including:

[0074] S1: Obtain workpiece image information and geometric feature information stored in the tray or fixture. The geometric feature information includes edge contour data, surface height distribution data and feature point coordinate set.

[0075] S2: Based on image information and geometric feature information, perform quality inspection on the workpiece status. When it is determined that there is abnormal reflection, abnormal surface occlusion, or abnormal deformation, the image information is repaired by polarization filtering method, contour fitting method, or multi-point feature reconstruction method, and the repaired image information and geometric feature information are generated.

[0076] S3: Perform template matching and edge detection on the repaired image information. When the template matching and edge detection results are consistent, determine the workpiece position and orientation. When the detection results are inconsistent, perform joint verification based on geometric feature information to obtain the corrected positioning result of the workpiece.

[0077] S4: Generate the motion path of the robot arm based on the corrected positioning results, and collect displacement feedback and force feedback in real time during the gripping operation of the robot arm, and adjust the incident angle and gripping trajectory of the robot arm according to the changing trend of displacement feedback and force feedback.

[0078] In this embodiment, by jointly acquiring and analyzing image information and geometric feature information, this solution maintains stable recognition and detection capabilities even when the workpiece has light reflection, surface occlusion, or deformation, avoiding the problem of easy failure that arises from relying on a single visual template matching in traditional methods. Three processing methods—polarization filtering, contour fitting, and multi-point feature reconstruction—are designed for different types of abnormal states, enabling dynamic repair of the workpiece image and geometric feature information under abnormal conditions, ensuring the integrity and accuracy of the data upon which subsequent positioning and path generation depend. When template matching and edge detection results are inconsistent, multi-source cross-validation is performed using surface height distribution data, feature point coordinate sets, and edge contour data, followed by weighted fusion, effectively correcting the workpiece position and orientation and improving the robustness of positioning. During the robotic gripping process, a dynamic comparison and adjustment mechanism of displacement feedback and force feedback is introduced to achieve real-time correction of the incident angle and gripping trajectory, reducing the risk of gripping deviation and secondary damage.

[0079] In some embodiments of this application, quality inspection includes:

[0080] The edge contour data of the workpiece is divided into several continuous edge segment sets, and the endpoint coordinates and curvature change rate are recorded in each continuous edge segment set.

[0081] The workpiece surface is divided into multiple height sampling units to construct a surface height distribution data matrix. Each height sampling unit includes the average height value and the height fluctuation amplitude.

[0082] Extract the set of feature point coordinates of the workpiece and group them according to the distribution density. Each feature point group includes a coordinate vector, local angle value and the rate of change of distance between adjacent points.

[0083] When discontinuous segments appear in the edge contour data, the boundary is completed based on the set of feature point coordinates;

[0084] Subsequently, when the fluctuation range of the surface height distribution data exceeds the preset stable range, the corresponding continuous edge segment is marked as a suspected deformation area; when the local included angle value of the feature point coordinate set continuously exceeds the included angle threshold, the corresponding continuous edge segment is marked as a suspected occlusion area; when there are discontinuous segments in the edge contour data and the number of feature points of the corresponding continuous edge segment is lower than the set reference value, the current continuous edge segment is marked as a suspected reflective area.

[0085] It should be noted that the local included angle value refers to the angle formed by connecting each feature point to its two adjacent points in the workpiece edge contour or feature point coordinate set. In the extracted sequence of workpiece feature points, any intermediate point is selected as the current feature point. This point is then connected to the previous point to form the first line segment, and then connected to the next point to form the second line segment. The opening angle between these two line segments is then compared to obtain the corresponding local included angle value. This operation is repeated for each feature point in the sequence to obtain a set of local included angle values. This set of local included angle values ​​reflects the degree of inflection or bending trend of the workpiece boundary at different positions: if the included angle value changes smoothly, it indicates that the boundary is continuous and undisturbed; if the included angle value in a certain area shows abnormal abrupt changes or continuously deviates from the normal range, it may indicate that there is occlusion or deformation in that area.

[0086] A preset stable interval is used as a reference range to determine whether there are abnormal fluctuations in the height distribution data of the workpiece surface. It is determined based on statistical results of workpiece surface height changes under normal conditions: First, a batch of normally processed workpieces without obvious deformation or defects are selected as benchmark samples. The surface height of these workpieces is sampled, and the average height value and fluctuation amplitude of each sampling unit are recorded. Then, the height fluctuation amplitudes of all benchmark samples are statistically analyzed to calculate the distribution of their fluctuation ranges. For example, in most cases, the fluctuations remain within a certain upper and lower limit. Based on the statistical results, an interval covering the normal fluctuation range is determined as the "stable interval." For example, the common range of fluctuation amplitudes of the benchmark samples (such as the mean ± a certain percentage of the deviation value) can be taken as the reference range for workpiece surface height fluctuations under normal conditions. In actual testing, as long as the fluctuation amplitude of a certain height sampling unit falls within this stable interval, the surface condition is considered normal; if it exceeds this interval, it is marked as a suspected deformation area.

[0087] Quality inspection is the process of analyzing and identifying anomalies in the acquired geometric feature information. Specifically, the workpiece's edge contour data is first divided into several sets of continuous edge segments. The endpoint coordinates and rate of curvature change are recorded in each set to reflect the geometric orientation and bending characteristics of the edge segment. When discontinuous segments appear in the edge contour, the boundary is completed by calling the feature point coordinate set to maintain the integrity of the workpiece's shape. Subsequently, the workpiece surface is divided into multiple height sampling units. The average height value and height fluctuation amplitude are calculated in each unit to construct a surface height distribution matrix. When the height fluctuation amplitude of a sampling unit significantly deviates from the overall trend, the corresponding continuous edge segment is marked as a suspected deformation region to characterize the instability of that region. Further, a set of feature point coordinates is extracted from the workpiece image and grouped according to distribution density. Each feature point group includes a coordinate vector, local angle values, and the rate of change of distance between adjacent points to reflect the local geometric structure. When multiple consecutive local angle values ​​show irregular changes, it indicates an abnormal abrupt change in the edge segment's geometric orientation; in this case, the continuous edge segment is marked as a suspected occlusion region. Finally, when discontinuous segments exist in the edge contour data, and the number of feature points in the corresponding continuous segments is lower than the reference value, it is determined that the boundary texture of the region is missing due to light reflection, and the continuous segment is marked as a suspected reflective area. Through the above steps, the system can distinguish the possible anomalies into three categories—reflection, occlusion, or deformation—before entering image restoration and localization correction, and provide a basis for subsequently calling different restoration methods.

[0088] In some embodiments of this application, when an abnormal reflection is determined to exist, the image information repair includes:

[0089] When a reflection anomaly is detected, the continuous edge segment of the anomaly is obtained, and the gray-level difference sequence between adjacent pixels is calculated within the pixel area of ​​the continuous edge segment.

[0090] The grayscale difference sequence is compared with the grayscale difference sequences of other continuous edge segments of the same workpiece, and the zero-crossing density and feature point density of each continuous edge segment are calculated. If the current continuous edge segment is broken, and the zero-crossing density of the current continuous edge segment is the lowest in the continuous edge segment set and the feature point density of the current continuous edge segment is the lowest in the continuous edge segment set, then the current continuous edge segment is marked as a reflective area.

[0091] Several sets of image segments were acquired in the reflective area at different polarization angles, and the edge direction of each image segment was extracted. The edge segments with the same edge direction in each image segment were spliced ​​together to form new edge contour data, and the set of feature point coordinates was reconstructed on the splicing result.

[0092] Wherein, zero-crossing density is the ratio of the number of sign transformations in the gray-level difference sequence to the number of pixels in the continuous edge segment; feature point density is the ratio of the number of feature points in the continuous edge segment to the length of the continuous edge segment.

[0093] It should be noted that when an abnormal reflection is detected, the image restoration process includes the following steps. First, for the detected abnormal continuous edge segment, the gray-level difference values ​​between adjacent pixels within the pixel area covered by the continuous edge segment are calculated sequentially to form a gray-level difference sequence, which reflects the subtle fluctuations in local gray-level changes. Then, this gray-level difference sequence is compared segment by segment with the gray-level difference sequences of other continuous edge segments on the same workpiece. By counting the number of gray-level sign changes in each sequence and calculating the ratio with the number of pixels, the zero-crossing density is obtained to characterize the frequency of gray-level changes in that area. Simultaneously, the number of feature points within the continuous edge segment is counted and calculated as a ratio with the length of the edge segment to obtain the feature point density, which reflects the density of local geometric features.

[0094] Based on the above, when a continuous edge segment exhibits a break, and its zero-crossing density is the lowest among all continuous edge segments, while its feature point density is also the lowest, this continuous edge segment is marked as a reflective area. The marked reflective area then proceeds to the image inpainting step: several image segments are acquired within this area at different polarization angles. The direction of edge lines in each segment is extracted, and edge segments with consistent directions are stitched together to form continuous new edge contour data. After stitching, the feature point coordinate set is reconstructed on the new edge contour data to replace the incomplete geometric feature information lost due to reflection.

[0095] In this application, zero-crossing density is defined as the ratio of the number of sign changes in the gray-level difference sequence to the number of pixels in the continuous edge segment, and feature point density is defined as the ratio of the number of feature points in the continuous edge segment to the length of the continuous edge segment. Through the above indicators and steps, lost edge contours and feature point coordinates can be recovered in areas of abnormal reflection, ensuring that the repaired image information can be used for subsequent localization and correction.

[0096] In some embodiments of this application, when a surface occlusion anomaly is determined to exist, the following is included:

[0097] Extract the continuous edge segments with breaks from the set of continuous edge segments, and identify the break endpoints;

[0098] Compare the local angle change trends of adjacent feature point groups at the fracture endpoint. When the local angle change trend is discontinuous with the angle change trend of adjacent unshaded areas, it is determined to be a shaded area.

[0099] The fitted boundary is generated based on the extension direction of the fracture endpoint, and the fitted boundary is converted into the completed edge contour data.

[0100] Insert the calculated feature point coordinates along the extended path of the fitted boundary, and update the feature point coordinate set.

[0101] It should be noted that when a surface occlusion anomaly is detected, the implementation method includes the following steps:

[0102] First, a continuity analysis is performed on the acquired workpiece edge contour data. The edge contour data is divided into several continuous edge segments, and the connectivity between the endpoint coordinates of each continuous edge segment is detected. When the Euclidean distance between the endpoint of one edge segment and the starting point of another edge segment is greater than a preset pixel interval, and there are no corresponding edge pixels between the two endpoints, the edge segment is determined to be broken. For each broken edge segment, the endpoint coordinates of the two ends of the break are extracted and recorded as the first break endpoint and the second break endpoint, respectively.

[0103] Next, using the fracture endpoint as a reference, feature point coordinate groups are retrieved from its adjacent regions. Each feature point group consists of three consecutive feature points, and the local angle value is obtained by calculating the angle between two adjacent vectors. Specifically, feature points Pi, Pi+1, and Pi+2 are grouped together, and vectors (Pi+1–Pi) and (Pi+2–Pi+1) are constructed. The angle θ between the two vectors is calculated, and θ is used as the local angle value. By using a sliding window on both sides of the fracture endpoint, the local angle values ​​are calculated sequentially, forming a sequence of angle changes.

[0104] Subsequently, the angle change sequence of the fracture endpoint region is compared with the angle change sequence of the adjacent unshaded region. When there is a significant difference in numerical continuity or monotonicity between the two, for example, the angle change sequence of the unshaded region maintains a smooth transition, while the angle change sequence of the fracture endpoint region shows abrupt jumps, discontinuities, or reverse fluctuations, then the fracture segment is determined to belong to the shaded region.

[0105] After determining the occlusion region, a fitted boundary is generated based on the extension direction of the fracture endpoints. The specific steps are as follows: using the first and second fracture endpoints as endpoints, construct the direction vectors connecting their adjacent feature points, and obtain the average direction of the two direction vectors as the initial direction for boundary extension. Then, perform fitting calculations in this direction: when the span of the occlusion region is small, use straight-line fitting to directly connect the two fracture endpoints; when the span is large, use second- or third-order polynomial fitting to ensure that the curvature change of the boundary is consistent with that of the adjacent region. After fitting, the generated fitted boundary is converted into completed edge contour data.

[0106] Finally, new feature point coordinates are generated along the extended path of the fitted boundary. Specifically, using the fitted curve as the trajectory, sampling is performed along the curve length at a step size consistent with the average feature point spacing of the original edge segment, obtaining a series of sampling points, which are then inserted into the feature point set as new feature point coordinates. If the fitted boundary is a polynomial curve, the coordinate values ​​are calculated point by point using the curve equation; if it is a spline curve, the sampling point coordinates are calculated using an interpolation algorithm. After insertion, the overall feature point coordinate set is updated, thus completing the boundary shape and local feature point distribution of the workpiece in the occluded area.

[0107] In some embodiments of this application, when an abnormal deformation is determined to exist, the following is included:

[0108] Obtain the height sampling unit corresponding to the suspected deformation area and compare it with the height change trend of multiple adjacent height sampling units;

[0109] When the change trend of the current height sampling unit deviates from the overall change trend of the adjacent height sampling units, the current height sampling unit is marked as a deformation region;

[0110] A reference curve is generated based on the height change trend of adjacent height sampling units, and the abnormal units are reconstructed based on the continuous change trend of the reference curve.

[0111] The reconstructed data is updated to reflect the surface height distribution data, and the set of feature point coordinates is readjusted in that region.

[0112] It should be noted that deviation refers to an inconsistency between the height change trend of the current height sampling unit and the overall trend of multiple adjacent height sampling units. Specifically, it includes the following three situations: First, when the height of multiple adjacent height sampling units generally increases or decreases, the height change direction of the current height sampling unit is opposite, which is judged as directional deviation; Second, when the height change amplitude of multiple adjacent height sampling units remains within a relatively uniform range, the height change amplitude of the current height sampling unit is significantly greater than or less than this range, which is judged as amplitude deviation; Third, when the average height value of multiple adjacent height sampling units is fitted to a continuous change curve, the height value or fluctuation amplitude of the current height sampling unit shows abrupt jumps, breaks, or discontinuities relative to the fitted curve, which is judged as continuity deviation.

[0113] When an anomaly is detected, the implementation methods include:

[0114] First, the surface height distribution data is scanned unit by unit. The surface height distribution data is constructed by dividing the workpiece surface into multiple height sampling units, each containing an average height value and height fluctuation amplitude. During the scanning process, the average height value of a target sampling unit is sequentially extracted and compared with the average height values ​​of its multiple neighboring sampling units (e.g., three units on each side), forming a local height change sequence.

[0115] Next, the height change trend of the target sampling unit is compared with the overall change trend of the local height change sequence. The specific steps are as follows: the average height values ​​of multiple adjacent units are sequentially fitted to a local reference straight line or polynomial curve, and the slope and curvature of this reference curve are recorded as the overall change trend; then, the height difference between the target sampling unit and the reference curve at corresponding positions is calculated. If this height difference exceeds twice the average height fluctuation amplitude of adjacent units, or if the fluctuation amplitude of the target unit differs significantly from that of adjacent units (e.g., the average fluctuation amplitude of adjacent units is within 5, while the fluctuation amplitude of the target unit reaches more than 15), then the sampling unit is determined to deviate from the overall change trend and is marked as a deformation region.

[0116] After determining the deformation region, a reference curve is generated based on the height change trend of adjacent height sampling units. Specifically, using adjacent units not identified as abnormal as control points, a smooth curve is constructed using spline interpolation or least squares fitting methods, ensuring that the curve continuously reflects the height change trend of adjacent units. The construction of this reference curve guarantees the continuity of the first and second derivatives within a local range, conforming to the physical characteristics of the transition on the surface of a real workpiece.

[0117] Subsequently, the abnormal cells are reconstructed using a reference curve. Specifically, at the location of the abnormal cell, the height value of the reference curve is calculated and used as the new average height value for that cell; simultaneously, the weighted average of the fluctuation amplitudes of adjacent cells is used as the new height fluctuation amplitude for that cell. By replacing the original abnormal cell's data in this way, the corrected height information is obtained.

[0118] Finally, the reconstructed height data is updated to the surface height distribution data matrix. After the data update, the feature point coordinate set is readjusted according to the new height matrix: within this region, local feature point coordinates are regenerated based on the updated average height value and height fluctuation range, ensuring that the feature point distribution is consistent with the repaired surface height. Specifically, equidistant sampling is performed within the repair area according to the original feature point spacing to obtain new coordinate points; if an original feature point deviates significantly from the repaired height curve, that point is deleted or replaced. After the update, surface height distribution data and feature point coordinate set containing information about the repaired deformation area are obtained.

[0119] In some embodiments of this application, when performing template matching and edge detection on the repaired image information, the following steps are included:

[0120] Obtain the preliminary positioning results of template matching and the preliminary positioning results of edge detection, and record the position coordinate vector and attitude angle parameters of the workpiece respectively;

[0121] Calculate the coordinate difference vector and attitude angle difference between the two types of preliminary positioning results, and compare their consistency.

[0122] When the coordinate difference vectors of the two types of preliminary positioning results are in the same direction and the difference in attitude angles is linearly related to the position, the workpiece position and attitude are determined as the combined result of the two types of preliminary positioning results.

[0123] When the coordinate difference vector directions of the two preliminary positioning results are inconsistent or the attitude angle difference shows a nonlinear shift with position change, geometric feature information is used for joint verification. The joint verification includes:

[0124] Correcting the spatial height of the workpiece based on surface height distribution data;

[0125] Correcting the rotation direction and attitude angle of the workpiece based on the set of feature point coordinates;

[0126] Correct the workpiece's shape boundary based on edge contour data;

[0127] The correction results are weighted and fused to obtain the corrected positioning result of the workpiece.

[0128] It should be noted that, firstly, the repaired image information is input into the template matching algorithm, which calls the pre-stored standard workpiece template, slides the template pixel by pixel in the image to calculate the matching correlation coefficient between the template and the image region, selects the region with the largest correlation coefficient as the preliminary positioning result of template matching, and records the two-dimensional position coordinate vector of the center point of the region and the rotation angle of the workpiece template to obtain the position coordinate vector P1 and the attitude angle parameter A1.

[0129] Secondly, edge detection is performed on the repaired image information. Gradient operators are used to process the image pixels, extracting workpiece edge points, and an edge connection algorithm is used to form a closed contour. The closed contour is then fitted using either the minimum bounding rectangle method or the ellipse fitting method to obtain the workpiece's center position and principal direction angle, which are recorded as the position coordinate vector P2 and the attitude angle parameter A2, respectively, as the preliminary edge detection and localization results.

[0130] Subsequently, the coordinate difference vector ΔP = P2 - P1 and the attitude angle difference ΔA = A2 - A1 are calculated between the preliminary positioning results of template matching and edge detection. The trends of the difference vector ΔP and the difference angle ΔA with spatial position are compared: when the direction of the difference vector ΔP is consistent with the overall positional offset direction of the two types of positioning results, and the attitude angle difference ΔA shows a linear trend with position, the two types of results are determined to be consistent. The workpiece position and attitude are determined as the weighted average of P1 and P2, and the angle parameter is taken as the weighted average of A1 and A2, thus obtaining the final positioning and merging result of the workpiece.

[0131] When the direction of the difference vector ΔP is inconsistent with the overall offset direction, or when the attitude angle difference ΔA exhibits a nonlinear jump with position change, the two results are determined to be inconsistent. In this case, geometric feature information is used for joint verification.

[0132] (1) Based on the surface height distribution data, the height sampling unit corresponding to the abnormal area is re-analyzed, and the height value of the area is corrected by using the trend curve of the adjacent height unit to obtain the spatial height compensation amount of the workpiece and update the three-dimensional position coordinates.

[0133] (2) Based on the set of feature point coordinates, select the local angle changes in the group of workpiece feature points, calculate the overall rotation direction by least squares fitting method, and adjust the attitude angle parameters to the rotation direction and attitude angle consistent with the distribution of feature points.

[0134] (3) Based on edge contour data, the detected outer contour is compared with the pre-stored standard contour, and missing or offset edge segments are filled and corrected to form a continuous closed boundary and update the workpiece's shape boundary information.

[0135] Finally, the three types of correction data (spatial height compensation, attitude angle correction, and shape boundary correction) are assigned weight coefficients, and a weighted fusion method is used to calculate the new position coordinate vector and attitude angle parameters to obtain the workpiece's corrected positioning result.

[0136] The methods for determining the weighting coefficients include:

[0137] To correct the surface height distribution data, the average trend difference between the corrected height value and the adjacent height sampling units is calculated to obtain the height residual R1;

[0138] For the correction of the feature point coordinate set, the difference between the corrected attitude angle and the least squares fitting result of the feature point distribution is calculated to obtain the attitude residual R2.

[0139] For edge contour data correction, the average offset distance between the corrected boundary and the standard boundary is calculated to obtain the boundary residual R3.

[0140] Take the reciprocals of the three residuals as the initial weights, i.e., W1=1 / R1, W2=1 / R2, W3=1 / R3.

[0141] Normalization process:

[0142] The three initial weights are normalized proportionally, and the calculation formula is as follows:

[0143] W i '=W i / (W1+W2+W3), where i∈{1,2,3}.

[0144] In this way, the weighting coefficients are always between 0 and 1, and the sum of the three is 1.

[0145] In the inspection of multiple workpieces in succession, if the residual of a certain type of correction result is consistently at a high level (e.g., greater than the average of other correction results more than three times in a row), a reduction ratio can be set to reduce the weight of that type of correction result. The reduction ratio can be executed according to a fixed attenuation coefficient (e.g., multiplied by 0.8) or a decreasing function.

[0146] In some embodiments of this application, a main trajectory based on displacement difference and a compensation trajectory based on attitude angle difference are generated based on the corrected position coordinate vector and attitude angle parameters, respectively.

[0147] The main trajectory and the compensation trajectory are aligned at nodes to form a dual-channel trajectory set. Each trajectory node includes position coordinates, attitude angle, velocity vector and acceleration transition parameters.

[0148] During the execution of the dual-channel trajectory set by the robotic arm, displacement feedback sequence, force feedback sequence and time sequence are collected simultaneously;

[0149] The displacement feedback sequence is compared node by node with the main trajectory. When the differential direction offsets of three consecutive nodes are consistent, it is marked as path drift.

[0150] The force feedback sequence and the compensation trajectory are compared node by node. When the force direction of adjacent nodes oscillates repeatedly, it is marked as clamping instability.

[0151] When path drift and clamping instability occur simultaneously, the corresponding nodes are reconstructed as a whole, and a new set of nodes is generated to replace the original nodes.

[0152] When only path drift exists, perform an overall translation correction on the group of adjacent nodes;

[0153] When only clamping instability exists, adjust the attitude angle and acceleration transition parameters of the corresponding node.

[0154] It should be noted that the process of generating a trajectory based on the corrected position coordinate vector and attitude angle parameters, and then correcting it using feedback, includes:

[0155] First, the corrected position coordinate vectors are stored as a sequence according to the sampling time order, with each item containing three-dimensional coordinates (x, y, z). The difference between adjacent coordinates is calculated to obtain the displacement difference sequence (Δx, Δy, Δz), and the main trajectory is generated based on this sequence. The attitude angle parameters are stored as a sequence according to the same sampling time order, with each item containing the rotation angle (α, β, γ) around the three axes. The difference between adjacent angles is calculated to obtain the angle difference sequence (Δα, Δβ, Δγ), and the compensation trajectory is generated based on this sequence.

[0156] Secondly, the main trajectory and the compensation trajectory are time-stamped point by point to obtain a dual-channel trajectory set. Each trajectory node consists of the following four data: position coordinates (x,y,z), attitude angle (α,β,γ), velocity vector (vx,vy,vz), and acceleration transition parameters (ax,ay,az). The velocity vector is obtained by dividing the difference between adjacent displacements by the sampling interval, and the acceleration transition parameters are obtained by dividing the difference between adjacent velocity vectors by the sampling interval.

[0157] During the execution of the dual-channel trajectory set by the robotic arm, displacement feedback sequence, force feedback sequence and time sequence are collected simultaneously: the displacement feedback sequence is the sampling point sequence of the actual position of the robotic arm end effector, each item containing three-dimensional coordinates; the force feedback sequence is the three-dimensional force values ​​(Fx, Fy, Fz) detected by the gripper at the end effector of the robotic arm.

[0158] The time series is the difference between the execution time and the preset time of the trajectory.

[0159] The displacement feedback sequence is compared node by node with the main trajectory. The comparison method is as follows: calculate the cosine angle between the feedback displacement difference direction and the target displacement difference direction. If the cosine angle between three consecutive nodes is greater than 0.9 and the direction offset is consistent, it is recorded as path drift.

[0160] The force feedback sequence and the compensation trajectory are compared node by node. The comparison method is to calculate the sign of the change in the force direction of adjacent nodes. When the force direction in three consecutive nodes shows alternating positive and negative changes, it is recorded as clamping instability.

[0161] When path drift and clamping instability occur simultaneously, the corresponding node group is extracted, the displacement difference sequence and angle difference sequence of the node group are recalculated, and a new node set is generated using three-point spline interpolation to replace the original nodes.

[0162] When only path drift exists, the nodes of the trajectory segment are translated as a whole. The magnitude of the translation vector is taken as the average value of the path drift deviation, and the direction is consistent with the drift. The velocity vector is then recalculated for the translated trajectory segment.

[0163] When only clamping instability exists, the attitude angle of the abnormal node is adjusted to the mean of the angle corresponding to the compensation trajectory, and a transition node is inserted in the trajectory segment. The acceleration transition parameter of the transition node is the arithmetic mean of the accelerations of the adjacent nodes.

[0164] When two consecutive nodes in a time series are ahead or behind by more than twice the sampling interval, the trajectory segment is marked as rhythm imbalance, and the time series is realigned by inserting equally spaced nodes or deleting redundant nodes in the trajectory segment.

[0165] After the above steps, the trajectory set is continuously updated during execution to ensure that the main trajectory and the compensation trajectory remain synchronized at the node level and respond to displacement offset and force anomalies in real time.

[0166] In some embodiments of this application, generating the motion path of the robotic arm based on the corrected positioning result includes:

[0167] Based on the position coordinate vector in the corrected positioning result, a target displacement difference sequence is generated, and the difference sequence is divided into several segments;

[0168] In each segment, a target angle difference sequence is generated based on the attitude angle parameters in the corrected positioning result, and coupled with the displacement difference sequence to form a segmented pose set.

[0169] Interpolation is performed on the segmented pose set to obtain a path set consisting of multiple trajectory nodes. Each trajectory node includes position coordinates, attitude angle, velocity vector and clamping incident angle.

[0170] The path set is compared with the kinematic constraints of the robot and the workspace constraints of the fixture, and the nodes with constraint conflicts are marked in the path set.

[0171] For nodes with constraint conflicts, a set of corrected nodes is generated by splitting and inserting nodes or adjusting the velocity vectors and attitude angle parameters of adjacent nodes. The set of corrected nodes is then updated into the path set to obtain the motion path used to perform the clamping operation.

[0172] It should be noted that the motion path of the robotic arm generated based on the corrected positioning results includes:

[0173] First, based on the position coordinate vector (xi,yi,zi) in the corrected positioning result, the difference between adjacent coordinate points is calculated in time order to obtain the target displacement difference sequence (Δx,Δy,Δz). Then, the sequence is divided into several segments according to the difference change amplitude, and each segment represents the continuous interval of the robot's movement.

[0174] Secondly, within each segment, the adjacent angle difference is calculated based on the attitude angle parameters (αi, βi, γi) in the corrected positioning result to obtain the target angle difference sequence (Δα, Δβ, Δγ). This angle difference sequence is then coupled one by one with the corresponding displacement difference sequence to form a segmented pose set, where each pose point contains both displacement difference and angle difference.

[0175] Then, the segmented pose set is interpolated, preferably using cubic spline interpolation to generate a smooth trajectory, resulting in a path set composed of multiple trajectory nodes. Each trajectory node includes four types of data: position coordinates (x, y, z), attitude angles (α, β, γ), velocity vectors (vx, vy, vz), and clamping incident angle parameters. The velocity vector is calculated by the difference between adjacent displacements and the time interval, and the clamping incident angle is calculated by the geometric relationship between the attitude angles and the fixture installation direction.

[0176] Next, the generated path set is compared node by node with the kinematic constraints of the manipulator (including joint angular velocity limits, joint acceleration limits, and joint working range) and the workspace constraints of the fixture (including gripper opening range, gripping incident angle range, and worktable safety boundary). If the coordinates or orientation of a certain trajectory node exceeds the constraints, the node is marked as a constraint conflict node.

[0177] Finally, the marked constraint conflict nodes are corrected. The correction methods include: when the spacing between trajectory nodes is too large and the velocity vector exceeds the limit, new nodes are inserted in the interval to shorten the single-step displacement; when the node attitude angle parameters exceed the allowable range of the fixture, the attitude angles and velocity vectors of adjacent nodes are adjusted and redistributed so that the newly generated corrected nodes meet the kinematic and spatial constraints; the set of corrected nodes is updated to the original path set to obtain the final motion path used to perform the clamping operation.

[0178] In some embodiments of this application, the process of the robotic arm executing a motion path includes:

[0179] The displacement feedback sequence and force feedback sequence are acquired in real time, and the displacement feedback sequence is compared with the target displacement difference sequence of the motion path node by node, and the force feedback sequence is compared with the target clamping incident angle of the motion path node by node.

[0180] When the differential directions of multiple consecutive nodes in the displacement feedback sequence show a consistent offset trend, the nodes of the corresponding trajectory segment are subjected to overall translation correction, and the velocity vectors of adjacent nodes are adjusted synchronously.

[0181] When the force feedback sequence oscillates alternately between multiple adjacent nodes, the attitude angle of the nodes in the corresponding trajectory segment is corrected, and a transition node is inserted in the trajectory segment.

[0182] When the displacement feedback sequence and the force feedback sequence both show offset and oscillation trends within the same trajectory segment, the trajectory segment is reconstructed as a whole. The reconstruction results include new position coordinates, attitude angles, velocity vectors, and clamping incident angles.

[0183] Replace the original trajectory set with the corrected trajectory set, and continue to perform the clamping operation on subsequent nodes.

[0184] It should be noted that the process of the robotic arm executing the motion path includes:

[0185] First, displacement feedback sequences and force feedback sequences are acquired in real time. The displacement feedback sequence is obtained through the position sensor at the end of the robot arm and is represented by the node sequence (xf, yf, zf); the force feedback sequence is obtained through the six-dimensional force sensor installed on the fixture and is represented by (Fx, Fy, Fz, Mx, My, Mz).

[0186] Subsequently, the displacement feedback sequence is compared node by node with the target displacement difference sequence of the motion path. Specifically, the feedback displacement difference (Δxf, Δyf, Δzf) and the target displacement difference (Δxt, Δyt, Δzt) are calculated. If, in three consecutive nodes, the angle between the feedback difference direction and the target difference direction is greater than a preset tolerance angle, a consistency offset trend is determined. At this time, an overall translation correction is performed on all nodes of the trajectory segment. The correction amount is the average difference vector between the feedback and target differences, and the velocity vectors of adjacent nodes are adjusted synchronously. The velocity correction method is to calculate the new velocity value based on the original velocity vector according to the translation correction amount and the time interval.

[0187] Furthermore, the force feedback sequence is compared node by node with the target clamping incident angle along the motion path. Specifically, if the direction vector of the force feedback alternately reverses sign within the range of three adjacent nodes, it indicates a recurring oscillation trend. In this case, attitude angle correction is performed on the nodes of the trajectory segment. The correction method is to adjust the current attitude angle towards the median of the oscillation amplitude, and insert a transition node within the trajectory segment. The attitude angle of the transition node is generated by linear interpolation, and its position coordinates are consistent with the original trajectory node to smoothly transition the attitude change.

[0188] When the displacement feedback sequence and the force feedback sequence simultaneously exhibit a consistent offset trend and an oscillation trend within the same trajectory segment, a comprehensive reconstruction of that trajectory segment is performed. The reconstruction method is as follows: based on the current position and attitude, a new trajectory node set is generated. Each node contains new position coordinates, attitude angle, velocity vector, and clamping incident angle. The position coordinates are calculated from the current feedback position and the corrected difference sequence. The attitude angle is jointly determined by the clamping incident angle correction result and the oscillation suppression result. The velocity vector is calculated by the difference between adjacent nodes and a set time step. The clamping incident angle is calculated by the new attitude angle and the constraint relationship between the clamp direction.

[0189] Finally, the corrected trajectory set replaces the original trajectory set, and the clamping operation of subsequent nodes continues to be performed to ensure that the corrected trajectory is seamlessly connected at the node level. All newly generated nodes are stored in the runtime cache for subsequent feedback comparison.

[0190] See Figure 2 As shown, this embodiment of the invention provides a loading and unloading control system for CNC machining, comprising:

[0191] The acquisition module is configured to acquire workpiece image information and geometric feature information stored in a tray or fixture. The geometric feature information includes edge contour data, surface height distribution data, and a set of feature point coordinates.

[0192] The quality inspection module is configured to perform quality inspection on the workpiece state based on the image information and geometric feature information. When it is determined that there is abnormal reflection, abnormal surface occlusion, or abnormal deformation, the image information is repaired by polarization filtering method, contour fitting method, or multi-point feature reconstruction method, and the repaired image information and geometric feature information are generated.

[0193] The workpiece processing module is configured to perform template matching and edge detection on the repaired image information. When the template matching and edge detection results are consistent, the workpiece position and orientation are determined. When the detection results are inconsistent, joint verification is performed based on the geometric feature information to obtain the corrected positioning result of the workpiece.

[0194] The motion path of the robot is generated based on the corrected positioning result, and displacement feedback and force feedback are collected in real time during the gripping operation of the robot. The incident angle and gripping trajectory of the robot are adjusted according to the changing trends of the displacement feedback and force feedback.

[0195] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A method for controlling loading and unloading materials in CNC machining, characterized in that, include: Acquire workpiece image information and geometric feature information stored in a material tray or fixture. The geometric feature information includes edge contour data, surface height distribution data, and a set of feature point coordinates. Based on the image information and geometric feature information, the workpiece status is inspected for quality. When it is determined that there is abnormal reflection, abnormal surface occlusion, or abnormal deformation, the image information is repaired by polarization filtering method, contour fitting method, or multi-point feature reconstruction method, and the repaired image information and geometric feature information are generated. Template matching and edge detection are performed on the repaired image information. When the template matching and edge detection results are consistent, the workpiece position and orientation are determined. When the detection results are inconsistent, joint verification is performed based on the geometric feature information to obtain the corrected positioning result of the workpiece. The motion path of the robot is generated based on the corrected positioning result, and displacement feedback and force feedback are collected in real time during the gripping operation of the robot. The incident angle and gripping trajectory of the robot are adjusted according to the changing trend of the displacement feedback and force feedback. When performing template matching and edge detection on the repaired image information, the following steps are included: Obtain the preliminary positioning results of template matching and the preliminary positioning results of edge detection, and record the position coordinate vector and attitude angle parameters of the workpiece respectively; Calculate the coordinate difference vector and attitude angle difference between the two types of preliminary positioning results, and compare their consistency. When the coordinate difference vectors of the two types of preliminary positioning results are in the same direction and the difference in attitude angles is linearly related to the position, the workpiece position and attitude are determined as the combined result of the two types of preliminary positioning results. When the coordinate difference vector directions of the two preliminary positioning results are inconsistent or the attitude angle difference shows a nonlinear shift with position change, geometric feature information is invoked for joint verification. The joint verification includes: Correcting the spatial height of the workpiece based on surface height distribution data; Correcting the rotation direction and attitude angle of the workpiece based on the set of feature point coordinates; Correct the workpiece's shape boundary based on edge contour data; The correction results are weighted and fused to obtain the corrected positioning result of the workpiece; Based on the corrected position coordinate vector and attitude angle parameters, the main trajectory based on displacement difference and the compensation trajectory based on attitude angle difference are generated respectively. The main trajectory and the compensation trajectory are aligned at nodes to form a dual-channel trajectory set. Each trajectory node includes position coordinates, attitude angle, velocity vector and acceleration transition parameters. During the execution of the dual-channel trajectory set by the robotic arm, displacement feedback sequence, force feedback sequence and time sequence are collected simultaneously; The displacement feedback sequence is compared node by node with the main trajectory. When the differential direction offsets of three consecutive nodes are consistent, it is marked as path drift. The force feedback sequence and the compensation trajectory are compared node by node. When the force direction of adjacent nodes oscillates repeatedly, it is marked as clamping instability. When path drift and clamping instability occur simultaneously, the corresponding nodes are reconstructed as a whole, and a new set of nodes is generated to replace the original nodes. When only path drift exists, perform an overall translation correction on the group of adjacent nodes; When only clamping instability exists, adjust the attitude angle and acceleration transition parameters of the corresponding node.

2. The loading and unloading control method for CNC machining according to claim 1, characterized in that, The quality inspection includes: The edge contour data of the workpiece is divided into several continuous edge segment sets, and the endpoint coordinates and curvature change rate are recorded in each continuous edge segment set. The workpiece surface is divided into multiple height sampling units to construct a surface height distribution data matrix. Each height sampling unit includes the average height value and the height fluctuation amplitude. Extract the set of feature point coordinates of the workpiece and group them according to the distribution density. Each feature point group includes a coordinate vector, local angle value and the rate of change of distance between adjacent points. When discontinuous segments appear in the edge contour data, the boundary is completed based on the set of feature point coordinates; Subsequently, when the fluctuation range of the surface height distribution data exceeds the preset stable range, the corresponding continuous edge segment is marked as a suspected deformation area; when the local included angle value of the feature point coordinate set continuously exceeds the included angle threshold, the corresponding continuous edge segment is marked as a suspected occlusion area; when there are discontinuous segments in the edge contour data and the number of feature points of the corresponding continuous edge segment is lower than the set reference value, the current continuous edge segment is marked as a suspected reflective area.

3. The loading and unloading control method for CNC machining according to claim 2, characterized in that, When an abnormal reflection is detected, the restoration of image information includes: When a reflection anomaly is detected, the continuous edge segment of the anomaly is obtained, and the gray-level difference sequence between adjacent pixels is calculated within the pixel area of ​​the continuous edge segment. The grayscale difference sequence is compared with the grayscale difference sequences of other continuous edge segments of the same workpiece, and the zero-crossing density and feature point density of each continuous edge segment are calculated. If the current continuous edge segment is broken, and the zero-crossing density of the current continuous edge segment is the lowest in the set of continuous edge segments and the feature point density of the current continuous edge segment is the lowest in the set of continuous edge segments, then the current continuous edge segment is marked as a reflective area. Several sets of image segments were acquired in the reflective area at different polarization angles, and the edge direction of each image segment was extracted. The edge segments with the same edge direction in each image segment were spliced ​​together to form new edge contour data, and the set of feature point coordinates was reconstructed on the splicing result. Wherein, the zero-crossing density is the ratio of the number of sign transformations in the gray-level difference sequence to the number of pixels in the continuous edge segment; the feature point density is the ratio of the number of feature points in the continuous edge segment to the length of the continuous edge segment.

4. The loading and unloading control method for CNC machining according to claim 2, characterized in that, When a surface occlusion anomaly is determined, it includes: Extract the continuous edge segments with breaks from the set of continuous edge segments, and identify the break endpoints; Compare the local angle change trends of adjacent feature point groups at the fracture endpoint. When the local angle change trend is discontinuous with the angle change trend of adjacent unshaded areas, it is determined to be a shaded area. The fitted boundary is generated based on the extension direction of the fracture endpoint, and the fitted boundary is converted into the completed edge contour data. Insert the calculated feature point coordinates along the extended path of the fitted boundary, and update the feature point coordinate set.

5. The loading and unloading control method for CNC machining according to claim 2, characterized in that, When an abnormal deformation is determined to exist, it includes: Obtain the height sampling unit corresponding to the suspected deformation area and compare it with the height change trend of multiple adjacent height sampling units; When the change trend of the current height sampling unit deviates from the overall change trend of the adjacent height sampling units, the current height sampling unit is marked as a deformation region; A reference curve is generated based on the height change trend of adjacent height sampling units, and the abnormal units are reconstructed based on the continuous change trend of the reference curve. The reconstructed data is updated to reflect the surface height distribution data, and the set of feature point coordinates is readjusted in that region.

6. The loading and unloading control method for CNC machining according to claim 1, characterized in that, The motion path of the robotic arm generated based on the corrected positioning result includes: Based on the position coordinate vector in the corrected positioning result, a target displacement difference sequence is generated, and the difference sequence is divided into several segments; In each segment, a target angle difference sequence is generated based on the attitude angle parameters in the corrected positioning result, and coupled with the displacement difference sequence to form a segmented pose set. Interpolation processing is performed on the segmented pose set to obtain a path set composed of multiple trajectory nodes. Each trajectory node includes position coordinates, attitude angle, velocity vector and clamping incident angle. The path set is compared with the kinematic constraints of the robot and the workspace constraints of the fixture, and the nodes with constraint conflicts are marked in the path set. For nodes with constraint conflicts, a set of corrected nodes is generated by splitting and inserting nodes or adjusting the velocity vectors and attitude angle parameters of adjacent nodes. The set of corrected nodes is then updated into the path set to obtain the motion path used to perform the clamping operation.

7. The loading and unloading control method for CNC machining according to claim 6, characterized in that, During the execution of the motion path by the robotic arm, the following are included: The displacement feedback sequence and force feedback sequence are acquired in real time, and the displacement feedback sequence is compared node by node with the target displacement difference sequence of the motion path, and the force feedback sequence is compared node by node with the target clamping incident angle of the motion path. When the differential directions of multiple consecutive nodes in the displacement feedback sequence show a consistent offset trend, the nodes of the corresponding trajectory segment are subjected to overall translation correction, and the velocity vectors of adjacent nodes are adjusted synchronously. When the force feedback sequence oscillates alternately between multiple adjacent nodes, the attitude angle of the nodes in the corresponding trajectory segment is corrected, and a transition node is inserted in the trajectory segment. When the displacement feedback sequence and the force feedback sequence both show offset and oscillation trends within the same trajectory segment, the trajectory segment is reconstructed as a whole. The reconstruction results include new position coordinates, attitude angles, velocity vectors, and clamping incident angles. Replace the original trajectory set with the corrected trajectory set, and continue to perform the clamping operation on subsequent nodes.

8. A loading and unloading control system for CNC machining, used to implement the loading and unloading control method for CNC machining as described in any one of claims 1-7, characterized in that, include: The acquisition module is configured to acquire workpiece image information and geometric feature information stored in a tray or fixture. The geometric feature information includes edge contour data, surface height distribution data, and a set of feature point coordinates. The quality inspection module is configured to perform quality inspection on the workpiece state based on the image information and geometric feature information. When it is determined that there is abnormal reflection, abnormal surface occlusion, or abnormal deformation, the image information is repaired by polarization filtering method, contour fitting method, or multi-point feature reconstruction method, and the repaired image information and geometric feature information are generated. The workpiece processing module is configured to perform template matching and edge detection on the repaired image information. When the template matching and edge detection results are consistent, the workpiece position and orientation are determined. When the detection results are inconsistent, joint verification is performed based on the geometric feature information to obtain the corrected positioning result of the workpiece. The motion path of the robot is generated based on the corrected positioning result, and displacement feedback and force feedback are collected in real time during the gripping operation of the robot. The incident angle and gripping trajectory of the robot are adjusted according to the changing trends of the displacement feedback and force feedback.

Citation Information

Patent Citations

  • Numerical control lathe visual positioning system and method

    CN120161786A

  • Auxiliary positioning method and system in multi-process switching of precision mold

    CN120326412A