Workpiece turning-over pose reconstruction method, device, equipment, medium and program product
By writing file information feature by feature on a desktop CNC machine tool and calculating three-dimensional coordinates using a camera device, the problems of automation and accuracy in coordinate system reconstruction after workpiece flipping are solved, achieving efficient and reliable workpiece flipping pose reconstruction and reducing hardware and computing costs.
Patent Information
- Application Number
- CN202611659339.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-26
- Publication Date
- 2026-11-24
AI Technical Summary
Desktop CNC machine tools struggle to automatically and reliably reconstruct the workpiece coordinate system's pose in the machine tool coordinate system after the workpiece is flipped, leading to machining accuracy relying on manual alignment and experience, resulting in low efficiency. Furthermore, existing technologies increase hardware costs and complexity.
During the machining of the first side of the workpiece, feature information is written into the archive. The second side image is acquired using a fixedly installed camera device. The three-dimensional coordinates are calculated by the intersection of ray parameters and plane parameters. The unique flipping transformation solution is determined by registration weight and weighted rigid body registration and directly written into the machine tool CNC system.
It enables automatic and reliable reconstruction of coordinate system pose after workpiece flipping, reducing hardware costs and computational load, improving machining accuracy and efficiency, reducing the risk of misalignment, and maintaining the robustness and traceability of the machining program.
Smart Images

Figure CN123160671A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of CNC machining technology, specifically to a workpiece flipping pose reconstruction method, apparatus, equipment, medium, and program product. Background Technology
[0002] Double-sided machining is a common task on desktop CNC machine tools. Double-sided printed circuit boards, double-sided engraved plaques, and structural components where patterns on both sides need to be aligned all require the toolpath on the second side to be strictly aligned with the features already machined on the first side. Whether a datum consistent with the first side can be found after the workpiece is flipped directly determines the degree of alignment between the two sides.
[0003] Industrial-grade equipment relies on precision fixtures, locating pins, or zero-point positioning systems to ensure the flipping reference, and the position and orientation of the workpiece before and after flipping are uniquely determined by the mechanical structure. Desktop machine tools, with their compact structure and cost-sensitive nature, cannot be equipped with such fixtures. After flipping, the user simply places the workpiece back onto the worktable, and its position and orientation in the machine tool coordinate system are completely unknown. If a second-side path programmed according to the original workpiece coordinate system is directly executed at this point, at best the patterns on the two sides will be misaligned, and at worst the tool will cut through the features already machined on the first side, rendering the workpiece unusable.
[0004] Related technologies also include using industrial cameras to identify pre-designed reference marks. However, these marks need to be written into drawings and specially processed before the first side is machined. They are not applicable to workpieces with existing drawings or third-party drawings. If a mark is missed, it is impossible to align it after flipping the workpiece. The solution of using binocular cameras or depth cameras to reconstruct point clouds is difficult to adapt to desktop machine tools in terms of hardware cost, calibration workload and size, and lacks quantitative judgment on the reliability of the results.
[0005] Currently, desktop machine tools generally use manual alignment: visually comparing the path on the second side with the features on the first side, performing a trial cut with padding paper, measuring the deviation, and then manually adjusting the coordinate offset. This method takes several minutes to more than ten minutes per cycle, and the accuracy depends on the user's experience. It must be repeated every time a workpiece is changed.
[0006] Therefore, how to automatically and reliably reconstruct the pose of the workpiece coordinate system in the machine tool coordinate system after flipping, based solely on the features formed by the workpiece itself during the first side machining, without adding fixtures or external reference marks, has become a technical problem that needs to be solved. Summary of the Invention
[0007] In view of the above problems, this application provides a method, apparatus, equipment, medium and program product for workpiece flipping pose reconstruction.
[0008] According to the first aspect of this application, a method for reconstructing the pose of a double-sided machined workpiece in the machine tool coordinate system after flipping the workpiece is provided, comprising: during the machining of the first side of the workpiece, writing the processed feature file information of the workpiece feature by feature, wherein the file information includes the feature type of the processed feature, the feature coordinates in the workpiece coordinate system, the feature size, the machining positioning covariance of the feature coordinates, and the registration weight; placing the workpiece arbitrarily on the worktable of the machine tool after flipping it, and determining the planar parameters of the second side of the workpiece in the machine tool coordinate system after flipping it, wherein the planar parameters include the unit normal vector and a constant term of the second side; acquiring an image of the second side by a camera device fixedly installed on a stationary structure of the machine tool, identifying the processed features visible after flipping in the image as target features; backprojecting the image points of the target features in the image into ray parameters in the machine tool coordinate system according to the pre-calibrated intrinsic parameters of the camera device and the extrinsic parameters between the camera device and the machine tool coordinate system, wherein the ray parameters include the origin and unit direction vector of the ray; determining the intersection point of the ray and the second side according to the ray parameters and the planar parameters, and confirming the intersection point. The target feature is defined as its three-dimensional coordinates in the machine tool coordinate system. Using the unit normal vector of the workpiece on the first surface being mapped to the unit normal vector on the second surface as a constraint, the file information of at least one pre-corresponding processed feature is matched with the image attributes of the target feature to obtain at least one set of candidate correspondences for the flip-over transformation. For each candidate correspondence, the feature coordinates and three-dimensional coordinates are weighted and rigidly registered according to the registration weights to obtain the candidate solution for the flip-over transformation of each candidate correspondence and the corresponding weighted sum of squared residuals. Based on the consistency score between the file information of the processed feature corresponding to each candidate solution and the image attributes of the target feature corresponding to that processed feature, and the weighted sum of squared residuals corresponding to that candidate solution, a unique candidate solution is determined from all candidate solutions as the flip-over transformation solution. The pose of the workpiece coordinate system on the second surface in the machine tool coordinate system is analyzed based on the flip-over transformation solution and written into the CNC system of the machine tool. The pose includes the origin offset and attitude angle of the workpiece coordinate system on the second surface. The attitude angle includes the skew angle around the vertical axis of the machine tool coordinate system and the tilt angle of the second surface relative to the two horizontal axes of the machine tool coordinate system.
[0009] The second aspect of this application provides a device for reconstructing the pose of a double-sided machined workpiece in the machine tool coordinate system after the workpiece has been flipped. The device includes: a first reconstruction module, used to write the archive information of the machined features of the workpiece feature by feature during the machining of the first side of the workpiece, wherein the archive information includes the feature type of the machined feature, the feature coordinates in the workpiece coordinate system, the feature size, the machining positioning covariance of the feature coordinates, and the registration weight; and a second reconstruction module, used to arbitrarily place the flipped workpiece on the machine tool's worktable and determine the planar parameters of the second side of the flipped workpiece in the machine tool coordinate system, wherein the planar parameters... The system includes: a unit normal vector and a constant term for the second face; a third reconstruction module, used by a camera fixed to a stationary structure on the machine tool to acquire images of the second face, identifying the machined features visible after flipping as target features; a fourth reconstruction module, used to backproject the image points of the target features in the image into ray parameters in the machine tool coordinate system according to the pre-calibrated intrinsic parameters of the camera device and the extrinsic parameters between the camera device and the machine tool coordinate system, where the ray parameters include the ray's origin and unit direction vector; and a fifth reconstruction module, used to determine the intersection points of the ray and the second face based on the ray parameters and the plane parameters. The intersection point is determined as the three-dimensional coordinates of the target feature in the machine tool coordinate system; the sixth reconstruction module is used to match the file information of at least one pre-corresponding processed feature with the image attributes of the target feature, with the unit normal vector of the workpiece on the first surface being mapped to the unit normal vector of the second surface as a constraint, to obtain at least one set of candidate correspondences for the flipping transformation; the seventh reconstruction module is used to perform weighted rigid body registration of the feature coordinates and three-dimensional coordinates according to the registration weight for each candidate correspondence, to obtain the candidate solution of the flipping transformation of each candidate correspondence and the corresponding weighted residual sum of squares; the eighth reconstruction module is used for Based on the consistency score between the file information of the processed features corresponding to each candidate solution and the image attribute of the target feature corresponding to the processed feature, and the weighted sum of squared residuals corresponding to the candidate solution, a unique candidate solution is determined from all candidate solutions as the flipping transformation solution; the ninth reconstruction module is used to parse the pose of the workpiece coordinate system of the second face in the machine tool coordinate system according to the flipping transformation solution, and write it into the CNC system of the machine tool, wherein the pose includes the origin offset and attitude angle of the workpiece coordinate system of the second face, and the attitude angle includes the skew angle around the vertical axis of the machine tool coordinate system and the tilt angle of the second face relative to the two horizontal axes of the machine tool coordinate system.
[0010] According to a third aspect of this application, an electronic device is provided, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method described above.
[0011] According to a fourth aspect of this application, a computer-readable storage medium is also provided, on which a computer program or instructions are stored, wherein the computer program or instructions, when executed by a processor, implement the steps of the above-described method.
[0012] According to a fifth aspect of this application, a computer program product is also provided, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described method.
[0013] According to some embodiments of this application, this application uses the archive information written feature by feature during the first surface processing as the flipping reference, so that the data required for flipping alignment is transformed from post-flipping measurement to a structured record generated by the processing process itself, and the system no longer needs to collect the workpiece shape after flipping; by using the unit normal vector of the first surface being mapped to the unit normal vector of the second surface as a constraint, the search space of the flipping transformation is narrowed from six degrees of freedom to a single degree of freedom in the plane, and the matching is guided by the projection position of the archive information under this constraint, reducing the number of candidate combinations and the computational load of image processing; by using ray parameters and measured plane parameters The intersection of the coordinates yields the three-dimensional coordinates of the machine tool coordinate system, and a single camera device can complete the single-view three-dimensional measurement, avoiding the calibration and memory overhead of adding a second camera or depth sensor. By weighting rigid body registration according to the registration weight and determining the unique solution according to the consistency score and the weighted sum of squared residuals, the implicit erroneous solution of 180 degrees misalignment is no longer generated when the feature distribution is symmetrical, reducing the risk of silent entry into the second-face machining program due to misalignment. By redefining the coordinate system rather than modifying the second-face machining program, the correspondence between the machining program, design model and tool compensation is maintained, improving the robustness and traceability of the machining process. Attached Figure Description
[0014] The above-mentioned contents, other objects, features and advantages of this application will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0015] Figure 1 A flowchart illustrating a workpiece flipping pose reconstruction method according to an embodiment of this application is shown schematically. Detailed Implementation
[0016] The embodiments of this application will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of this application. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of this application for ease of explanation. However, it will be apparent that one or more embodiments may be implemented without these specific details. Furthermore, descriptions of well-known structures and technologies are omitted in the following description to avoid unnecessarily obscuring the concepts of this application.
[0017] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0018] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0019] In this application, unless otherwise stated, the machine tool coordinate system refers to a coordinate system established with the mechanical origin of each linear axis of the machine tool as the reference, and the unit is millimeters; the workpiece coordinate system refers to a coordinate system fixed to the workpiece material, moving with the workpiece, and used for programming tool paths; pose refers to the position and orientation of one coordinate system relative to another coordinate system, represented by a rotation matrix and a translation vector; the first face refers to the face of the workpiece that is machined first, and the second face refers to the other face of the workpiece that is machined after being flipped; the machined features refer to the geometric elements formed by the tool on the workpiece during the machining of the first face, whose positions can be obtained by analyzing the coordinate readings of the corresponding machining program segment and each axis of the machine tool; the flipping transformation refers to the rigid body transformation that links the coordinates of the same physical point before and after the workpiece flipping in the machine tool coordinate system; the intrinsic parameters of the camera device refer to the parameters characterizing the mapping relationship between the pixel coordinates of the image points and the directions in the camera coordinate system, and the extrinsic parameters of the camera device refer to the rotation matrix and translation vector between the camera coordinate system and the machine tool coordinate system.
[0020] Figure 1 A flowchart illustrating a workpiece flipping pose reconstruction method according to an embodiment of this application is shown schematically.
[0021] like Figure 1 As shown, the workpiece flipping pose reconstruction method according to the embodiments of this application may include steps S210 to S290.
[0022] In step S210, during the machining of the first surface of the workpiece, the archive information of the machined features of the workpiece is written feature by feature. The archive information includes the feature type of the machined feature, the feature coordinates in the workpiece coordinate system, the feature size, the machining positioning covariance of the feature coordinates, and the registration weight.
[0023] In some embodiments, the first side of a workpiece refers to the side that is processed first in a double-sided workpiece, and the side that faces upward after being flipped over is the second side.
[0024] In some embodiments, the archive information refers to a structured data set that is archived with the workpiece number and records all the processed features of the first side. It is the only data source for the flipping reference, and no fixtures, pins or external reference marks are set after the workpiece is flipped.
[0025] In some embodiments, all file entries constitute file information A.
[0026]
[0027] In equation (1), For feature type; The feature reference point in the workpiece coordinate system The three-dimensional coordinates are shown below, in millimeters. These are the feature dimensions, in millimeters. The processing and positioning covariance for the feature coordinates is a third-order symmetric positive definite matrix; The registration weight is a dimensionless positive number; This represents the total number of processed features.
[0028] In some embodiments, the two outlets of the through hole are connected by the same hole shaft. Let P be the center of the first outlet. i A Then the center of the exit circle on the second side is given by equation (2).
[0029]
[0030] In equation (2), For the first The three-dimensional coordinates of the exit center of the through hole on the second side in the workpiece coordinate system, in millimeters, are the file reference points that are visible after flipping over. The coordinates of the exit center of the same through hole on the first surface are in millimeters. is a unit vector in the drilling direction, with a length of 1, and its direction is along the hole axis and points into the material; This represents the hole depth, measured along the hole axis from the exit point of the first face to the exit point of the second face, in millimeters. When the hole axis is parallel to the normal direction of the first face... Equal to the thickness of the plate at that location The result is analytically derived from the Z-axis travel and the planar measurement values of the first surface; when the two are not parallel, , This is the unit normal vector of the first surface. The coordinates of the outer contour corner points and edge marks are directly given by the contour machining program and the measured plane.
[0031] This step involves writing feature-by-feature information into the archive during the first-side processing. This changes the reference for reconstructing the pose after flipping from post-processing measurement to a structured record generated by the processing itself. The processor can then read the archive by workpiece number after flipping, avoiding the need for re-collection and manual input of the workpiece shape.
[0032] In step S220, the workpiece is flipped over and placed arbitrarily on the machine tool's worktable. The planar parameters of the second surface of the flipped workpiece in the machine tool coordinate system are determined. The planar parameters include the unit normal vector and constant terms of the second surface.
[0033] In some embodiments, flipping refers to the action of rotating the workpiece about 180 degrees about an axis located in the plane of the workpiece, so that the first side faces down and the second side faces up.
[0034] In some embodiments, the plane parameter refers to the analytical representation of the plane containing the second surface in the machine tool coordinate system, which consists of a unit normal vector and a constant term, and only describes the orientation and position of the second surface itself.
[0035]
[0036] In equation (3), n is the three-dimensional column vector of the unit normal vector of the second surface in the machine tool coordinate system, with a length of 1 and being dimensionless; d is the constant term of the plane equation, with the unit being millimeters; x is the three-dimensional coordinate of any point on the plane in the machine tool coordinate system, with the unit being millimeters. Equation (3) shows that all points that satisfy this equation are located on the plane containing the second surface. Therefore, given a ray that is not parallel to the plane, the unique intersection point can be solved by equation (3). The plane parameters can be determined by methods such as triangulating and fitting the workpiece after imaging it at multiple positions with the worktable, calculating the deformation after projecting a structured light pattern, identifying a reference target coplanar with the second surface, or fitting the workpiece after contacting multiple non-collinear points with a tool with contact detection.
[0037] For example, after the workpiece is flipped and placed on the worktable, after triangulation and plane fitting according to the motion baseline, the unit normal vector of the second face is (0.0031, −0.0024, 0.99999), and the constant term is −52.418 mm, indicating that the second face is located at a height of approximately 52.42 mm on the Z-axis of the machine tool coordinate system, with an inclination of approximately 0.22 degrees.
[0038] This step, by determining the planar parameters of the second face in the machine tool coordinate system after the workpiece is flipped and placed arbitrarily, supplements the missing depth information for single-view image measurement: a feature point in the image originally corresponds to only one spatial ray, but after adding the actual measurement plane constraint, it corresponds to a unique spatial point. Therefore, the three-dimensional coordinates of the feature can be obtained without a second camera, depth sensor or structured light projection module.
[0039] In step S230, an image of the second side is captured by a camera device fixedly installed on a stationary structure of the machine tool, and the processed features visible after flipping are identified in the image as target features.
[0040] In some embodiments, the imaging device refers to a monocular camera assembly with imaging capabilities, including a camera body, a low-distortion fixed-focus lens, and a light source; the static structure refers to a component of the machine tool that does not move with any motion axis during processing and measurement, such as the bed or inner cavity wall.
[0041] In some embodiments, intrinsic parameters refer to parameters that characterize the mapping relationship between the pixel coordinates of an image point and the direction in the camera coordinate system, including the equivalent focal length and principal point coordinates in both directions, with the unit being pixels.
[0042] In some embodiments, the image of the second side refers to a grayscale image captured by the camera device after illuminating the second side from the paraxial direction with ring light.
[0043] This step involves acquiring images of the second side using a camera device fixed to the stationary structure of the machine tool and identifying the machined features visible after flipping. This eliminates the need to attach markings to the workpiece, remove the workpiece from the machine tool, or use additional measuring equipment for observing the flipping reference. Image acquisition and processing share the same machine tool, avoiding positional changes caused by secondary clamping of the workpiece.
[0044] In step S240, according to the pre-calibrated intrinsic parameters of the camera device and the extrinsic parameters between the camera device and the machine tool coordinate system, the image points of the target feature in the image are back-projected into ray parameters in the machine tool coordinate system, wherein the ray parameters include the starting point of the ray and the unit direction vector.
[0045] In some embodiments, an image point refers to the location of a target feature on an image, expressed in pixel coordinates. This means that the center of the image plane obtained by fitting the subpixel ellipse is taken from the through hole and the hollow, and the corner point of the outer contour is taken from the intersection of the two subpixel fitting lines.
[0046] In some embodiments, normalized coordinates refer to the three-dimensional orientation obtained after removing the equivalent focal length and principal point from the intrinsic parameters.
[0047] In equation (4), The normalized coordinates of the image point corresponding to the i-th target feature are a three-dimensional column vector with a third component of 1, which is a dimensionless quantity. and Let x and y be the x and y coordinates of the image point, in pixels; K is the intrinsic parameter matrix of the camera device, which is a third-order upper triangular matrix. and These are the equivalent focal lengths in the x and y directions, respectively, in pixels; and These are the x and y coordinates of the principal point, respectively, in pixels.
[0048] In some embodiments, a geometric ray refers to a semi-straight line that originates from the optical center of the camera device, passes through the image point, and extends into space; a unit direction vector refers to a direction vector with a length of 1 obtained by dividing the normalized coordinates by their modulus.
[0049]
[0050] In equation (5), Let be the unit direction vector of the i-th ray in the camera coordinate system, with a length of 1 and being a dimensionless quantity; The normalized coordinates obtained from equation (4); This is the modulus of the normalized coordinates. The direction vector is transformed to the machine coordinate system using the rotation matrix in the extrinsic parameters. This transformation uses only the rotation matrix and not the translation vector, because the direction vector only describes direction, not position.
[0051]
[0052] In equation (6), Let be the unit direction vector of the i-th ray in the machine tool coordinate system, with a length of 1; The rotation matrix in the extrinsic parameters is a third-order orthogonal right-handed matrix, whose function is to convert the vector representation in the camera coordinate system to the vector representation in the machine tool coordinate system. The starting point of the ray is taken as the coordinates of the optical center of the camera device in the machine tool coordinate system in the extrinsic parameters; the optical center refers to the projection center of the camera device during imaging, and since the camera device is fixedly installed on a stationary structure, this coordinate remains unchanged. The ray parameters satisfy:
[0053]
[0054] In equation (7), Let be the three-dimensional coordinates of a point on the i-th ray in the machine tool coordinate system, in millimeters; The coordinates of the optical center of the camera device in the machine tool coordinate system are in millimeters, which is the starting point of the ray; Let be the unit direction vector of the ray obtained from equation (6); This represents the distance along the ray, in millimeters. This indicates that only the half-line in front of the optical center is considered. The ray parameters consist of six scalars, with only five independent components due to the unit direction vector's length being constrained to 1.
[0055] This step avoids positioning deviations caused by performing rigid body transformations on coordinates already in the machine tool coordinate system again by using only the rotation matrix of the extrinsic parameters and not its translation vector when changing directions.
[0056] In step S250, the intersection point between the ray and the second surface is determined based on the ray parameters and the plane parameters, and the intersection point is determined as the three-dimensional coordinates of the target feature in the machine tool coordinate system.
[0057] In some embodiments, the ray equation refers to the parametric equation of each point on the ray obtained in step S240, i.e., equation (7); the plane equation refers to the implicit equation of each point on the plane where the second surface is located, i.e., equation (3).
[0058]
[0059] In equation (8), Let be the distance parameter of the i-th ray from its origin along a unit direction vector to the second surface, in millimeters; n is the unit normal vector of the second surface; d is the constant term of the plane equation, in millimeters. The coordinates of the optical center of the camera device in the machine tool coordinate system are given in millimeters. Let be the unit direction vector of the i-th ray in the machine coordinate system. The denominator is... It is the cosine of the angle between the ray direction and the normal of the second surface. When its absolute value is not zero, they intersect at a unique point. When its absolute value is close to zero, the ray is nearly parallel to the second surface. The intersection point is extremely sensitive to detection errors. At this time, the target feature is judged as unreliable and is downweighted or removed in subsequent registration.
[0060] In some embodiments, the distance parameter is substituted back into the ray equation, i.e., the result obtained from equation (8) is... Substituting into equation (7), we obtain the intersection point between the ray and the second surface.
[0061]
[0062] In equation (9), The three-dimensional coordinates of the i-th target feature in the machine tool coordinate system are in millimeters. This is the spatial point corresponding to the target feature and is also the output of this step. The coordinates of the optical center of the camera device in the machine tool coordinate system are given in millimeters. The distance parameter obtained from equation (8) is in millimeters; Let be the unit direction vector of the i-th ray in the machine tool coordinate system. The destination of this three-dimensional coordinate is the target point used in step S270 for weighted rigid body registration, established as a candidate correspondence with the archive information. Since the second surface may have a small angle of inclination, the intersection point falls on the plane containing the second surface, resulting in the true geometry on the second surface.
[0063] This step involves substituting the ray equation into the plane equation to solve for the distance parameter, and then substituting the distance parameter back into the ray equation to obtain the intersection point. This allows a single monocular camera device to provide the three-dimensional coordinates of the target feature in the machine tool coordinate system, eliminating the need for the hardware and calibration costs of a second camera or depth sensor.
[0064] In step S260, with the unit normal vector of the workpiece on the first surface being mapped to the unit normal vector on the second surface as a constraint, the file information of at least one processed feature pre-corresponding to the target feature is matched with the image attributes of the target feature to obtain at least one set of candidate correspondences for the flipping transformation.
[0065] In some embodiments, the unit normal vector of the workpiece on the first surface It refers to the representation of the vertical axis of the workpiece coordinate system W1 in the machine tool coordinate system during the first surface machining, and its source is the third column of the initial rotation matrix.
[0066]
[0067] In equation (10), The rotation component of the flipping transformation is a third-order orthogonal right-hand matrix, which is dimensionless. Its function is to convert the direction representation in the machine tool coordinate system before flipping into the direction representation in the machine tool coordinate system after flipping. Rotate based on the reference point. To bypass The in-plane rotations of both are third-order orthogonal right-hand matrices; Let be the in-plane rotation angle, ranging from 0 degrees to 360 degrees. Equation (10) verifies that the constraint holds: That is, regardless of the value of θ, Always mapped to The reference rotation R0 can be directly constructed as follows:
[0068]
[0069] In equation (11), I is a third-order identity matrix; and The length of each is 1; To write an operator that converts a three-dimensional vector into an antisymmetric matrix, for vectors... have ; ; The direction is the axis of rotation for the reference flip. When When the equation equals -1, meaning the two are reversed, the equation degenerates. In this case, the reference flip rotation is around any line. Rotate 180 degrees along the vertical axis.
[0070] In some embodiments, pre-matching refers to a coarse pairing of file information and target features based on feature type and feature size before matching, which limits the candidate range for matching.
[0071] This step reduces the rotation of the flip transformation from three degrees of freedom to one degree of freedom around the normal of the second face by using the constraint that the unit normal vector of the first face is mapped to the unit normal vector of the second face. This allows the matching to be enumerated only in the dimension of the in-face rotation angle. The number of candidate correspondences is reduced from the factorial order of feature combination to the linear order of the enumeration step size, reducing the number of comparisons performed by the processor in the matching stage.
[0072] In step S270, for each candidate correspondence, the feature coordinates and three-dimensional coordinates are registered with weighted rigid body according to the registration weight to obtain the candidate solution of the flip transformation of each candidate correspondence and the corresponding weighted residual sum of squares.
[0073] In some embodiments, weighted rigid body registration involves solving a rigid body transformation in the machine tool coordinate system so that the position of the processed feature in the file information is as close as possible to the three-dimensional coordinates of the target feature after the transformation, and the degree of closeness of each pair of pairs is weighted according to the registration weight.
[0074]
[0075] In equation (12), Let be the three-dimensional coordinates of the i-th machined feature in the machine tool coordinate system before the flipping face, in millimeters; and These are the initial rotation matrix and initial translation vector of the workpiece coordinate system in the machine tool coordinate system during the first surface machining. The former is a third-order orthogonal right-hand matrix, and the latter is in millimeters. Let be the feature coordinates of the i-th processed feature in the workpiece coordinate system in Equation (1), in millimeters. Equation (12) indicates that the file information records a fixed point on the material. After initial pose conversion, the position of this point in the machine tool coordinate system before flipping is obtained. The flipping transformation maps this position to the position after flipping, and thus the position in the machine tool coordinate system is... With Q i M Registration yields the flip transformation itself. For each candidate correspondence, the weighted optimal solution for the rigid body transformation is obtained, i.e.:
[0076] The constraints are and (13)
[0077] In equation (13), R and t are the rotation component and translation component of the flipping transformation to be determined, respectively. The former is a third-order orthogonal right-hand matrix, and the latter is a three-dimensional column vector with units of millimeters; N is the number of pairs contained in the candidate correspondence. The registration weight of the i-th processed feature in the archival information in Equation (1) is a dimensionless positive number. The three-dimensional coordinates of the i-th processed feature in the machine tool coordinate system before flipping, obtained from equation (12); The three-dimensional coordinates of the target feature paired with the i-th processed feature obtained from equation (9); Let be the Euclidean norm of the vector. In the formula... Ensure that the transformation does not change the length. The mirror solution is excluded, so that the solution result is a rigid body transformation that can be implemented on a machine tool. The solution of equation (13) adopts the closed-form solution of Kabsch and Umeyama: first, the weighted centroids of the two sets of points are calculated according to the registration weights, then the weighted cross-covariance matrix is constructed with the weighted centroids as the center, and then singular value decomposition and determinant correction are performed:
[0078]
[0079]
[0080]
[0081]
[0082] In equation (14), and These are the weighted centroids of the coordinates of the processed features contained in the candidate correspondence in the machine tool coordinate system before flipping, and the weighted centroids of the three-dimensional coordinates of the target features contained therein, both in millimeters; is the registration weight of the i-th processed feature; H is the weighted cross-covariance matrix between the two sets of points, which is a third-order matrix; U and V are the left singular vector matrix and the right singular vector matrix obtained by performing singular value decomposition on H, both of which are third-order orthogonal matrices. It is a singular value diagonal matrix; For the diagonal elements, take 1, 1 and 1 in sequence. The diagonal matrix of , where det represents the determinant, the third diagonal element is the determinant correction term, whose function is to reverse the direction corresponding to the minimum singular value when the product of U and V is a mirror transformation, thereby ensuring that R is an orthogonal right-hand rotation matrix instead of a mirror; R and t are the rotation component and translation component to be sought, respectively. The computational cost of equation (14) is proportional to the number of pairings and does not contain iteration. An orthogonal right-hand rotation matrix is a third-order matrix that simultaneously satisfies that the transpose is equal to the inverse matrix and the determinant is equal to positive one, where the orthogonality ensures that the distance between any two points before and after the transformation remains unchanged. A candidate solution is the optimal rigid body transformation obtained by equation (13) under a certain candidate correspondence, and its destination is to calculate the comprehensive score in step S280 and participate in the selection of solutions. The weighted residual sum of squares is the value obtained after substituting the candidate solution back into the objective function of equation (13):
[0083]
[0084] In equation (15), This is the weighted sum of squared residuals corresponding to the k-th candidate correspondence, in square millimeters; and The rotation and translation components of the k-th candidate solution are given; the meanings of the remaining symbols are the same as in equation (13). The weighted residual sum of squares is used to form the geometric residual term in step S280 and to eliminate candidate solutions that exceed the residual threshold. Before registration, isolated erroneous correspondences with significantly large residuals are eliminated by random sampling consensus algorithm, and then all consensus pairs are used to solve equation (13); the observation covariance of the target features is propagated to the Jacobian of the image point coordinates and plane parameters by equation (9) and then incorporated into the registration weight.
[0085] This step provides a closed-form solution by using the singular value decomposition of the weighted centroid and the weighted cross-covariance matrix, so that the registration of each candidate correspondence can be completed without iteration. The processor only adds a fixed number of matrix operations as the number of candidate solutions increases.
[0086] In step S280, based on the consistency score between the file information of the processed features corresponding to each candidate solution and the image attribute of the target feature corresponding to the processed features, and the weighted sum of squared residuals corresponding to the candidate solution, a unique candidate solution is determined from all candidate solutions as the flip transformation solution.
[0087] In some embodiments, the geometric residual term refers to a dimensionless quantity obtained by normalizing the weighted sum of squared residuals of candidate solutions to the square of the unit weight standard deviation.
[0088]
[0089] In equation (16), The solution is a flip-over transformation solution, i.e., the only selected candidate solution, which consists of rotation and translation components; This is the k-th candidate solution; The set of all candidate solutions; The weighted sum of squared residuals of the k-th candidate solution obtained by equation (15) is expressed in square millimeters. The preset residual threshold is expressed in square millimeters. The standard deviation is weighted per unit, with units of millimeters, and its square is measured in square millimeters. That is, the geometric residual term, which is a dimensionless quantity. The larger the value, the smaller the geometric residual. The consistency score for the k-th candidate solution; This means selecting the candidate solution from the given set of candidate solutions that maximizes the expression within the curly braces. Equation (16) indicates that the residual threshold is a screening process prior to scoring. When all candidate solutions exceed the residual threshold, alignment is deemed to have failed and an alarm is output.
[0090] This step obtains the geometric residual term by normalizing the weighted sum of squared residuals according to the unit weight standard deviation, so that the geometric residual and the consistency score are under the same dimension and can be directly added. The processor only needs one linear scan when selecting a solution and does not need to construct complex discrimination rules.
[0091] In step S290, the pose of the workpiece coordinate system of the second face in the machine tool coordinate system is solved according to the flip transformation and written into the CNC system of the machine tool. The pose includes the origin offset and attitude angle of the workpiece coordinate system of the second face. The attitude angle includes the skew angle around the vertical axis of the machine tool coordinate system and the tilt angle of the second face relative to the two horizontal axes of the machine tool coordinate system.
[0092] In some embodiments, the initial pose T old This refers to the pose of the workpiece coordinate system relative to the machine tool coordinate system, established during the first face machining process through alignment and tool setting, including the initial rotation matrix. With the initial translation vector .
[0093] In equation (17), The pose of the workpiece coordinate system on the second face in the machine tool coordinate system; The flipping transformation solution selected by equation (16) is derived from the rotation component. With translation components Composition, in which It is a third-order orthogonal right-hand matrix. It is a three-dimensional column vector, with units in millimeters; Let be the rotation matrix of the workpiece coordinate system on the second face; Let this be its translation vector, in millimeters. Equations two and three are the expansions of the rotation and translation parts, respectively. The translation part first rotates the initial translation vector by an angle using the rotation component of the face-shifting transformation solution, then superimposes the translation component of the face-shifting transformation solution. This order cannot be reversed; otherwise, it would be equivalent to rotating the translation amount of the face-shifting transformation as well, resulting in an incorrect position. Origin offset refers to the coordinates of the origin of the workpiece coordinate system on the second face in the machine tool coordinate system, derived from... The three components are given in millimeters, and their destination is the workpiece coordinate system offset register written to the CNC system. The attitude angle refers to the angle obtained by decomposing the rotation matrix of the workpiece coordinate system on the second face into rotation angles around the three axes of the machine tool coordinate system; the first column of this rotation matrix is first taken as the unit vector of the X-axis direction of the workpiece coordinate system. Take the third column as the unit vector in the Z-axis direction of the workpiece coordinate system. , It is also the unit normal vector of the second face:
[0094]
[0095] In equation (18), The skew angle is the angle between the projection of the workpiece coordinate system X-axis direction of the second surface onto the horizontal plane of the machine tool coordinate system and the X-axis of the machine tool coordinate system, expressed in degrees. and These are the tilt angles of the second face around the X and Y axes of the machine tool coordinate system, respectively, both in degrees; and From respectively The extracted workpiece coordinate system X-axis and Z-axis unit vectors have a length of 1. and These are the unit vectors in the directions of the three coordinate axes of the machine tool coordinate system; The arctangent function is used to determine the quadrant based on its two components. The first equation takes... The ratio of the two components in the horizontal plane of the machine tool gives the azimuth angle of the projection along the X-axis, which is independent of the degree of tilt; the second and third equations respectively take The components of the deviation relative to the machine tool's vertical axis on the machine tool's Y and X axes. Because... The direction is from and The only certainty, and In Orthogonal, of length 1, and its horizontal projection orientation are determined by Given three conditions, the coordinates are uniquely determined, thus establishing a one-to-one correspondence between the three attitude angles and the rotation matrix of the workpiece coordinate system on the second face. The origin offset and the three attitude angles are written together into the machine tool's CNC system to update the origin offset and rotation angle in the workpiece coordinate system offset register, or as the origin and rotation angle parameters for tilting the work plane command. This ensures that the toolpath on the second face is written according to the original workpiece coordinate system and can continue execution without any modifications. This application does not use the method of modifying the coordinates of the second face machining program segment by segment, because segment by segment modification would disrupt the correspondence between the machining program and the design model and couple with tool length compensation; after writing, the processor can read the estimated covariance to give a confidence level.
[0096] This step obtains the workpiece coordinate system pose of the second face by combining the flip transformation solution with the initial pose, and writes it into the CNC system in the form of origin offset and three attitude angles. This allows the tool path of the second face to be executed with zero modification to the original workpiece coordinate system. The processor does not need to rewrite the second face machining program segment by segment, which reduces the amount of computation for program rewriting and the possibility of rewriting errors.
[0097] According to the workpiece flipping pose reconstruction method of this application, by using the archive information written feature by feature during the processing of the first surface as the flipping reference, the data required for flipping alignment is transformed from post-flipping measurement to a structured record generated by the processing process itself, and the system no longer needs to collect the workpiece shape after flipping; by using the unit normal vector of the first surface being mapped to the unit normal vector of the second surface as a constraint, the search space of the flipping transformation is narrowed from six degrees of freedom to a single degree of freedom in the plane, and the matching is guided by the projection position of the archive information under this constraint, reducing the number of candidate combinations and the computational load of image processing; by using ray parameters and measured planes... The intersection of surface parameters yields the three-dimensional coordinates of the machine tool coordinate system. A single camera device can complete the single-view three-dimensional measurement, avoiding the calibration and memory overhead of adding a second camera or depth sensor. By weighting rigid body registration according to the registration weight and determining the unique solution according to the consistency score and the weighted sum of squared residuals, the implicit erroneous solution of 180 degrees misalignment is no longer generated when the feature distribution is symmetrical, reducing the risk of silent entry into the second-face machining program due to misalignment. By redefining the coordinate system rather than modifying the second-face machining program, the correspondence between the machining program, design model and tool compensation is maintained, improving the robustness and traceability of the machining process.
[0098] According to some embodiments of this application, after determining a unique candidate solution from all candidate solutions as the flipping transformation solution, the workpiece flipping pose reconstruction method further includes steps S310 to S350.
[0099] In step S310, based on the flip transformation solution, the residual vector between the feature coordinates after transformation by the flip transformation solution and the matching three-dimensional coordinates is calculated.
[0100] In some embodiments, the residual vector refers to the three-dimensional vector formed by the difference between the characteristic coordinates (after transforming them to the machine tool coordinate system and then performing a flip-over transformation) and the matching three-dimensional coordinates. The formula for the residual vector is: The unit is millimeters. This represents the three-dimensional coordinates of the target feature in the machine tool coordinate system. The coordinates of the file features in the machine tool coordinate system are represented by the rotation component. With translation components constitute.
[0101] In step S320, the observation covariance of the three-dimensional coordinates of the target feature is synthesized based on the processing and positioning covariance of the feature coordinates, the image measurement noise of the target feature in the image, and the plane fitting residual of the second surface, and the residual covariance is constructed based on the observation covariance.
[0102] In some embodiments, image measurement noise is the variance of the pixel coordinate error of image points, in square pixels; plane fitting residual is the variance of the distance from each point to the fitting plane when the second point cloud is fitted to the plane, in square millimeters.
[0103] In equation (19), Let be the observation covariance of the three-dimensional coordinates of the i-th target feature in the machine tool coordinate system, which is a third-order symmetric positive definite matrix with units of square millimeters; It is the Jacobian matrix of three-dimensional coordinates to the pixel coordinates of image points, and is a third-order matrix; The covariance matrix of the image measurement noise is a second-order matrix with units of square pixels; For the three-dimensional coordinates relative to the second plane parameters and The Jacobian matrix is a 3x4 matrix; Let be the covariance matrix of the plane fitting residuals, which is a fourth-order matrix with units of square millimeters; and These are the rotation components and the initial rotation matrix of the flip transformation solution, respectively; For the information in the archive of formula (1), the first The processing and positioning covariance of each feature coordinate. The residual covariance is the covariance matrix of the residual vectors, obtained by arranging the paired observation covariances into a block diagonal matrix in pairwise order.
[0104]
[0105] In equation (20), Let be the residual covariance, which is a symmetric positive definite matrix with a dimension three times the pairwise number, and its unit is square millimeters; This indicates that a block diagonal matrix is constructed using the matrices within the parentheses as diagonal blocks. The reason for using the block diagonal form is that the measurements of each target feature are independent of each other, and there is no cross-correlation between their errors.
[0106] In step S330, the Mahalanobis distance statistic is calculated based on the residual vector and the residual covariance.
[0107] In some embodiments, the Mahalanobis distance statistic refers to the length of the residual vector after weighting it with the inverse matrix of the residual covariance, which means the standardized distance of the residual relative to the observation accuracy in each direction.
[0108]
[0109] In equation (21), T is the Mahalanobis distance statistic, which is a non-negative dimensionless number; The residual vector obtained in step S285 has a dimension three times the number of pairs and is in millimeters. The residual covariance obtained from equation (20) is expressed in square millimeters. The inverse matrix is given by T, with units of millimeters per square millimeter; the superscript T denotes vector transpose. The length dimension is canceled out by the inverse matrix of the covariance, thus T can be directly compared with the threshold. The consistency threshold refers to the allowable upper limit of the Mahalanobis distance statistic, which is a dimensionless number; its source is the configuration parameters tuned according to the machine tool's measured repeatability, pixel equivalent, and machining tolerance band, and it is stored in a configuration file separate from the algorithm code; its destination is used to determine whether the consistency check passes.
[0110] In step S340, if the Mahalanobis distance statistic is not greater than the preset consistency threshold, the consistency check is deemed to have passed, and the pose of the workpiece coordinate system of the second face in the machine tool coordinate system is analyzed according to the flip transformation solution and written into the CNC system of the machine tool; if the Mahalanobis distance statistic is greater than the consistency threshold, the consistency check is deemed to have failed, and the flip transformation solution is rejected.
[0111] In some embodiments, passing the consistency test means that the residual is commensurate with the observation accuracy and the flip-over transformation solution is acceptable. At this time, the pose is analyzed and written into the CNC system in the manner of step S290.
[0112]
[0113] In equation (22), The covariance, which is the estimator of the six-degree-of-freedom parameters for the flip-over transformation, is a six-order symmetric positive definite matrix. For the registration function, the Jacobian matrix of the six-degree-of-freedom parameters, its... row block The value of x at the flip transformation solution is a matrix of three rows and six columns; x is the six-degree-of-freedom parameter vector of the flip transformation solution, which consists of three translation components and three rotation components. The unit of the translation components is millimeters, and the unit of the rotation components is radians. Let be the residual covariance obtained from equation (20). In equation (22) The square root of the diagonal element is the standard deviation of each degree of freedom parameter. After converting the standard deviation of the rotation component into an angle, it can be compared with the angle tolerance, and the confidence level of the alignment result can be given accordingly.
[0114] This embodiment quantifies the reliability of measurement results rather than accepting them by default by synthesizing the observation covariance based on the machining positioning covariance, image measurement noise, and plane fitting residual after determining the flipping transformation solution, and uses Mahalanobis distance statistics for consistency verification. Incorrect alignment results are intercepted before being written into the CNC system.
[0115] According to some embodiments of this application, the step of determining the planar parameters of the second surface of the flipped workpiece in the machine tool coordinate system is achieved through any of the following channels.
[0116] In the first channel, the workpiece is moved to two or more positions relative to the camera device on the machine tool's worktable. At each position, the camera device captures an image of the second surface, resulting in multiple first images corresponding to each position. The relative rotation and translation between each position are analyzed using the coordinate readings of each axis of the machine tool and the forward kinematics of the machine tool. For the same physical point on the second surface, an imaging point is determined in each of the multiple first images, resulting in multiple imaging points for that physical point, and a correspondence is established between the multiple imaging points. According to the relative rotation and relative translation, the multiple imaging points with corresponding relationships are triangulated to obtain the point cloud of the second surface. The point cloud of the second surface is then fitted to a plane to obtain the unit normal vector and constant term of the second surface.
[0117] In some embodiments, the first channel refers to a measurement channel that uses the machine tool's own feed motion as the motion baseline and treats a fixed monocular camera as a binocular camera by means of two imaging positions.
[0118] The second channel is used to capture an image of the second surface after a structured light pattern is projected onto it by a camera device, thus obtaining a second image. Based on the deformation of the structured light pattern in the second image, the point cloud of the second surface is obtained. Plane fitting is performed on the point cloud of the second surface to obtain the unit normal vector and constant term of the second surface.
[0119] In some embodiments, a structured light pattern refers to a light spot or light stripe pattern with known geometric regularity projected onto a second surface by a projection module.
[0120] The third channel acquires an image of the second surface with a reference target by a camera device, resulting in a third image. The target plane where the reference target is located is coplanar with the second surface. The target feature points of the reference target in the third image are identified, and the unit normal vector and constant term of the target plane in the machine tool coordinate system are determined based on the known coordinates of the target feature points on the reference target. The unit normal vector and constant term of the target plane are then used as the unit normal vector and constant term of the second surface.
[0121] In some embodiments, a reference target refers to a planar calibration element with a known geometric pattern, such as a checkerboard or a dot array; the target plane being coplanar with the second surface means that the reference target is laid flat on the second surface so that the two are located in the same geometric plane.
[0122] The fourth channel involves a tool with contact detection contacting three or more non-collinear contact points on the second surface. When the tool contacts each contact point, the coordinates of the tool reference point in the machine tool coordinate system are recorded. Based on the length and shape of the tool, the coordinates of the tool reference point are converted into the three-dimensional coordinates of each contact point in the machine tool coordinate system. The unit normal vector and constant term of the second surface are obtained by fitting the three-dimensional coordinates of each contact point.
[0123] In some embodiments, a tool with contact detection refers to a tool assembly with a contact detection element between the spindle and the tool, such as a tool block continuity detection, a trigger probe, or a pneumatic and capacitive proximity switch, which outputs a level transition signal when in contact with the workpiece.
[0124] This embodiment provides four independent channels—based on machine tool motion, structured light projection, and contact between the reference target and the tool—so that the acquisition of the second plane parameters does not depend on a single measurement principle. It provides usable exits under different working conditions, such as insufficient lighting, surface unimageability, limited table travel, or the need for independent calibration.
[0125] According to some embodiments of this application, the step of back-projecting the image points of the target feature in the image into ray parameters in the machine tool coordinate system according to the pre-calibrated intrinsic parameters of the camera device and the extrinsic parameters between the camera device and the machine tool coordinate system includes steps S241 to S244.
[0126] In step S241, according to the pre-calibrated intrinsic parameters of the camera device, the pixel coordinates of the image points of the target feature in the image are converted into normalized coordinates in the camera coordinate system of the camera device.
[0127] In some embodiments, the camera coordinate system refers to a coordinate system with the optical center of the camera device as the origin, the optical axis as the vertical axis, and the horizontal and vertical axes parallel to the horizontal and vertical directions of the image, respectively.
[0128] In step S242, the unit direction vector of the geometric ray corresponding to the image point in the camera coordinate system is determined based on the normalized coordinates.
[0129] In some embodiments, a geometric ray refers to a semi-straight line that originates from the optical center of the camera device, passes through the image point, and extends into space; a unit direction vector refers to a direction vector with a length of 1 obtained by dividing the normalized coordinates by their modulus.
[0130] In step S243, the unit direction vector in the camera coordinate system is converted into the unit direction vector in the machine tool coordinate system according to the rotation matrix in the extrinsic parameters between the camera device and the machine tool coordinate system.
[0131] In some embodiments, the transformation uses only the rotation matrix in the extrinsic parameters and not the translation vector therein, because the direction vector only describes direction and not position, and the translation of the origin of the coordinate system does not change the representation of the direction vector.
[0132] In step S244, the coordinates of the optical center of the camera device in the machine tool coordinate system are determined as the starting point of the ray, and the unit direction vector in the machine tool coordinate system is determined as the unit direction vector of the ray, thus obtaining the ray parameters.
[0133] In some embodiments, the optical center refers to the projection center when the camera device images, and its coordinates in the machine tool coordinate system are given by the translation vector in the extrinsic parameters.
[0134] This embodiment converts image points into directions using intrinsic parameters and then into the machine tool coordinate system using the rotation matrix in the extrinsic parameters. It also takes the coordinates of the optical center in the machine tool coordinate system as the ray origin, so that the two-dimensional image observation is completely expressed as ray parameters in the machine tool coordinate system. The intermediate quantities of the mixed coordinate system no longer appear in the measurement link, reducing conversion errors and cumulative deviations caused by inconsistent coordinate references.
[0135] According to some embodiments of this application, the step of determining the intersection point of the ray and the second surface based on the ray parameters and the plane parameters, and determining the intersection point as the three-dimensional coordinates of the target feature in the machine tool coordinate system, includes steps S251 to S254.
[0136] In step S251, based on the starting point and unit direction vector of the ray in the ray parameters, and the unit normal vector and constant term of the second surface in the plane parameters, the ray equation satisfied by the point on the ray and the plane equation satisfied by the second surface are established.
[0137] In some embodiments, the ray equation refers to the expression for how the coordinates of each point on the ray change with the distance parameter, and the plane equation refers to the implicit equation satisfied by the coordinates of each point on the plane containing the second surface.
[0138] In step S252, the ray equation is substituted into the plane equation to obtain the ray distance parameter.
[0139] In some embodiments, substitution means replacing the coordinate variables in the plane equation with the coordinate expressions in the ray equation to obtain a linear equation in one variable containing only the distance parameter. Solving this equation yields the distance parameter.
[0140] In step S253, the distance parameter is substituted into the ray equation to obtain the intersection point of the ray and the second surface.
[0141] In some embodiments, the intersection point is the only point in common between the ray and the plane containing the second surface.
[0142] In step S254, the intersection point is determined as the three-dimensional coordinates of the target feature in the machine tool coordinate system.
[0143] In some embodiments, the three-dimensional coordinates of the target feature in the machine tool coordinate system are the intersection points obtained in step S253.
[0144] This embodiment establishes and solves the ray equation and the plane equation simultaneously, obtains the distance parameter by a single division and the intersection point by a single vector addition, so that the target features in the monocular image are converted into three-dimensional coordinates in the machine tool coordinate system, thus supplementing the missing depth information in monocular imaging without the need for a depth sensor.
[0145] According to some embodiments of this application, the step of matching the file information of at least one processed feature pre-corresponding to the target feature with the image attributes of the target feature to obtain at least one set of candidate correspondences for the flipping transformation, with the constraint that the unit normal vector of the workpiece on the first surface is mapped to the unit normal vector of the second surface, includes steps S261 to S263.
[0146] In step S261, with the constraint that the unit normal vector of the workpiece on the first surface is mapped to the unit normal vector of the second surface, the rotation of the flipping transformation is decomposed into a reference flipping rotation and an in-plane rotation. The reference flipping rotation is the rotation that rotates the unit normal vector of the first surface to the unit normal vector of the second surface, and the in-plane rotation is the rotation about the unit normal vector of the second surface.
[0147] In some embodiments, the rotation of the flipping transformation is that in equation (10) .
[0148] In step S262, the feature coordinates of at least one processed feature corresponding to the target feature are projected onto the image according to the reference flip rotation and the preset in-plane rotation angle, so as to obtain the predicted position of each processed feature in the image.
[0149] In some embodiments, projection onto an image means mapping the spatial position of the processed features to the pixel position on the image through the imaging model of the camera device. The process is the opposite of the back projection in step S240, and includes converting the feature coordinates to the machine coordinate system according to formula (12), applying a rotation consisting of a reference flip rotation and an in-plane rotation angle, applying a translation component of the flip transformation, converting the point in the machine coordinate system to the camera coordinate system according to the extrinsic parameters, and finally projecting it to pixel coordinates according to the intrinsic parameters.
[0150] In step S263, for each pre-corresponding processed feature, matching is performed according to the feature type and feature size in the archive information of the processed feature, and the image feature type and image feature size in the image attributes of the target feature, to obtain at least one set of candidate correspondences.
[0151] In some embodiments, matching by feature type and feature size means that for each candidate pair, two conditions must be met simultaneously: the feature type of the processed feature is consistent with the image feature type of the target feature, and the absolute value of the difference between their sizes is within a pre-defined size tolerance.
[0152] This embodiment decomposes the rotation of the flip transformation according to the mapping relationship of the unit normal vector, so that the matching is reduced from three-dimensional search to one-dimensional enumeration, and the number of candidate correspondences is reduced from the factorial order of feature combination to the linear order of enumeration step size.
[0153] According to some embodiments of this application, for each candidate correspondence, the step of performing weighted rigid body registration of the feature coordinates and three-dimensional coordinates according to the registration weight to obtain the candidate solution of the flip transformation of each candidate correspondence and the corresponding weighted residual sum of squares includes steps S271 to S276.
[0154] In step S271, for each candidate correspondence, the weighted centroid of the feature coordinates and the weighted centroid of the three-dimensional coordinates are calculated according to the registration weight.
[0155] In some embodiments, the weighted centroid refers to the average position of a set of points, weighted by the registration weights.
[0156] In step S272, a weighted cross-covariance matrix between the feature coordinates and the three-dimensional coordinates is constructed based on the weighted centroids of the feature coordinates and the three-dimensional coordinates.
[0157] In some embodiments, the weighted cross-covariance matrix refers to the cross-covariance obtained by subtracting the weighted centroid of each of the two sets of points and then weighting them according to the registration weights. It is denoted as H and is calculated in the second row of equation (14).
[0158] In step S273, singular value decomposition is performed on the weighted cross-covariance matrix to obtain the rotation matrix and translation vector that minimizes the sum of squared weighted residuals.
[0159] In some embodiments, singular value decomposition refers to decomposing a matrix into the product of an orthogonal matrix, a diagonal matrix, and another orthogonal matrix, i.e., the product of the first and second orthogonal matrices in the third row of equation (14). .
[0160] In step S274, the rotation matrix is corrected by the determinant to obtain an orthogonal right-handed rotation matrix.
[0161] In some embodiments, determinant modification refers to taking the third diagonal element of the diagonal matrix as the determinant of the product of V and U when constructing the rotation matrix from the product of V and U, i.e., the fourth row of equation (14). .
[0162] In step S275, the orthogonal right-hand rotation matrix and translation vector are determined as candidate solutions for the flipping transformation of the candidate correspondence.
[0163] In some embodiments, a candidate solution refers to the optimal rigid body transformation obtained under a candidate correspondence, which is composed of an orthogonal right-handed rotation matrix and a translation vector, with a total of six degrees of freedom.
[0164] In step S276, the weighted sum of squared residuals of the candidate correspondence is calculated based on the feature coordinates, three-dimensional coordinates, orthogonal right-hand rotation matrix, translation vector, and registration weight.
[0165] In some embodiments, the weighted sum of squared residuals refers to the value obtained by substituting the candidate solution back into the objective function of equation (13), and its calculation method is equation (15).
[0166] This embodiment provides a closed-form solution for registration using weighted centroids, weighted cross-covariance matrices, and singular value decomposition, enabling the registration of candidate correspondences to be completed without iteration. The processing delay is proportional to the number of pairs and does not contain an iteration number factor.
[0167] According to some embodiments of this application, the step of determining a unique candidate solution as a flip transformation solution from all candidate solutions based on the consistency score of the file information of the processed features corresponding to each candidate solution and the image attribute of the target feature corresponding to the processed features, and the weighted sum of squared residuals corresponding to the candidate solution, includes steps S281 to S284.
[0168] In step S281, for each candidate solution, the geometric residual term of the candidate solution is determined based on the ratio of the weighted sum of squared residuals corresponding to the candidate solution to the pre-set unit weight standard deviation.
[0169] In some embodiments, the geometric residual term refers to the dimensionless quantity obtained by dividing the weighted sum of squared residuals by the square of the unit weighted standard deviation, i.e., in equation (16). The meaning is the geometric deviation of the candidate solution from the observation by a multiple of the observation's own precision.
[0170] In step S282, based on the archive information of the processed features corresponding to the candidate solution and the image attributes of the target features corresponding to the processed features, the consistency score of the candidate solution is calculated. The consistency score includes the average of one or more of the following: feature size sequence matching degree, feature spacing pattern matching degree, directional evidence of single-face class features, and flip axis position prior.
[0171] In some embodiments, the feature size sequence matching degree refers to the degree of consistency between the feature size sequence in the file and the image feature size sequence of the corresponding target feature after sorting each pair of processed features according to feature coordinates. It can be taken as the difference between the absolute value of the difference between the two sequences after normalization according to the size tolerance and 1.
[0172] In step S283, the comprehensive score of the candidate solution is calculated based on the geometric residual term and the consistency score.
[0173] In some embodiments, the composite score is the sum of the geometric residual term and the consistency score, which is a dimensionless quantity and can be written as... The form of the equation means that the smaller the geometric residual and the higher the consistency of the records, the greater the overall score.
[0174] In step S284, candidate solutions whose weighted residual sum of squares exceeds a preset residual threshold are eliminated. Among the remaining candidate solutions, the one with the highest comprehensive score is determined as the only candidate solution and is used as the flipping transformation solution.
[0175] In some embodiments, elimination refers to removing candidate solutions whose weighted sum of squared residuals exceeds a residual threshold from the candidate solution set so that they are not included in the comparison of the overall score.
[0176] This embodiment normalizes the weighted sum of squared residuals into geometric residuals, converts the four types of evidence from the processing archives into consistency scores, and selects the one with the largest comprehensive score after eliminating out-of-limit candidate solutions. This allows geometrically equivalent symmetrical candidate solutions to be distinguished based on evidence unrelated to geometric residuals, thus avoiding the hidden error of a rectangular symmetrical workpiece being misaligned by 180 degrees after flipping, which is not detectable in geometric residuals.
[0177] According to some embodiments of this application, the steps of analyzing the pose of the workpiece coordinate system of the second face in the machine tool coordinate system based on the flip transformation include steps S291 to S296.
[0178] In step S291, the initial pose of the workpiece coordinate system in the machine tool coordinate system is obtained when the workpiece is being machined on the first surface. The initial pose includes the initial rotation matrix and the initial translation vector.
[0179] In some embodiments, the initial pose refers to the pose of the workpiece coordinate system relative to the machine tool coordinate system established during the first face machining process through alignment and tool setting, determined by the initial rotation matrix. With the initial translation vector Together they constitute.
[0180] In step S292, the rotation matrix of the workpiece coordinate system of the second face is obtained by left-multiplying the orthogonal right-hand rotation matrix in the flipping transformation solution by the initial rotation matrix.
[0181] In some embodiments, left multiplication refers to multiplying the rotation component of the flipping transformation solution as the left-hand factor and the initial rotation matrix as the right-hand factor, i.e., in equation (17). .
[0182] In step S293, the orthogonal right-hand rotation matrix in the flip transformation solution is applied to the initial translation vector to obtain the rotated translation vector. Then, the rotated translation vector is added to the translation vector in the flip transformation solution to obtain the translation vector of the workpiece coordinate system of the second face.
[0183] In some embodiments, applying rotation to the initial translation vector means multiplying the initial translation vector on the left by the rotation component of the flip transformation solution, i.e., in equation (17). The result is the translation vector after rotation, in millimeters.
[0184] In step S294, the translation vector of the workpiece coordinate system of the second surface is determined as the origin offset of the workpiece coordinate system of the second surface.
[0185] In some embodiments, origin offset refers to the coordinates of the origin of the workpiece coordinate system on the second surface in the machine tool coordinate system, which is given by the three components of the translation vector obtained in step S293, and the unit is millimeters.
[0186] In step S295, the X-axis direction of the workpiece coordinate system is extracted from the rotation matrix of the workpiece coordinate system on the second surface. The skew angle is determined based on the angle between the projection of the X-axis direction onto the horizontal plane of the machine tool coordinate system and the X-axis of the machine tool coordinate system.
[0187] In some embodiments, extracting the X-axis direction from the rotation matrix means taking the first column of the rotation matrix to obtain the unit vector of the X-axis direction of the workpiece coordinate system in the machine tool coordinate system. Its three components are projections onto the three coordinate axes of the machine tool coordinate system.
[0188] In step S296, the Z-axis direction of the workpiece coordinate system is extracted from the rotation matrix of the workpiece coordinate system of the second face, and the tilt angle of the two horizontal axes is determined based on the deviation between the Z-axis direction and the Z-axis of the machine tool coordinate system.
[0189] In some embodiments, extracting the Z-axis direction from the rotation matrix means taking the third column of the rotation matrix to obtain the unit vector of the Z-axis direction of the workpiece coordinate system in the machine tool coordinate system. It is also the unit normal vector of the second face. .
[0190] This embodiment obtains a new rotation matrix by left-multiplying the rotation component of the flip-face transformation solution by the initial rotation matrix, applying the rotation component to the initial translation vector, and then adding it to the translation component of the flip-face transformation solution to obtain a new translation vector. This allows the workpiece coordinate system pose of the second face to be directly obtained by combining two known quantities, without the need for tool resetting.
[0191] According to some embodiments of this application, during the processing of the first side of the workpiece, the workpiece flipping pose reconstruction method further includes steps S510 to S540.
[0192] In step S510, the processed features are divided into through-type, contour-type, and single-sided type according to their visibility after flipping. Among them, through-type and contour-type features are visible after flipping, while single-sided features are not visible after flipping.
[0193] In some embodiments, visibility after flipping refers to whether the processed features can be observed by a camera device from the new top surface after the workpiece has been flipped. Through-hole features refer to features that penetrate the material along the thickness direction and can be observed from both sides, including through holes, cutouts, and penetrating engravings.
[0194] In step S520, the processed features of the through class and the contour class are used as candidate features, and a weighted normalization matrix is constructed based on the sensitivity of the candidate features to the six degrees of freedom of the flip transformation.
[0195] In some embodiments, candidate features refer to a set of processed features that are visible after flipping and can participate in registration, i.e., the union of the through class and the contour class.
[0196] In step S530, if the condition number of the weighted normalization matrix is greater than the preset condition number threshold, process features are added to the non-functional area of the workpiece. The position of the process features satisfies the following conditions: it is far away from the centroid of the candidate features, avoids the second surface processing area, and is located outside the clamping point.
[0197] In some embodiments, the condition number is the ratio of the maximum singular value to the minimum singular value of the weighted normalized matrix.
[0198]
[0199] In equation (23), The condition number of the weighted normalized matrix is a positive dimensionless number. The weighted normalized matrix has three times the number of candidate features and six columns. These are the maximum and minimum singular values of the weighted normalized matrix, both non-negative real numbers, and are dimensionless because the matrix has been normalized to the observation standard deviation. The condition number characterizes the constraint capability of the feature layout on the six degrees of freedom: close to 1 indicates balanced constraint on each degree of freedom, while a large value indicates that some degrees of freedom are almost unconstrained, numerically manifesting as the registration solution being extremely unstable on that degree of freedom. The condition number threshold is the upper limit of the allowable condition number, a dimensionless number; its source is the configuration parameter tuned according to the machine tool repeatability accuracy, pixel equivalent, and registration degrees of freedom; its purpose is to determine whether the layout of candidate features meets the observability requirements. The position of the process feature satisfies three conditions: it is far from the centroid of the candidate feature, which increases the sensitivity of the feature to the rotational degree of freedom; it avoids the second-side machining area, which prevents the added process feature from falling into the part to be machined on the second side; and it is located outside the clamping point, which prevents it from being obscured by the clamping plate. The location of the process feature can be determined by layout optimization, that is, taking the position that minimizes the number of conditions within the feasible region that satisfies the above three conditions.
[0200] In step S540, the added process features are processed together with the first surface processing, and the added process features are written into the workpiece's file information as processed features.
[0201] In some embodiments, processing along with the first surface means adding a program segment corresponding to the process feature to the processing program of the first surface, completing the process during the interval of the first surface processing, without adding a separate clamping or occupying a separate piece of equipment, so that the process feature and the other processed features are in the same clamping state, and their positional relationship is guaranteed by the same set of programs and coordinate readings.
[0202] This embodiment categorizes processed features according to their visibility after flipping, constructs a weighted normalization matrix based on the sensitivity of candidate features to the six degrees of freedom, and determines whether the feature layout degenerates based on the condition number. This allows the risk of whether registration can be achieved after flipping to be quantitatively assessed in the first-side processing stage, rather than being discovered only after registration failure after flipping.
[0203] According to some embodiments of this application, the workpiece flipping pose reconstruction method provided by this application further includes steps S610 to S640.
[0204] In step S610, after the workpiece coordinate system of the second face is solved according to the flip transformation and the position of the workpiece coordinate system in the machine tool coordinate system is written into the CNC system of the machine tool, the first layer of machining of the second face is performed. The first layer of machining is to perform shallow carving, light cutting or special verification marks on the first feature of the second face.
[0205] In some embodiments, the first-layer processing refers to a trial processing performed before the formal commencement of the second-layer processing, the purpose of which is to verify the correctness of the pose reconstruction result after flipping with minimal material cost.
[0206] In step S620, the features obtained from the first layer processing are imaged and measured, and the difference between the measured position and the designed position is determined as the correction transformation.
[0207] In some embodiments, imaging measurement refers to acquiring an image of the feature obtained from the first layer processing by a camera device, backprojecting the image points into rays in the same manner as steps S240 and S250, and intersecting with the plane parameters of the second surface to obtain the measured position of the feature in the machine tool coordinate system.
[0208] The constraints are
[0209] In equation (24), For the first The measured position of each feature obtained from the first layer of machining in the machine tool coordinate system, in millimeters; The design position of the same feature in the workpiece coordinate system, in millimeters; and The rotation matrix and translation vector of the workpiece coordinate system of the second surface obtained by equation (17); and Correction transformation The rotation and translation components, where It is a third-order orthogonal right-hand matrix. It is a three-dimensional column vector, with units in millimeters; The corrected workpiece coordinate system pose for the second face; To correct the magnitude of the translation component of the transformation, i.e., to correct the translation component of the transformation, the unit is millimeters; The upper limit of the correction is in millimeters. The first equation of equation (24) indicates that the measured position is equal to the result of the workpiece coordinate system pose transformation of the design position on the second face and then the correction transformation; the second equation indicates that the corrected pose is equal to the correction transformation multiplied by the original pose; the constraint condition indicates that the correction is only adopted when the translation component of the correction transformation is less than the upper limit of the correction.
[0210] In step S630, if the translation component of the correction transformation is less than the preset correction upper limit, the workpiece coordinate system is updated in the machine tool coordinate system according to the correction transformation, and the second surface machining continues.
[0211] In some embodiments, the correction upper limit refers to the allowable upper limit of the correction transformation translation component, in millimeters; its source is the configuration parameters set according to the machine tool repeatability, pixel equivalent and machining tolerance band; its destination is to determine whether the residual deviation can be absorbed by a small amount of correction.
[0212] In step S640, if the translation component of the corrected transformation is greater than or equal to the correction upper limit, the process is stopped.
[0213] In some embodiments, stopping means halting the machining of the second face and issuing an alarm, waiting for the operator to check without continuing to execute subsequent toolpaths.
[0214] This embodiment first performs shallow carving or light cutting on the first layer at the beginning of the second side processing, then images and measures the obtained features, and uses the difference between the measured position and the designed position to form a correction transformation. This allows the residual deviation of the pose reconstruction after flipping to be measured and back into the workpiece coordinate system pose before the formal processing of the second side, reducing the misalignment of the two-sided patterns caused by the accumulation of alignment residuals.
[0215] Based on the above-mentioned workpiece flipping pose reconstruction method, this application also provides a workpiece flipping pose reconstruction device.
[0216] The workpiece flipping pose reconstruction device according to the embodiments of this application includes a first reconstruction module, a second reconstruction module, a third reconstruction module, a fourth reconstruction module, a fifth reconstruction module, a sixth reconstruction module, a seventh reconstruction module, an eighth reconstruction module, and a ninth reconstruction module.
[0217] The first reconstruction module is used to write the archive information of the processed features of the workpiece feature by feature during the processing of the first surface of the workpiece. The archive information includes the feature type of the processed feature, the feature coordinates in the workpiece coordinate system, the feature size, the processing positioning covariance of the feature coordinates, and the registration weight.
[0218] The second reconstruction module is used to flip the workpiece and place it arbitrarily on the machine tool's worktable, and determine the planar parameters of the second surface of the workpiece in the machine tool coordinate system. The planar parameters include the unit normal vector and constant terms of the second surface.
[0219] The third reconstruction module is used to acquire images of the second side by a camera device fixedly mounted on a stationary structure of the machine tool, and to identify the processed features visible after flipping in the images as target features.
[0220] The fourth reconstruction module is used to back-project the image points of the target features in the image into ray parameters in the machine tool coordinate system according to the pre-calibrated intrinsic parameters of the camera device and the extrinsic parameters between the camera device and the machine tool coordinate system. The ray parameters include the starting point and unit direction vector of the ray.
[0221] The fifth reconstruction module is used to determine the intersection point between the ray and the second surface based on the ray parameters and the plane parameters, and to determine the intersection point as the three-dimensional coordinates of the target feature in the machine tool coordinate system.
[0222] The sixth reconstruction module is used to match the file information of at least one pre-corresponding processed feature with the image attributes of the target feature, with the unit normal vector of the workpiece on the first surface being mapped to the unit normal vector of the second surface as a constraint, to obtain at least one set of candidate correspondences for the flipping transformation.
[0223] The seventh reconstruction module is used to perform weighted rigid body registration of the feature coordinates and three-dimensional coordinates for each candidate correspondence according to the registration weight, so as to obtain the candidate solution of the flip transformation of each candidate correspondence and the corresponding weighted residual sum of squares.
[0224] The eighth reconstruction module is used to determine a unique candidate solution as the flip transformation solution from all candidate solutions based on the consistency score between the archive information of the processed features corresponding to each candidate solution and the image attribute of the target feature corresponding to the processed features, and the weighted sum of squared residuals corresponding to the candidate solution.
[0225] The ninth reconstruction module is used to analyze the pose of the workpiece coordinate system of the second face in the machine tool coordinate system according to the flip transformation, and write it into the CNC system of the machine tool. The pose includes the origin offset and attitude angle of the workpiece coordinate system of the second face. The attitude angle includes the skew angle about the vertical axis of the machine tool coordinate system and the tilt angle of the second face relative to the two horizontal axes of the machine tool coordinate system.
[0226] The technical effects of the workpiece flipping pose reconstruction device according to the embodiments of this application are similar to those of the workpiece flipping pose reconstruction method according to the embodiments of this application, and will not be described in detail here.
[0227] According to embodiments of this application, any multiple modules among the first, second, third, fourth, fifth, sixth, seventh, eighth, and ninth reconstruction modules can be merged into one module, or any one of these modules can be split into multiple modules. Alternatively, at least some of the functions of one or more of these modules can be combined with at least some of the functions of other modules and implemented in one module. According to embodiments of this application, at least one of the first, second, third, fourth, fifth, sixth, seventh, eighth, and ninth reconstruction modules can be at least partially implemented as hardware circuits, such as field-programmable gate arrays, programmable logic arrays, systems-on-a-chip, systems-on-a-substrate, systems-on-package, application-specific integrated circuits, or implemented by any other reasonable means of integrating or packaging circuits, or implemented by any one or a suitable combination of software, hardware, and firmware implementations. Alternatively, at least one of the first reconstruction module, the second reconstruction module, the third reconstruction module, the fourth reconstruction module, the fifth reconstruction module, the sixth reconstruction module, the seventh reconstruction module, the eighth reconstruction module, and the ninth reconstruction module can be implemented at least partially as a computer program module, which can perform corresponding functions when the computer program module is run.
[0228] An electronic device according to embodiments of this application includes a processor that can perform various appropriate actions and processes based on a program stored in a read-only memory or a program loaded from a storage portion into a random access memory. The processor may include, for example, a general-purpose microprocessor, an instruction set processor and / or an associated chipset and / or a dedicated microprocessor. The processor may also include onboard memory for caching purposes. The processor may include a single processing unit or multiple processing units for executing different steps of the method flow according to embodiments of this application.
[0229] Random access memory (RAM) stores various programs and data required for the operation of the electronic device. The processor, read-only memory (ROM), and RAM are interconnected via a bus. The processor executes various steps of the method flow according to embodiments of this application by executing programs stored in the ROM and / or RAM. It should be noted that the programs may also be stored in one or more memories other than ROM and RAM. The processor may also execute various steps of the method flow according to embodiments of this application by executing programs stored in said one or more memories.
[0230] According to embodiments of this application, the electronic device may further include an input / output interface, which is also connected to a bus. The electronic device may also include one or more of the following components connected to the input / output interface: an input section including a keyboard, mouse, etc.; an output section including a cathode ray tube, liquid crystal display, etc., and a speaker, etc.; a storage section including a hard disk, etc.; and a communication section including a network interface card, such as a local area network card, modem, etc. The communication section performs communication processing via a network such as the Internet. A drive is also connected to the input / output interface as needed. Removable media, such as disks, optical disks, magneto-optical disks, semiconductor memories, etc., are installed on the drive as needed so that computer programs read from them can be installed into the storage section as needed.
[0231] Embodiments of this application also provide a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of this application.
[0232] According to embodiments of this application, the computer-readable storage medium can be a non-volatile computer-readable storage medium, such as including but not limited to: portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory, portable compact disk read-only memory, optical storage devices, magnetic storage devices, or any suitable combination thereof. In embodiments of this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this application, the computer-readable storage medium may include the read-only memory, and / or random access memory, and / or one or more memories other than read-only memory and random access memory described above.
[0233] Embodiments of this application also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to cause the computer system to implement the methods provided in the embodiments of this application.
[0234] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices or magnetic storage devices. In another embodiment, the computer program may also be transmitted and distributed as signals over a network medium, and downloaded and installed via a communication component, and / or installed from a removable medium. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0235] In embodiments of this application, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium. When the computer program is executed by a processor, it performs the functions defined in the system of this application embodiment. According to embodiments of this application, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0236] According to embodiments of this application, program code for executing the computer programs provided in the embodiments of this application can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0237] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0238] Those skilled in the art will understand that the features described in the various embodiments of this application can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this application. In particular, the features described in the various embodiments of this application can be combined and / or combined in various ways without departing from the spirit and teachings of this application. All such combinations and / or combinations fall within the scope of this application.
Claims
1. A method for reconstructing the pose of a workpiece flipping surface, characterized in that, include: During the first surface machining of the workpiece, the archive information of the machined features of the workpiece is written feature by feature. The archive information includes the feature type of the machined feature, the feature coordinates in the workpiece coordinate system, the feature size, the machining positioning covariance of the feature coordinates, and the registration weight. After flipping the workpiece, place it arbitrarily on the machine tool's worktable. Determine the planar parameters of the second surface of the workpiece in the machine tool's coordinate system. The planar parameters include the unit normal vector and a constant term of the second surface. An image of the second side is captured by a camera device fixedly mounted on a stationary structure of the machine tool, and the processed features visible after flipping are identified in the image as target features; According to the pre-calibrated intrinsic parameters of the camera device and the extrinsic parameters between the camera device and the machine tool coordinate system, the image points of the target feature in the image are back-projected into ray parameters in the machine tool coordinate system, wherein the ray parameters include the starting point and unit direction vector of the ray; Based on the ray parameters and the plane parameters, the intersection point of the ray and the second surface is determined, and the intersection point is determined as the three-dimensional coordinates of the target feature in the machine tool coordinate system; With the unit normal vector of the workpiece on the first surface being mapped to the unit normal vector of the second surface as a constraint, the file information of at least one processed feature pre-corresponding to the target feature is matched with the image attributes of the target feature to obtain at least one set of candidate correspondences for the flipping transformation; For each candidate correspondence, the feature coordinates and the three-dimensional coordinates are registered using a weighted rigid body registration according to the registration weights to obtain the candidate solution of the flip transformation of each candidate correspondence and the corresponding weighted residual sum of squares. Based on the consistency score between the file information of the processed features corresponding to each candidate solution and the image attribute of the target feature corresponding to the processed features, and the weighted sum of squared residuals corresponding to the candidate solution, a unique candidate solution is determined from all the candidate solutions as the flipping transformation solution. The pose of the workpiece coordinate system of the second face under the machine tool coordinate system is analyzed according to the flipping transformation and written into the CNC system of the machine tool. The pose includes the origin offset and attitude angle of the workpiece coordinate system of the second face. The attitude angle includes the skew angle about the vertical axis of the machine tool coordinate system and the tilt angle of the second face relative to the two horizontal axes of the machine tool coordinate system.
2. The workpiece flipping pose reconstruction method according to claim 1, characterized in that, After determining a unique candidate solution from all the candidate solutions as the flipping transformation solution, the method further includes: Based on the flipping transformation solution, calculate the residual vector between the feature coordinates after transformation by the flipping transformation solution and the matching three-dimensional coordinates; Based on the processing and positioning covariance of the feature coordinates, the image measurement noise of the target feature in the image, and the plane fitting residual of the second surface, the observation covariance of the three-dimensional coordinates of the target feature is synthesized, and the residual covariance is constructed based on the observation covariance. Calculate the Mahalanobis distance statistic based on the residual vector and the residual covariance; If the Mahalanobis distance statistic is not greater than a preset consistency threshold, the consistency check is deemed to have passed. The pose of the workpiece coordinate system of the second face in the machine tool coordinate system is analyzed according to the flipping transformation and written into the CNC system of the machine tool. If the Mahalanobis distance statistic is greater than the consistency threshold, the consistency test is deemed to have failed, and the flipping transformation solution is rejected.
3. The workpiece flipping pose reconstruction method according to claim 1, characterized in that, The step of determining the planar parameters of the second surface of the workpiece after flipping in the machine tool coordinate system can be achieved through any of the following channels: The first channel allows the workpiece to move to two or more positions relative to the camera device along with the machine tool's worktable. At each of the positions, the camera device captures an image of the second side, resulting in multiple first images corresponding to each of the positions. The relative rotation and relative translation between the positions are analyzed from the coordinate readings of each axis of the machine tool and the forward kinematics of the machine tool; for the same physical point on the second surface, an imaging point of the physical point is determined in each of the multiple first images to obtain multiple imaging points of the physical point, and the correspondence between the multiple imaging points is established. According to the relative rotation and the relative translation, the plurality of imaging points with the corresponding relationship are triangulated to obtain the point cloud of the second surface; Plane fitting is performed on the point cloud of the second surface to obtain the unit normal vector and constant term of the second surface; The second channel is used by the camera device to capture an image of the second surface after a structured light pattern has been projected onto the second surface, thus obtaining a second image. The point cloud of the second surface is obtained based on the deformation of the structured light pattern in the second image; Plane fitting is performed on the point cloud of the second surface to obtain the unit normal vector and constant term of the second surface; The third channel is used by the camera device to capture an image of the second surface with a reference target, and the target plane where the reference target is located is coplanar with the second surface. Identify the target feature points of the reference target in the third image, and determine the unit normal vector and constant term of the target plane in the machine tool coordinate system based on the known coordinates of the target feature points on the reference target; determine the unit normal vector and constant term of the target plane as the unit normal vector and constant term of the second surface; The fourth channel involves a cutting tool with contact detection contacting three or more non-collinear contact points on the second surface. When the cutting tool contacts each of the contact points, the coordinates of the cutting tool reference point in the machine tool coordinate system are recorded. Based on the length and shape of the cutting tool, the coordinates of the cutting tool reference point are converted into the three-dimensional coordinates of each contact point in the machine tool coordinate system. The unit normal vector and constant term of the second surface are obtained by fitting the three-dimensional coordinates of each contact point.
4. The workpiece flipping pose reconstruction method according to claim 1, characterized in that, The step of back-projecting the image points of the target feature in the image into ray parameters in the machine tool coordinate system according to the pre-calibrated intrinsic parameters of the camera device and the extrinsic parameters between the camera device and the machine tool coordinate system includes: According to the pre-calibrated intrinsic parameters of the camera device, the pixel coordinates of the image points of the target feature in the image are converted into normalized coordinates in the camera coordinate system of the camera device; Based on the normalized coordinates, determine the unit direction vector of the geometric ray corresponding to the image point in the camera coordinate system; According to the rotation matrix in the extrinsic parameters between the camera device and the machine tool coordinate system, the unit direction vector in the camera coordinate system is converted into the unit direction vector in the machine tool coordinate system. The coordinates of the optical center of the camera device in the machine tool coordinate system are determined as the starting point of the ray, and the unit direction vector in the machine tool coordinate system is determined as the unit direction vector of the ray, thus obtaining the ray parameters.
5. The workpiece flipping pose reconstruction method according to claim 1, characterized in that, The step of determining the intersection point of the ray and the second surface based on the ray parameters and the plane parameters, and determining the intersection point as the three-dimensional coordinates of the target feature in the machine tool coordinate system, includes: Based on the ray origin and unit direction vector in the ray parameters, and the unit normal vector and constant term of the second surface in the plane parameters, establish the ray equation satisfied by the point on the ray and the plane equation satisfied by the second surface. Substituting the ray equation into the plane equation, the distance parameter of the ray is obtained; Substituting the distance parameter into the ray equation, the intersection point of the ray and the second surface is obtained; The intersection point is determined as the three-dimensional coordinates of the target feature in the machine tool coordinate system.
6. The workpiece flipping pose reconstruction method according to claim 1, characterized in that, The step of matching the file information of at least one processed feature pre-corresponding to the target feature with the image attributes of the target feature, using the unit normal vector of the workpiece on the first surface being mapped to the unit normal vector of the second surface as a constraint, to obtain at least one set of candidate correspondences for the flipping transformation, includes: With the unit normal vector of the workpiece on the first surface being mapped to the unit normal vector of the second surface as a constraint, the rotation of the flipping transformation is decomposed into a reference flipping rotation and an in-plane rotation. The reference flipping rotation is a rotation that rotates the unit normal vector of the first surface to the unit normal vector of the second surface, and the in-plane rotation is a rotation about the unit normal vector of the second surface. According to the reference flipping and rotation and the preset in-plane rotation angle, the feature coordinates of at least one processed feature pre-corresponding to the target feature are projected onto the image to obtain the predicted position of each processed feature in the image; For each pre-corresponding processed feature, match it according to the feature type and feature size in the archive information of the processed feature, and the image feature type and image feature size in the image attributes of the target feature, to obtain at least one set of candidate correspondences.
7. The workpiece flipping pose reconstruction method according to claim 1, characterized in that, For each candidate correspondence, the step of performing weighted rigid body registration of the feature coordinates and the three-dimensional coordinates according to the registration weights to obtain the candidate solution of the flip transformation of each candidate correspondence and the corresponding weighted sum of squared residuals includes: For each candidate correspondence, the weighted centroid of the feature coordinates and the weighted centroid of the three-dimensional coordinates are calculated according to the registration weights. Based on the weighted centroids of the feature coordinates and the three-dimensional coordinates, construct the weighted cross-covariance matrix between the feature coordinates and the three-dimensional coordinates; Singular value decomposition is performed on the weighted cross-covariance matrix to obtain the rotation matrix and translation vector that minimize the sum of squared weighted residuals; The rotation matrix is corrected by performing a determinant adjustment to obtain an orthogonal right-handed rotation matrix; The orthogonal right-hand rotation matrix and the translation vector are determined as candidate solutions for the flipping transformation of the candidate correspondence; The weighted sum of squared residuals of the candidate correspondence is calculated based on the feature coordinates, the three-dimensional coordinates, the orthogonal right-hand rotation matrix, the translation vector, and the registration weight.
8. The workpiece flipping pose reconstruction method according to claim 1, characterized in that, The step of determining a unique candidate solution as the flip transformation solution from all candidate solutions based on the consistency score between the file information of the processed features corresponding to each candidate solution and the image attribute of the target feature corresponding to the processed features, and the weighted sum of squared residuals corresponding to the candidate solution, includes: For each candidate solution, the geometric residual term of the candidate solution is determined based on the ratio of the weighted sum of squared residuals corresponding to the candidate solution to the pre-defined unit weight standard deviation. Based on the archive information of the processed features corresponding to the candidate solution and the image attributes of the target features corresponding to the processed features, the consistency score of the candidate solution is calculated. The consistency score includes the average of one or more of the following: feature size sequence matching degree, feature spacing pattern matching degree, directional evidence of single-face class features, and flip axis position prior. The comprehensive score of the candidate solution is calculated based on the geometric residual term and the consistency score. Candidate solutions whose weighted residual sum of squares exceeds a preset residual threshold are eliminated. Among the remaining candidate solutions, the one with the highest comprehensive score is determined as the unique candidate solution and is used as the flipping transformation solution.
9. The workpiece flipping pose reconstruction method according to claim 7, characterized in that, The steps of analyzing the pose of the workpiece coordinate system of the second face in the machine tool coordinate system according to the flipping transformation include: The initial pose of the workpiece coordinate system in the machine tool coordinate system is obtained when the workpiece is being machined on the first surface. The initial pose includes an initial rotation matrix and an initial translation vector. Multiply the initial rotation matrix by the orthogonal right-hand rotation matrix in the flipping transformation solution to obtain the rotation matrix of the workpiece coordinate system of the second face; Apply the orthogonal right-hand rotation matrix from the flipping transformation solution to the initial translation vector to obtain the rotated translation vector. Then add the rotated translation vector to the translation vector in the flipping transformation solution to obtain the translation vector of the workpiece coordinate system of the second face. The translation vector of the workpiece coordinate system of the second surface is determined as the origin offset of the workpiece coordinate system of the second surface; Extract the X-axis direction of the workpiece coordinate system from the rotation matrix of the workpiece coordinate system of the second surface, and determine the skew angle based on the angle between the projection of the X-axis direction in the horizontal plane of the machine tool coordinate system and the X-axis of the machine tool coordinate system; Extract the Z-axis direction of the workpiece coordinate system from the rotation matrix of the workpiece coordinate system of the second surface, and determine the tilt angle of the two horizontal axes based on the deviation between the Z-axis direction and the Z-axis of the machine tool coordinate system.
10. The workpiece flipping pose reconstruction method according to any one of claims 1 to 9, characterized in that, During the machining of the first surface of the workpiece, the method further includes: The processed features are classified into three categories according to their visibility after flipping: through-type, contour-type, and single-sided-type. The through-type and contour-type features are visible after flipping, while the single-sided-type features are not visible after flipping. The processed features of the through-type and the contour type are used as candidate features, and a weighted normalization matrix is constructed based on the sensitivity of the candidate features to the six degrees of freedom of the flip transformation. If the condition number of the weighted normalized matrix is greater than a preset condition number threshold, a process feature is added to the non-functional area of the workpiece. The position of the process feature satisfies the following conditions: it is far from the centroid of the candidate feature, avoids the second surface processing area, and is located outside the clamping point. The added process features are processed together with the first surface, and the added process features are written into the workpiece's file information as the processed features.
11. The workpiece flipping pose reconstruction method according to any one of claims 1 to 9, characterized in that, Also includes: After the workpiece coordinate system of the second face is analyzed according to the flipping transformation and the pose of the workpiece coordinate system in the machine tool coordinate system is written into the CNC system of the machine tool, the first layer of machining of the second face is performed. The first layer of machining is shallow carving, light cutting or machining special verification marks on the first feature of the second face. The features obtained from the first layer of processing are imaged and measured, and the difference between the measured position and the designed position is determined as the correction transformation; If the translation component of the correction transformation is less than the preset correction upper limit, the workpiece coordinate system is updated in the machine tool coordinate system according to the correction transformation, and the second surface machining continues. If the translation component of the corrected transformation is greater than or equal to the upper limit of the correction, the system is stopped.
12. A workpiece flipping posture reconstruction device, characterized in that, include: The first reconstruction module is used to write the archive information of the processed features of the workpiece feature by feature during the processing of the first surface of the workpiece. The archive information includes the feature type of the processed feature, the feature coordinates in the workpiece coordinate system, the feature size, the processing positioning covariance of the feature coordinates, and the registration weight. The second reconstruction module is used to flip the workpiece and place it arbitrarily on the machine tool's worktable, and determine the planar parameters of the second surface of the workpiece in the machine tool coordinate system after flipping, wherein the planar parameters include the unit normal vector and constant term of the second surface; The third reconstruction module is used to acquire an image of the second side by a camera device fixedly installed on the stationary structure of the machine tool, and to identify the processed features visible after flipping in the image as target features; The fourth reconstruction module is used to back-project the image points of the target feature in the image into ray parameters in the machine tool coordinate system according to the pre-calibrated intrinsic parameters of the camera device and the extrinsic parameters between the camera device and the machine tool coordinate system. The ray parameters include the starting point and unit direction vector of the ray. The fifth reconstruction module is used to determine the intersection point of the ray and the second surface based on the ray parameters and the plane parameters, and to determine the intersection point as the three-dimensional coordinates of the target feature in the machine tool coordinate system; The sixth reconstruction module is used to match the file information of at least one pre-corresponding processed feature with the image attributes of the target feature, with the unit normal vector of the workpiece on the first surface being mapped to the unit normal vector of the second surface as a constraint, to obtain at least one set of candidate correspondences for the flipping transformation; The seventh reconstruction module is used to perform weighted rigid body registration of the feature coordinates and the three-dimensional coordinates for each candidate correspondence according to the registration weight, so as to obtain the candidate solution of the flip transformation of each candidate correspondence and the corresponding weighted residual sum of squares. The eighth reconstruction module is used to determine a unique candidate solution as the flip transformation solution from all the candidate solutions based on the consistency score between the file information of the processed features corresponding to each candidate solution and the image attribute of the target feature corresponding to the processed features, and the weighted residual sum of squares corresponding to the candidate solution. The ninth reconstruction module is used to analyze the pose of the workpiece coordinate system of the second face in the machine tool coordinate system according to the flipping transformation, and write it into the CNC system of the machine tool. The pose includes the origin offset and attitude angle of the workpiece coordinate system of the second face. The attitude angle includes the skew angle about the vertical axis of the machine tool coordinate system and the tilt angle of the second face relative to the two horizontal axes of the machine tool coordinate system.
13. An electronic device, comprising: One or more processors; Memory, used to store one or more computer programs. The characteristic feature is that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 11.
14. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 11.
15. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 11.
