Swing axis calibration method, machine tool, storage medium, and program product

By using a monocular vision-based rotation axis calibration method, a monocular camera device and a standard sphere are used to fit the trajectory circle of the rotation axis. This solves the problems of large rotation axis calibration errors and long calibration times in existing technologies, and achieves efficient and accurate rotation axis parameter calibration and kinematic chain verification.

CN123128969APending Publication Date: 2026-11-20LINGXIN MAKER (BEIJING) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611659344.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-26
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Existing rotary axis calibration methods rely on operator experience, resulting in large human errors, long processing times, and difficulty in keeping up with machine tool thermal drift. Furthermore, they cannot accurately calibrate the direction, center, and interaxial offset of two rotary axes without using standard test bars, dial indicators, ball bars, and laser interferometers.

Method used

A monocular vision-based rotation axis calibration method based on machine tool motion is adopted. The image of a standard sphere is acquired by a monocular camera device, the trajectory circles of the B-axis and C-axis are fitted, the direction of the rotation axis and the center of the circle are determined, the inter-axis offset and the rotation center are calculated, and the accuracy of the calibration results is judged by the kinematic chain verification threshold.

Benefits of technology

It enables efficient and accurate calibration of rotary axis parameters without relying on standard inspection bars or other equipment, and provides calibration results with reliability assessment, ensuring the accuracy of the CNC system and the correctness of the kinematic chain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123128969A_ABST
    Figure CN123128969A_ABST
Patent Text Reader

Abstract

The application provides a single vision rotary axis calibration method based on machine tool motion, a machine tool, a storage medium and a program product. It is applied to the field of numerical control machine tools. The method includes the following steps: under the condition that the B-axis is rotated to multiple angles with the C-axis fixed at zero position, a monocular camera device collects images of a standard ball, the first coordinates of the ball center are determined according to the contour, and the trajectory circle of the B-axis is fitted; the C-axis is rotated to multiple angles when the B-axis is fixed at zero position, the second coordinates of the ball center are determined, and the trajectory circle of the C-axis is fitted; the directions and centers of the two rotary axes are determined from the two trajectory circles, the common perpendicular line segment of the two rotary axes is obtained, the length of the common perpendicular line segment is taken as the inter-axis offset, and the midpoint of the common perpendicular line segment is taken as the rotation center; the C-axis is rotated a full circle when the B-axis is fixed at a non-zero angle, the direction of the rotary axis of the C-axis is determined from the verification image, and the included angle residual is obtained by comparison with the zero position; when the included angle residual is less than or equal to the kinematic chain verification threshold, the inter-axis offset and the rotation center are written into the numerical control system, otherwise the cause is diagnosed and the user is prompted to check.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of CNC machine tool technology, specifically to a monocular vision rotary axis calibration method based on machine tool motion, a machine tool, a computer-readable storage medium, and a computer program product. Background Technology

[0002] Before machining on a multi-axis CNC machine tool, the geometric parameters of the rotary axes must be calibrated, including the direction and position of the rotary axis, the offset between the two rotary axes, and the rotation center. The CNC system converts the programmed coordinates to machine coordinates according to the above parameters. Any misalignment will cause the actual cutting contour to deviate from the programmed contour, resulting in dimensional errors.

[0003] There are two main types of existing rotary axis calibration methods. One type is the manual dial indicator and special measuring instrument method, which includes using a standard test bar and dial indicator to align the rotary axis, using a ball bar to infer the relative position of the two axes by interpolating the roundness deviation of the circular arc, and using a laser interferometer to measure the positioning error and perpendicularity of each axis. This type of method relies on the operator's experience and special instruments. Clamping and reading introduce large human errors, and it requires stopping the machine for installation and setting up each axis one by one. The time taken for a single calibration is measured in hours, and it is difficult to keep up with the thermal drift of the machine tool. Most of these methods are only suitable for structures where the two axes intersect. When the two rotary axes do not intersect in the assembly, a single rotation center cannot express the actual offset between the two axes.

[0004] Another type is the vision-based method, which involves using a camera to photograph markers or calibration plates on the turntable and calculating the rotation axis parameters from the pose of the markers. This method requires the markers to be installed on the turntable, and the accuracy of their placement and the repeatability of the clamping directly affect the calibration results. Furthermore, it often treats the rotation axis parameters as the only output, without providing the uncertainty of the parameters, making it impossible for the operator to determine whether the calibration has achieved the required accuracy before writing the data into the CNC system.

[0005] Therefore, the technical problem that needs to be solved is how to obtain the direction and center of two rotation axes, the interaxial offset and rotation center between the two axes, and the calibration results that can be directly written into the CNC system with assessable accuracy and verifiable kinematic chain correctness, without using standard inspection bars, dial indicators, ball bars, and laser interferometers, but only with a monocular camera fixed to the stationary structure of the machine tool, a standard ball clamped on the turntable, and the motion information of the machine tool. Summary of the Invention

[0006] In view of the above problems, this application provides a monocular vision rotary axis calibration method based on machine tool motion, a machine tool, a computer-readable storage medium, and a computer program product.

[0007] According to the first aspect of this application, a monocular vision rotary axis calibration method based on machine tool motion is provided. The machine tool includes a machine tool body, a spindle, a rotary table, a monocular camera device, a machine reference mark, and a standard ball. The rotary table includes a B-axis and a C-axis. The C-axis is mounted on the B-axis and tilts as the B-axis rotates. The B-axis is set around the Y-axis of the machine tool, and the C-axis is set around the Z-axis of the machine tool. The spindle is configured to feed linearly only along the X-axis, Y-axis, and Z-axis of the machine tool. The monocular camera device is fixedly mounted on a stationary structure of the machine tool body. The machine coordinates of the corner points of the machine reference mark are pre-calibrated and stored. The standard ball is clamped on the C-axis. This includes: rotating the B-axis to multiple angles with the C-axis fixed at zero; acquiring B-axis images of a standard sphere using a monocular camera at each angle; determining the first coordinate of the standard sphere's center in the machine coordinate system at each angle based on the extracted contour of the standard sphere in each B-axis image; and fitting a trajectory circle of the B-axis based on the first coordinate at each angle. It also includes: rotating the C-axis to multiple angles with the B-axis fixed at zero; acquiring C-axis images of the standard sphere using a monocular camera at each angle; determining the second coordinate of the standard sphere's center in the machine coordinate system at each angle based on the extracted contour of the standard sphere in each C-axis image; and fitting a trajectory circle of the B-axis based on the first coordinate at each angle. The trajectory circle of the C-axis is fitted using a two-axis coordinate fitting method. The direction and center of the rotation axis of the B-axis are determined based on the trajectory circle of the B-axis, and the direction and center of the rotation axis of the C-axis are also determined based on the trajectory circle of the C-axis. The common perpendicular segment between the rotation axes of the B-axis and C-axis is calculated, and its length is defined as the inter-axis offset between the B-axis and C-axis. The center of rotation between the B-axis and C-axis is determined based on the midpoint of the common perpendicular segment. With the B-axis fixed at a non-zero angle, the C-axis is rotated a full revolution. Verification images of the standard sphere are acquired by a monocular camera at various angles. The center of the standard sphere at each angle is determined based on the outline of the standard sphere extracted from each verification image. The verification coordinates in the machine tool coordinate system are used, and a verification trajectory circle is fitted based on the verification coordinates at each angle. The direction of the rotation axis of the C-axis is determined based on the verification trajectory circle. The direction of the rotation axis of the C-axis obtained by re-measuring the full rotation of the C-axis is compared with the direction of the rotation axis of the C-axis when it is at zero position to obtain the included angle residual. If the included angle residual is less than or equal to the preset kinematic chain verification threshold, the kinematic chain of the B-axis and C-axis is determined to be correct, and the inter-axis offset and rotation center are written into the CNC system of the machine tool. If the included angle residual is greater than the kinematic chain verification threshold, it is determined that the B-axis and C-axis are not orthogonal or the rotary table assembly is tilted, the cause is diagnosed, and the user is prompted to check.

[0008] According to a second aspect of this application, a machine tool is also provided, comprising a machine tool body, a spindle, a rotary table, a monocular camera device, a standard ball, and a CNC system; the rotary table includes a B-axis and a C-axis, the C-axis being mounted on the B-axis and tilting with the rotation of the B-axis, the B-axis being arranged around the Y-axis direction of the machine tool, and the C-axis being arranged around the Z-axis direction of the machine tool; the spindle is configured to perform linear feed only along the X-axis, Y-axis, and Z-axis directions of the machine tool; the monocular camera device is fixedly mounted on a stationary structure of the machine tool body; the standard ball is clamped in the rotary table; the CNC system is configured to perform the steps of the monocular vision rotary axis calibration method based on machine tool motion according to an embodiment of this application.

[0009] According to a third aspect of this application, a computer-readable storage medium is also provided, on which a computer program or instructions are stored, wherein when executed by a processor, the computer program or instructions implement the steps of the monocular vision rotary axis calibration method based on machine tool motion according to an embodiment of this application.

[0010] According to a fourth aspect of this application, a computer program product is also provided, including a computer program or instructions, which, when executed by a processor, implement the steps of the monocular vision rotary axis calibration method based on machine tool motion according to an embodiment of this application.

[0011] According to some embodiments of this application, the center of a standard ball clamped on a rotary table is used as the sole reference feature. The rotary motion of the rotary table is converted into a coordinate sequence of the ball's center in the machine tool coordinate system. The coordinate sequence is used to fit the trajectory circles of the B-axis and C-axis respectively. The center and normal of the trajectory circles give the direction and position of the two rotation axes. The common perpendicular segment of the two rotation axes gives the inter-axis offset and rotation center between the two axes, so that the offset of the two rotation axes when they do not intersect in the assembly is explicitly preserved. The coordinates of the ball's center are determined by the contour of the standard ball using the eigenvalue decomposition of the quadratic form of the view cone, without the need for a second camera or depth sensor. When the B-axis is fixed at a non-zero angle, the re-measurement of the C-axis direction converts the correctness of the kinematic chain into an angle that can be compared with a threshold. The parameters are written based on the confidence level and the kinematic chain verification results. The calibration results are completed for accuracy evaluation and verification before entering the CNC system. Attached Figure Description

[0012] 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:

[0013] Figure 1 A flowchart illustrating a monocular vision rotary axis calibration method based on machine tool motion according to an embodiment of this application is shown.

[0014] Figure 2 A schematic diagram of the structure of a machine tool according to an embodiment of this application is shown. Detailed Implementation

[0015] 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.

[0016] 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.

[0017] 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.

[0018] To facilitate understanding, the following terms are explained first. The machine tool coordinate system refers to a three-dimensional Cartesian coordinate system with the mechanical zero point of each feed axis of the machine tool as the origin and the guide rail direction of each feed axis as the coordinate axis direction. The camera coordinate system refers to a three-dimensional Cartesian coordinate system with the optical center of the monocular camera device as the origin and the optical axis direction as the depth direction. Intrinsic parameters refer to parameters describing the imaging geometry of the monocular camera device itself, including pixel focal length, principal point coordinates, and lens distortion coefficients. Distortion has been corrected according to the intrinsic parameter calibration results before edge extraction. Extrinsic parameters refer to parameters describing the relative pose between the camera coordinate system and the machine tool coordinate system, including rotation matrices and translation vectors. Forward kinematics refers to the analytical calculation process of deducing the position of a specified point in the machine tool coordinate system from the coordinate readings of each axis according to the geometric relationship and sequence of the machine tool axes. It only uses encoder readings and the structural constants of the machine tool and does not include quantities estimated from image features.

[0019] A monocular camera device refers to a camera consisting only of an imaging lens and an image sensor, which is fixedly mounted on a static structure of the machine tool body. A static structure refers to a component that does not move with the spindle or rotate with the rotary table during machining and measurement, such as the bed, column, or support within the machine tool cavity. The machine tool in this embodiment has a rotary table structure: the B-axis is positioned below the Y-axis of the machine tool, and the C-axis is positioned above the B-axis, rotating around the Z-axis of the machine tool. The C-axis tilts as the B-axis rotates, and the spindle only performs linear feed along the X, Y, and Z axes. Because the spindle only performs linear feed and the rotary axis only drives the workpiece, the tool tip does not oscillate with the B and C axes. Therefore, the observation object of the rotary trajectory should not be the tool tip point set, but rather the center of the standard ball clamped on the rotary table.

[0020] A standard sphere is a precision sphere whose sphericity has been verified and whose radius is known. It is clamped on the C-axis and rotates together with the C-axis and B-axis, with the center of the sphere maintaining a fixed eccentric relationship with the axis of rotation. The trajectory circle is the circle drawn in space by the center of the standard sphere under the influence of the axis of rotation. Its center is located on the axis of rotation, and the normal of its surface is parallel to the direction of the axis of rotation.

[0021] Machine reference marks refer to marks that are fixedly installed on the static structure of the machine tool body. The coordinates of each corner point of the machine tool are pre-calibrated and stored in the machine tool coordinate system and do not change with the rotation of the B-axis and C-axis or any movement during the measurement process. Machine reference marks and standard balls clamped on the rotary table are two objects with different purposes. The former is only used to obtain the external parameters between the monocular camera device and the machine tool, while the latter is only used for the calibration of the rotation axis parameters. The image features of the two are not mixed.

[0022] The common perpendicular segment refers to a line segment that is perpendicular to both axes of rotation, with both ends falling on the two axes of rotation respectively. Its length is the shortest distance between the two axes of rotation. Axis offset refers to the length of the common perpendicular segment. The center of rotation is the point determined by the midpoint of the common perpendicular segment, representing the center of rotation of the B-axis and C-axis in the forward kinematics of the machine tool. When the two axes intersect, the length of the common perpendicular segment is zero, and its midpoint is the intersection point of the two axes, called the common pivot point. When the two axes do not intersect, the midpoint is not on either axis of rotation, and this is called the equivalent center of rotation.

[0023] The kinematic chain verification threshold refers to the upper limit of the angle used to determine whether the kinematic chain between the B-axis and C-axis is correct. The included angle residual refers to the angle between the direction of the rotation axis obtained from the full revolution remeasurement of the C-axis and the direction of the rotation axis when the C-axis is at zero position. The observation covariance refers to the covariance matrix of the observed quantity, namely the coordinates of the center of the standard sphere in the machine tool coordinate system. It is synthesized from the covariance of image measurement noise, the covariance of encoder errors of each axis of the machine tool, and the covariance of camera extrinsic parameters. The standard uncertainty refers to the standard deviation of a parameter to be calibrated, obtained through error propagation from the observation covariance. The confidence level refers to the level assigned to the parameter to be calibrated based on the standard uncertainty. The target uncertainty is the upper limit of uncertainty required to be achieved before the calibration result is written into the CNC system.

[0024] Zero position refers to the angular position where the coordinate readings of both the B-axis and C-axis are zero. The first coordinate refers to the sphere center coordinates calculated from the B-axis image when the B-axis rotates alone and the C-axis is fixed at zero position; the second coordinate refers to the sphere center coordinates calculated from the C-axis image when the C-axis rotates alone and the B-axis is fixed at zero position; the verification coordinate refers to the sphere center coordinates calculated from the verification image when the B-axis is fixed at a non-zero angle. The CNC system refers to the controller in the machine tool that executes the machining program, issues position commands to each axis driver, and stores the machine tool's structural parameters. The six parameters obtained from calibration are converted and written into this controller, which then directly uses them in interpolation and five-axis transformation.

[0025] The flow of the above quantities between steps is as follows: the first and second coordinates flow to the trajectory circles of the B-axis and C-axis respectively; the center and normal of the two trajectory circles flow to the solution of the common perpendicular segment; the length and midpoint of the common perpendicular segment flow to the determination of the rotation center and the writing to the CNC system; the verification coordinates flow to the verification trajectory circle, and its normal, after being mapped back to the zero-position machine tool coordinate system by the transpose of the rotation matrix, flows to the included angle residual; the covariance flows to the standard uncertainty of the six parameters, and the standard uncertainty flows to the confidence level and the writing judgment; after writing, the six parameters determine the position under any swing angle in the forward kinematics solution of the CNC system.

[0026] Figure 1 A flowchart illustrating a monocular vision rotary axis calibration method based on machine tool motion according to an embodiment of this application is shown.

[0027] like Figure 1 As shown, the monocular vision rotary axis calibration method based on machine tool motion according to the embodiments of this application may include steps S110 to S200.

[0028] In step S110, the B-axis is rotated to multiple angles while the C-axis is fixed at zero. At each angle, the B-axis image of the standard sphere is acquired by a monocular camera. Based on the contour of the standard sphere extracted from each B-axis image, the first coordinate of the center of the standard sphere in the machine coordinate system at each angle is determined. The trajectory circle of the B-axis is then fitted based on the first coordinate at each angle.

[0029] In some embodiments, the first coordinate refers to the three-dimensional coordinate of the center of the standard sphere in the machine tool coordinate system, which is derived from the B-axis image at various angles and is used for fitting the B-axis trajectory circle in step S130. The calculation of the first coordinate includes three steps in sequence: the direction of the sphere center, the distance of the sphere center, and the coordinate transformation. The three steps are given by equations (1) to (4) respectively.

[0030] In some embodiments, after subpixel edge extraction of the contour of the standard sphere and fitting the extracted edge points to the contour ellipse, the equation of the contour ellipse is written in a quadratic form in homogeneous coordinates, and its coefficient matrix is ​​shown in equation (1).

[0031] ,

[0032] (1)

[0033] In equation (1), , These are the pixel coordinates of the subpixel edge points on the image, in pixels. , , , , , The coefficients of the quadratic curve of the contour ellipse are given by the ellipse fitting of the sub-pixel edge points; Let be the quadratic curve matrix of the contour ellipse in pixel coordinates, and be a third-order real symmetric matrix.

[0034] In some embodiments, the quadratic curve matrix is ​​combined with the intrinsic parameters of the monocular camera device to obtain a first conic quadratic form, as shown in equation (2).

[0035] (2)

[0036] In equation (2), This is the third-order intrinsic parameter matrix of a monocular camera device; , Focal length in pixels; , Principal point coordinates, in pixels; for transpose; This is the first quadratic form of the view cone, that is, the third-order real symmetric matrix of the view cone surface in the camera coordinate system, and the points on the cone surface. satisfy .

[0037] In some embodiments, the eigenvalue decomposition of the quadratic cone is performed to obtain the direction of the first sphere center and the first half-angle of the cone, as shown in equation (3).

[0038] (3)

[0039] In equation (3), The eigenvalues ​​that have the opposite sign to the other two eigenvalues; To and The corresponding unit eigenvector, i.e. the direction of the first sphere center, is dimensionless and is taken as the side that makes the sphere center lie in front of the optical center. , Two eigenvalues ​​with the same sign , This is the corresponding unit eigenvector; The first half-angle of the visual cone, in radians; This indicates taking the absolute value. This represents the square root. The scale of a quadratic curve matrix is ​​arbitrary, and the values ​​of its eigenvalues ​​vary. The normalization method has changed, but and The ratio remains unchanged, therefore the first cone half-angle is equal to... It is unrelated to the scale.

[0040] In some embodiments, the first distance is determined by the first half-angle of the first view cone and the known radius of the standard sphere, and then the coordinates of the sphere center in the camera coordinate system are determined by the first distance and the direction of the first sphere center. The coordinates are then converted into the first coordinates according to the external parameters, as shown in equation (4).

[0041] (4)

[0042] In equation (4), The first distance is the distance from the center of the sphere to the center of the light, measured in millimeters. The radius of a standard sphere is known, in millimeters. It is the sine; The coordinates of the sphere's center in the camera coordinate system are in millimeters. The first coordinate of the sphere's center in the machine tool coordinate system is expressed in millimeters. Let be the rotation matrix from the camera coordinate system to the machine tool coordinate system, which is dimensionless; The corresponding translation vector is in millimeters. The first distance is given by the ratio of the known radius of the standard sphere to the sine of the half-angle of the view cone, indicating that monocular imaging itself does not provide depth; depth information comes from the known scale of the radius of the standard sphere.

[0043] In some embodiments, the trajectory circle of the B-axis is fitted according to the first coordinate at each angle, as shown in Equation (5).

[0044] (5)

[0045] In equation (5), For the first The first coordinate at each angle Take 1 to , This represents the number of rotation angles along the B-axis. The center of the circle tracing the B-axis is given in millimeters. The radius of the trajectory circle is in millimeters. The unit normal to the plane containing the trajectory circle is the direction of the rotation axis of B-axis, which is dimensionless. Describing the Euclidean norm, Indicates the inner product; Indicates to , , Take the minimum value. This indicates a constraint condition.

[0046] In some embodiments, the constraint of equation (5) requires all first coordinates to be strictly coplanar. The measured data contains noise and is difficult to strictly satisfy. Therefore, it is solved in two steps: plane fitting and in-plane circle fitting, as shown in equation (6).

[0047] (6)

[0048] In equation (6), For the first The first coordinate at each angle Take 1 to , This represents the number of rotation angles along the B-axis. The arithmetic mean of the first coordinates, in millimeters; Let be the unit normal of the plane to be determined. Let represent the independent variable that minimizes the objective function. Take the eigenvector corresponding to the smallest eigenvalue of the covariance matrix of the point set with the first coordinate. The center of the circle tracing the B-axis is given in millimeters. The radius of the trajectory circle is in millimeters. , To fit two orthogonal unit basis vectors in the plane; , For the first The projected coordinates of the first coordinate in the plane, in millimeters, are derived from... and Give; Let A be the coefficient matrix, and let A be the first... Behavior , Let b be a column vector of constant terms. The elements are ; , , The equation for fitting a circle in the plane The coefficient; , The coordinates of the center of the circle in the plane are in millimeters. This represents finding the inverse of a matrix.

[0049] This step determines the first coordinates by using the outline of the standard sphere and the cone model, so that the three-dimensional coordinates of the sphere's center can be solved from a single image. It does not require feature matching between multiple viewpoints, nor does it replace the projection point of the sphere's center with the center of the outline ellipse, thus eliminating the perspective deviation introduced by replacing the projection point of the sphere's center with the center of the ellipse. The standard sphere is clamped on the turntable, and its center position only changes with the rotation of the turntable. The rotation error of the spindle and the clamping error of the tool are not included in this coordinate sequence.

[0050] In step S120, the C-axis is rotated to multiple angles with the B-axis fixed at zero. At each angle, the C-axis image of the standard sphere is acquired by a monocular camera. Based on the outline of the standard sphere extracted from each C-axis image, the second coordinate of the center of the standard sphere in the machine coordinate system at each angle is determined. The trajectory circle of the C-axis is then fitted based on the second coordinate at each angle.

[0051] In some embodiments, the second coordinate is determined in the same way as the first coordinate, except that the C-axis rotates separately during sampling and the B-axis is fixed at zero. Therefore, the intrinsic and extrinsic parameters in equations (1) to (4) and the standard sphere radius take the same set of values. The first coordinate in equations (5) and (6) is replaced with the second coordinate, and the sampling angle of the B-axis is replaced with the sampling angle of the C-axis. The source of the second coordinate is the C-axis image at each angle.

[0052] In some embodiments, the B-axis and C-axis are rotated and acquired in a time-division manner, and the two sets of images do not overlap. Each of the two trajectory circles is generated by the rotational motion of only one axis.

[0053] This step, through axis rotation and axis fitting, ensures that the trajectory circle of the B-axis is generated only by the rotation of the B-axis, and the trajectory circle of the C-axis is generated only by the rotation of the C-axis. The positioning error and backlash of one axis will not be superimposed on the trajectory circle of the other axis. The fitting results of the two trajectory circles are independent of each other, and the specific axis can be located when an anomaly occurs.

[0054] In step S130, the direction and center of the rotation axis of the B-axis are determined based on the trajectory circle of the B-axis.

[0055] In some embodiments, the direction of the rotation axis of the B-axis is taken as the normal to the circular surface of the trajectory circle, which is defined as the unit normal to the plane on which the trajectory circle is located; the center of the rotation axis of the B-axis is taken as the center of the trajectory circle, which is defined as a point equidistant from each other on the trajectory circle, whose position in the axial direction is determined by the plane on which the trajectory circle is located, and whose location and direction are the same.

[0056] In some embodiments, there is a one-to-one correspondence between the trajectory circle and the axis of rotation: the center of the trajectory circle is located on the axis of rotation, and the normal of the trajectory circle is parallel to the direction of the axis of rotation. Therefore, the direction and position of the axis can be given simultaneously by a single trajectory circle, without the need to clamp a test bar separately or find a reference separately.

[0057] This step simultaneously provides the position and direction of the rotation axis by using the center of the trajectory circle and the normal of the circle surface, so that the five geometric degrees of freedom of the rotation axis are determined by a single trajectory circle. The fitting residual is also a diagnostic quantity. A large residual indicates that the standard ball's clamp is loose, the clamping eccentricity has changed, the positioning error and reverse clearance of the axis are too large, or there is an abnormality in the extraction of the ball's center.

[0058] In step S140, the direction and center of the rotation axis of the C-axis are determined based on the trajectory circle of the C-axis.

[0059] In some embodiments, the direction of the rotation axis of the C-axis and the definition, origin and destination of the center are the same as in step S130. The difference is that it is based on the trajectory circle of the C-axis, and the direction and center are expressed in the machine tool coordinate system when the B-axis is at zero position.

[0060] In some embodiments, the normal of the circular surface of the C-axis trajectory circle is measured when the B-axis is at zero position, so it is only consistent with the actual rotation direction of the C-axis in that pose; when the B-axis rotates, the C-axis direction tilts along with the B-axis, and this relationship is described by the following formula (10), and is independently determined by the verification image in steps S160 to S180.

[0061] This step ensures that the direction of the C-axis rotation axis and the center of the circle are determined once by a single trajectory circle; since the results of the two axes belong to two batches of data, the comparison of the two simultaneously constitutes a verification of the split-axis sampling method.

[0062] In step S150, the common perpendicular segment between the rotation axis of B-axis and the rotation axis of C-axis is obtained, the length of the common perpendicular segment is determined as the interaxial offset between B-axis and C-axis, and the rotation center between B-axis and C-axis is determined according to the midpoint of the common perpendicular segment.

[0063] In some embodiments, the rotation axes of the B-axis and the C-axis generally do not intersect in space, and the relative geometric relationship between the two skew lines is fully expressed by the common perpendicular segment; the two ends of the common perpendicular segment fall on the two axes respectively, and its direction is perpendicular to the direction of the two axes at the same time, and its length is the shortest distance between the two axes.

[0064] In some embodiments, let the first perpendicular foot point be... The second foot of the perpendicular is The condition for the foot of the perpendicular segment is that the line connecting the two endpoints is perpendicular to the direction of both axes, as shown in equation (7).

[0065] (7)

[0066] In equation (7), , Let be the center and normal of the circle of trajectory along the B-axis, which has the same meaning as in equation (5); , Let C be the center and normal of the circle that traces the trajectory along the C-axis. As the first parameter, The second parameter, both in millimeters, represents the offset of the first and second perpendicular points relative to the center of the circle along their respective axial directions. , This is the transpose of the corresponding direction vector.

[0067] In some embodiments, [Note] , Equation (7) is transformed into two scalar equations, and their closed-form solutions are shown in equation (8).

[0068] (8)

[0069] In equation (8), The vector of the line connecting the centers of the two trajectory circles, in millimeters; It is the dot product of the direction vectors of the two axes, and its absolute value is no greater than one and is dimensionless. , The solution is the sum of the first and second parameters, expressed in millimeters. When the absolute value of approaches one, it means that the two axes are approaching parallelism. At this time, the denominator of equation (8) approaches zero, and it is treated as a parallel case: the inter-axis offset is taken as Perpendicular to The length of the component in the direction, i.e. Take the first foot of the perpendicular. Take the second foot of the perpendicular. .

[0070] In some embodiments, the length of the perpendicular segment and the midpoint are determined according to equation (9).

[0071] (9)

[0072] In equation (9), The length of the perpendicular segment, i.e., the interaxial offset between the B-axis and the C-axis, is expressed in millimeters. Let be the coordinates of the center of rotation in the machine tool coordinate system, in millimeters, taken as the midpoint of the common perpendicular segment. The inter-axis offset does not change with the selection of reference points on the two axes, and is therefore a reproducible geometric quantity; when the two axes intersect... Approaching zero When approaching the intersection point, the two axes do not intersect. It falls outside the two axes.

[0073] This step uses the common perpendicular line segment as the parameter to express the geometric relationship between the two rotation axes, so that the two axes intersect and do not intersect, and are covered by the same set of parameters; when the two axes do not intersect, the inter-axis offset is explicitly given and written into the CNC system, thus eliminating the systematic deviation introduced by the intersection assumption during large swing angle machining.

[0074] In step S160, with the B-axis fixed at a non-zero angle, the C-axis is rotated a full revolution. At each angle, a monocular camera device acquires verification images of the standard sphere. Based on the outline of the standard sphere extracted from each verification image, the verification coordinates of the center of the standard sphere in the machine tool coordinate system at each angle are determined. The verification trajectory circle is then fitted based on the verification coordinates at each angle.

[0075] In some embodiments, fixing the B-axis at a non-zero angle means locking the B-axis driver at a non-zero angle position, so that the zero position direction of the C-axis tilts as the B-axis rotates; in this state, the C-axis is driven to rotate a full revolution, and the normal direction of the circle drawn by the center of the ball is the direction of the rotation axis of the C-axis after tilting.

[0076] In some embodiments, the verification coordinates are determined according to equations (1) to (4), and the verification trajectory circle is fitted according to equations (5) and (6). The only difference is that the B-axis is at a non-zero angle during sampling. Therefore, the first coordinate in equations (5) and (6) is replaced with the verification coordinates, and the sampling angle of the B-axis is replaced with the rotation angle of the C-axis.

[0077] In some embodiments, the verification image belongs to a different sampling batch from each B-axis image and each C-axis image, and the three batches of images are not mixed. The clamping state of the same standard ball remains unchanged in the three samplings. The number of angles of the C-axis rotation is not less than three, and the beginning and end are connected to form a complete circle.

[0078] This step involves re-measuring the rotation axis of the C-axis when the B-axis is at a non-zero angle, so that the kinematic forward solution's prediction of the C-axis direction as the B-axis angle changes has a directly comparable measured object; this re-measuring reuses the same standard ball, the same monocular camera device, and the same set of thresholds, without introducing additional standard instruments and clamping procedures.

[0079] In step S170, the direction of the rotation axis of the C-axis is determined based on the verification trajectory circle.

[0080] In some embodiments, the C-axis direction determined by the verification trajectory circle is expressed at a fixed non-zero angle of the B-axis, and its relationship with the zero-position direction of the C-axis is shown in Equation (10).

[0081] (10)

[0082] In equation (10), The direction of the rotation axis of the C axis in the machine tool coordinate system when the B axis is at zero position is dimensionless. The B-axis is fixed at a non-zero angle. The expression of the C-axis direction in the machine tool coordinate system is dimensionless. This is the non-zero angle, expressed in radians; For the direction Rotation The rotation matrix is ​​dimensionless; It is a third-order identity matrix; For direction antisymmetric matrix, , , for Components on the three coordinate axes of the machine tool coordinate system; , Let be the sine and cosine. When the rotation axis of the B-axis coincides with the Y-axis of the machine tool coordinate system, equation (10) degenerates into a rotation matrix about the Y-axis. .

[0083] In some embodiments, in order to compare with the result when the axis is at zero position, the direction is mapped back to the machine coordinate system when the B axis is at zero position by transposing the rotation matrix in equation (10). The mapped direction is independent of the angle of the B axis and can be directly subtracted from the zero position direction.

[0084] This step maps the C-axis directions measured at different B-axis angles back to the same machine tool coordinate system, giving the two sets of measurement results a unified comparison benchmark. The mapping of directions only uses the coordinate readings of each axis and the pre-calibrated extrinsic parameters, without introducing image estimates, and the mapping itself does not generate new error sources.

[0085] In step S180, the direction of the rotation axis of the C-axis obtained by re-measuring the C-axis after a full rotation is compared with the direction of the rotation axis of the C-axis when it is at zero position to obtain the included angle residual.

[0086] In some embodiments, the included angle residual is calculated as the angle between two unit direction vectors, and its value is the inverse cosine of the product of the two dot vectors, as shown in equation (11).

[0087] (11)

[0088] In equation (11), The C-axis direction after mapping back to the zero-position machine tool coordinate system is dimensionless; for The transpose, i.e. The inverse matrix; The angle residual is expressed in radians, but can also be expressed in degrees. It is the inverse cosine. The included angle residual is a dimensionless angular quantity, and its value does not change with the diameter of the standard ball, the clamping eccentricity, or the machine tool's stroke. Therefore, it can be directly compared with the threshold given in angle.

[0089] This step uses the difference in direction of the same axis at two different B-axis angles as the criterion, compressing the combined effects of three types of problems—whether the two axes are orthogonal, whether there is tilt in the turntable assembly, and whether there is clearance in the transmission—into a single angle quantity. This angle quantity is obtained from two independent samplings and is not affected by the deviation in the extraction of the sphere center in a single sampling.

[0090] In step S190, if the included angle residual is less than or equal to the preset kinematic chain verification threshold, the kinematic chain between the B axis and the C axis is determined to be correct, and the inter-axis offset and rotation center are written into the CNC system of the machine tool.

[0091] In some embodiments, the kinematics verification threshold refers to the upper limit of the included angle on which the kinematics is judged to be correct. It is set according to the repeatability of the machine tool, the allowable tilt of the turntable assembly and the uncertainty of the measurement system. As some feasible methods, the kinematics verification threshold is taken as a value between 0.05 degrees and 0.1 degrees and is separated from the algorithm code in the form of a configuration file, which is convenient for adjustment according to the machine model.

[0092] In some embodiments, writing to the CNC system means converting the six parameters according to the parameter definition of the target controller and then writing them; the parameter definition of the target controller includes fields describing the position and direction of the rotation axis in the tilt working plane command and the five-axis transformation command. When the controller only supports a model with a single rotation center and does not support the existence of offset between two axes, in addition to writing the rotation center, it also outputs the value of the axis offset and the range of the impact of the offset on the accuracy of the five-axis transformation.

[0093] In some embodiments, after being written, the CNC system performs a forward kinematics solution according to equation (12), and the forward kinematics solution is used to interpolate the subsequent machining program, thereby allowing the six parameters to enter the actual motion control of the machine tool.

[0094] (12)

[0095] In equation (12), The coordinates of the standard sphere are the machine tool coordinates when the center of the sphere is at zero on both the B-axis and C-axis, in millimeters. , These are the angles along the B-axis and C-axis, respectively, in radians. and It is a rotation matrix that rotates about the rotation axes of B and C, and its form is the same as that of equation (10); For this point in any , Machine tool coordinates under angle, in millimeters. Equation (12) is the location of six parameters: the direction of the two axes and the center of the circle determine the base point of the rotating axis and the axis, the offset between the axes and the rotation center determine the relative position between the two axes, and the three together make the tool tip position and workpiece position under any swing angle directly calculated from the encoder reading.

[0096] This step binds the writing of calibration results and the verification of the kinematics chain under the same judgment. The parameters are only entered into the CNC system when the included angle residual meets the threshold, so that machine tools with kinematic chain problems will not enter the machining program with incorrect rotary axis parameters. After writing, the reading back and comparison avoid silent failure caused by abnormal writing channel.

[0097] In step S200, if the included angle residual is greater than the kinematic chain verification threshold, it is determined that the B-axis and C-axis are not orthogonal or the turntable assembly is tilted, the cause is diagnosed and the user is prompted to check.

[0098] In some embodiments, the cause of the fault is diagnosed by distinguishing the source of the fault according to the variation law of the included angle residual with the B-axis angle: when the included angle residual is in the same direction and the value is close at each B-axis angle, it is determined that the B-axis and C-axis are not orthogonal; when the included angle residual changes with the B-axis angle in a sinusoidal law with the same period as the B-axis angle, it is determined that the turntable assembly is tilted; when the included angle residual has opposite signs in the two rotation directions of the same angle, it is determined that there is a gap in the transmission; when the included angle residual does not conform to the above laws and the fitting residual of the verification coordinate is too large, it is determined that the standard ball clamp is loose or the ball center extraction is abnormal.

[0099] In some embodiments, prompting the user to check means outputting the included angle residual, the corresponding set of verification coordinates, the fitting residual of the verification trajectory circle and the diagnostic conclusion, and giving the links to be checked, including the cleanliness and tightness of the turntable assembly surface, the intersection of the two rotary axes, the backlash of the transmission and the clamping status of the standard ball fixture; if the included angle residual is greater than the kinematic chain verification threshold, the parameters obtained from this calibration will not be written into the CNC system.

[0100] This step identifies the source of the fault based on the variation of the residual with the angle when the included angle residual exceeds the limit. This allows for the differentiation of three different types of problems, such as tilting of the turntable assembly, non-orthogonality of the two axes, and transmission clearance, rather than simply indicating calibration failure. At the same time, it prohibits writing parameters that have not passed verification into the CNC system, ensuring that the reliability of the calibration results is determined before they are written.

[0101] According to the monocular vision rotary axis calibration method based on machine tool motion according to the embodiments of this application, through the coordinated operation of the above steps S110 to S200, the calibration of two rotary axes of the turntable can be completed without using standard inspection bars, dial indicators, ball bars and laser interferometers, provided that only one monocular camera device and one standard ball are added. The axis sampling and axis fitting trajectory circle make the direction and position of the two rotary axes given by their respective data streams. The extraction of the ball center coordinates takes the outline of the standard ball as the object, and the spindle and the tool do not enter the calibration data stream. The common perpendicular segment makes the inter-axis offset when the two axes do not intersect explicitly given, and the forward kinematic solution no longer requires the two axes to intersect as a premise. The retest of the C-axis direction when the B-axis is fixed at a non-zero angle makes the correctness of the kinematic chain an angle quantity that can be compared with the threshold. The calibration result is verified before being written into the CNC system.

[0102] According to some embodiments of this application, the step of determining the first coordinate of the center of the standard sphere in the machine tool coordinate system at each angle based on the outline of the standard sphere extracted in each B-axis image includes steps S2.11 to S2.15.

[0103] In step S2.11, subpixel edge extraction is performed on the contour of the standard sphere in each B-axis image, and the contour ellipse is fitted.

[0104] In some embodiments, subpixel edge extraction refers to the process of interpolating or calculating gray-level moments between pixel-level edge positions according to the gradient direction of image gray levels, so that the coordinates of the edge positions are accurate to less than one pixel. The imaging edge of a standard sphere is formed by the transition between light and dark between the sphere and the background, and its gray-level profile is approximately symmetrical, so the subpixel coordinates of the edge positions can be given by the gray-level centroid. The contour ellipse refers to the ellipse obtained by fitting a quadratic curve to the subpixel edge points, which aims to minimize the sum of squares of the weighted algebraic distances and applies discriminant constraints to the ellipse, as shown in Equation (13).

[0105] (13)

[0106] In equation (13), , For the first The pixel coordinates of sub-pixel edge points, in pixels; The weight of a point is given by the fact that points within the arc segment are assigned a value of 1, while points outside the arc segment are assigned a value of 0. , , , , , Let be the coefficient of the profile ellipse to be determined; Elliptic discriminant constraints are used to prevent the fitting results from degenerating into hyperbolas or parabolas; Let be the vector 2 norm, which is equal to 1 in order to eliminate the scaling degrees of freedom of the elliptic coefficients and make the solution unique.

[0107] In step S2.12, a quadratic curve matrix in the camera coordinate system of the monocular camera device is constructed from the contour ellipse fitted according to the B-axis image. The quadratic curve matrix is ​​combined with the intrinsic parameters of the monocular camera device to obtain the first visual cone quadratic form.

[0108] In some embodiments, the quadratic curve matrix refers to the third-order symmetric matrix used when writing the contour ellipse equation in homogeneous coordinates into a quadratic form. Its elements are given by the coefficients of equation (13) according to equation (1). The quadratic curve matrix is ​​combined with the intrinsic parameters according to equation (2) to obtain the first view cone quadratic form. The view cone refers to a cone surface with the optical center as its vertex and tangent to the standard sphere. The quadratic curve matrix is ​​the intercept of this cone surface on the image plane. The role of the intrinsic parameters is to map the intercept on the image plane to the cone surface in the camera coordinate system.

[0109] In some embodiments, before combining, the sub-pixel edge points are first subjected to distortion removal processing according to the radial distortion coefficient in the intrinsic parameters, so that the cone surface of the view frustum remains a quadratic surface in the camera coordinate system; the intrinsic parameters are calibrated and saved separately before calibration begins, and the entire set of samples uses the same set of intrinsic parameters.

[0110] In step S2.13, the first conic quadratic form is decomposed into eigenvalues ​​to obtain the first center direction of the standard sphere and the first half-angle of the conic.

[0111] In some embodiments, eigenvalue decomposition refers to the process of decomposing a third-order real symmetric view cone matrix into eigenvalues ​​and eigenvectors, the result of which is shown in equation (3); the cone axis direction is corresponding to one of the three eigenvalues ​​that has the opposite sign to the other two, so the eigenvector corresponding to the eigenvalue is taken as the first sphere center direction, and the angle between the cone axis and the generatrix of the cone surface is taken as the first view cone half angle.

[0112] In some embodiments, there are two ways to choose the sign of the feature vector. In this application, we uniformly choose one that makes the angle between the direction of the first sphere center and the positive direction of the optical axis of the camera coordinate system less than 90 degrees, so that the sphere center direction of the same batch of samples does not have a sign jump.

[0113] In step S2.14, based on the first half-angle of the first viewing cone and the known radius of the standard sphere, the first distance from the center of the standard sphere to the optical center of the monocular camera is determined.

[0114] In some embodiments, the first distance is determined by the first expression of equation (4), which is the known radius of the standard sphere divided by the sine of the first half-angle of the cone. This expression is derived from the geometric relationship that the perpendicular distance from the center of the sphere to the cone is equal to the radius when the sphere is tangent to the cone. The smaller the half-angle of the cone, the greater the distance corresponding to the same imaging size, and the accuracy of distance estimation decreases as the half-angle of the cone decreases.

[0115] In some embodiments, the radius of the standard sphere is given by its calibration certificate and is input as a known quantity. The radius-related error is fixed before calibration begins and is not included in the calculation during the calibration process.

[0116] In step S2.15, based on the first distance and the first sphere center direction, the coordinates of the center of the standard sphere in the camera coordinate system of the monocular camera device are determined, and according to the external parameters between the monocular camera device and the machine tool coordinate system, the coordinates of the center of the standard sphere in the camera coordinate system are converted into the first coordinates of the center of the standard sphere in the machine tool coordinate system.

[0117] In some embodiments, the coordinates of the sphere center in the camera coordinate system are determined according to the second equation of equation (4), that is, the product of the first distance and the normalized first sphere center direction; the first coordinates are determined according to the third equation of equation (4), that is, first rotated by a rotation matrix and then translated by a translation vector. The source of the extrinsic parameters is the image measurement of the machine reference mark, and the method of obtaining them is as follows: extract the image coordinates of the corner points of the machine reference mark, project the pre-calibrated and saved corner point machine coordinates into the image according to the extrinsic parameters, and use the sum of squares of the projection error as the minimum solution pose.

[0118] In some embodiments, the machine reference mark and the standard sphere are two objects with different purposes; the former is used only for extrinsic parameters, and the latter is used only for rotation axis parameters. Extrinsic parameters can be obtained separately before calibration begins and reused in the entire set of samples, or they can be obtained in parallel with the sphere center extraction at each angle to compensate for extrinsic parameter drift caused by temperature changes. The first coordinate is used for fitting the B-axis trajectory circle in step S130.

[0119] This embodiment uses subpixel edge extraction, eigenvalue decomposition of the quadratic frustum, and the sphere radius to give the coordinates of the sphere center, enabling the monocular camera to provide three-dimensional coordinates with depth without the need for stereo matching, structured light, or multiple imaging. The smaller the half-angle of the frustum, the lower the accuracy of distance estimation. Therefore, during sampling, the standard sphere occupies a sufficient number of pixels in the image to increase the half-angle of the frustum.

[0120] The step of determining the second coordinates of the center of the standard sphere in the machine tool coordinate system at each angle based on the contour of the standard sphere extracted from each of the C-axis images includes steps S2.21 to S2.25.

[0121] In step S2.21, subpixel edge extraction is performed on the contour of the standard sphere in each C-axis image, and the contour ellipse is fitted.

[0122] In some embodiments, the subpixel edge extraction of the contour in the C-axis image and the fitting of the contour ellipse are the same as in step S2.11, except that the image is acquired under the condition of C-axis rotation and B-axis fixed at zero position; the C-axis image and the B-axis image share the same set of intrinsic parameters.

[0123] In step S2.22, a quadratic curve matrix in the camera coordinate system of the monocular camera device is constructed from the contour ellipse fitted according to the C-axis image. The quadratic curve matrix is ​​then combined with the intrinsic parameters of the monocular camera device to obtain the second visual cone quadratic form.

[0124] In some embodiments, the second conic quadratic form is constructed in the same way as the first conic quadratic form, and the two are obtained from their respective contour ellipses and the same set of intrinsic parameters according to equations (1) and (2), respectively; the two sets of conic quadratic forms do not share image data.

[0125] In step S2.23, the second conic quadratic form is decomposed into eigenvalues ​​to obtain the second center direction of the standard sphere and the second conic half-angle.

[0126] In some embodiments, the second sphere center direction and the second half-angle of the view cone are obtained by decomposing the second view cone quadratic form according to formula (3). The difference between them and the first sphere center direction and the first half-angle of the view cone is only that the orientation of the standard sphere in the camera coordinate system is different.

[0127] In step S2.24, based on the second half-angle of the visual cone and the known radius of the standard sphere, the second distance from the center of the standard sphere to the optical center of the monocular camera is determined.

[0128] In some embodiments, the second distance is determined by the second half-angle of the view cone and the known radius according to the first formula of (4), and its function is to restore the two-dimensional imaging size in the image to the three-dimensional distance in the camera coordinate system.

[0129] In step S2.25, based on the second distance and the second center direction, the coordinates of the center of the standard sphere in the camera coordinate system of the monocular camera device are determined, and according to the external parameters between the monocular camera device and the machine tool coordinate system, the coordinates of the center of the standard sphere in the camera coordinate system are converted into the second coordinates of the center of the standard sphere in the machine tool coordinate system.

[0130] In some embodiments, the second coordinate is determined according to the last two equations of equation (4), which is obtained by the same set of external parameters as the first coordinate. Therefore, the center coordinates of the two channels are in the same machine tool coordinate system, and the difference between the centers of the two trajectory circles has a direct geometric meaning. The second coordinate is used for fitting the C-axis trajectory circle in step S140.

[0131] The step of determining the verification coordinates of the center of the standard sphere in the machine tool coordinate system at each angle based on the contour of the standard sphere extracted from each of the verification images includes steps S2.31 to S2.35.

[0132] In step S2.31, subpixel edge extraction is performed on the contour of the standard sphere in each verification image, and the contour ellipse is fitted.

[0133] In some embodiments, the extraction of subpixel edges of the contour in the verification image and the fitting of the contour ellipse are the same as in step S2.11. Since the verification image is acquired under the condition that the B-axis is fixed at a non-zero angle, the position of the standard ball in the image is different from that when the B-axis is at zero. Before acquisition, the field of view or the docking position of the main axis is adjusted according to the predicted position of the standard ball so that the standard ball is kept in the central region of the image.

[0134] In step S2.32, a quadratic curve matrix in the camera coordinate system of the monocular camera device is constructed from the contour ellipse fitted according to the verification image. The quadratic curve matrix is ​​combined with the intrinsic parameters of the monocular camera device to obtain the third visual cone quadratic form.

[0135] In some embodiments, the third view cone quadratic form is constructed from the contour ellipse of the verification image and the same set of intrinsic parameters according to equations (1) and (2). The three view cone quadratic forms share the same set of intrinsic parameters and the same set of extrinsic parameters, so that the center coordinates of the three batches of samples have a unified uncertainty level.

[0136] In step S2.33, the eigenvalue decomposition of the third cone quadratic form is performed to obtain the direction of the third sphere center and the third cone half angle of the standard sphere.

[0137] In some embodiments, the direction of the third sphere center and the third half-angle of the third cone are obtained by decomposing the third cone quadratic form according to equation (3); when the B-axis is at a non-zero angle, the position of the standard sphere relative to the monocular camera device changes, and the difference between the third half-angle of the third cone and the first half-angle of the first cone reflects this change.

[0138] In step S2.34, based on the third half-angle of the visual cone and the known radius of the standard sphere, the third distance from the center of the standard sphere to the optical center of the monocular camera is determined.

[0139] In some embodiments, the third distance is determined by the third cone half-angle and the known radius according to the first formula of equation (4), and the difference between the third distance and the first distance is used to check whether the standard ball has become loose during the sampling process.

[0140] In step S2.35, based on the third distance and the third sphere center direction, the coordinates of the standard sphere center in the camera coordinate system of the monocular camera device are determined, and according to the external parameters between the monocular camera device and the machine tool coordinate system, the coordinates of the standard sphere center in the camera coordinate system are converted into the verification coordinates of the standard sphere center in the machine tool coordinate system.

[0141] In some embodiments, the verification coordinates are determined according to the last two equations of equation (4), which are obtained by conversion from the same set of external parameters as the first coordinates and the second coordinates. Therefore, the verification trajectory circle obtained by fitting the verification coordinates has a geometric meaning that can be directly compared with the trajectory circle when the axis is at zero position.

[0142] This embodiment enables the three measurement channels—B-axis image, C-axis image, and verification image—to share the same subpixel edge extraction method, the same set of intrinsic parameters, the same set of extrinsic parameters, and the same set of formulas. The sphere center coordinates of the three samples have a consistent measurement caliber and uncertainty level. Thus, the sphere center coordinates of the three channels can be directly compared and verified with each other.

[0143] According to some embodiments of this application, when determining the coordinates of the center of the standard sphere in the machine tool coordinate system at each angle based on the outline of the standard sphere extracted from each B-axis image, each C-axis image, or each verification image, the method further includes steps S3.1 to S3.4.

[0144] In step S3.1, if there is an angle that partially obscures the standard sphere, determine whether the central angle span of the visible arc segment of the standard sphere is greater than or equal to 180 degrees.

[0145] In some embodiments, partial occlusion means that the tool, spindle end face, fixture or other components on the turntable block a part of the standard sphere at a certain angle, so that the spherical outline in the image is no longer closed; the visible arc segment refers to the part of the outline that is not occluded; the central angle span refers to the angle between the two endpoints of the arc segment and the center of the outline, as shown in Equation (14).

[0146] (14)

[0147] In equation (14), , The pixel coordinates of the two endpoints of the visible arc segment; The pixel coordinates of the center of the outline ellipse; The span of the central angle is expressed in radians; 180 degrees corresponds to... Radius. The contour is imaged as an ellipse in the image, therefore... It is a measurable substitute for the central angle of the arc segment: when the image is close to a circle. When the central angle of the arc segment is equal to the arc segment, the image is an ellipse. There is a deviation between the central angle of the arc segment and the ellipse, which is determined by the ratio of the major and minor axes of the ellipse. This deviation is limited during sampling by making the standard sphere as close to the optical axis as possible.

[0148] In some embodiments, whether the central angle span is greater than or equal to 180 degrees determines whether the visible arc segment contains the complete half-circle of the contour; the center of the contour ellipse is given by the fitting result after removing outlier edge points, so this judgment is completed simultaneously with the fitting of equation (13).

[0149] In step S3.2, when the central angle span of the visible arc segment is greater than or equal to 180 degrees, the visible arc segment is fitted to obtain the coordinates of the center of the standard sphere in the machine tool coordinate system at that angle.

[0150] In some embodiments, fitting the visible arc segment means taking the sub-pixel edge points on the visible arc segment as input to Equation (13), taking zero weights outside the arc segment, and recovering the center of the sphere using the known radius of the standard sphere: when the visible arc segment is not less than half a circumference, the five parameters of the contour ellipse are still fully constrained, and the coordinates of the center of the sphere can be determined according to Equations (1) to (4).

[0151] In some embodiments, when the central angle span of the visible arc is slightly greater than 180 degrees, the fitting result is more sensitive to the distribution of edge points. In this case, the observation covariance of the sphere center coordinates at this angle is used as a weight to participate in the trajectory circle fitting, so that the influence of the sphere center coordinates of the shorter arc segment on the fitting result is automatically reduced.

[0152] In step S3.3, if the central angle span of the visible arc segment is less than 180 degrees, the image of the standard sphere at that angle is reacquired.

[0153] In some embodiments, re-acquisition refers to re-imaging without changing the coordinate readings of each axis at that angle. Its purpose includes eliminating occasional factors such as instantaneous reflections, debris and glare in the image, and eliminating fixed obstructions by adjusting the exposure time, light source brightness or the installation angle of the monocular camera. The re-acquisitioned image still extracts the center coordinates of the sphere in the manner of steps S2.31 to S2.35, and the central angle span is determined again according to formula (14).

[0154] In step S3.4, if the central angle span is still not satisfied after re-acquisition, the tool with the calibrated tool length is used to lightly touch the surface of the standard ball, and the surface of the standard ball is fitted by each contact point to obtain the coordinates of the center of the standard ball in the machine tool coordinate system at that angle.

[0155] In some embodiments, a tool with a calibrated tool length refers to a tool whose tool length and diameter have been determined according to the previous tool setting process and written into the CNC system; a light touch refers to bringing the tool close to the surface of a standard ball with a pre-set small indentation amount or a pre-set upper limit of contact force. The contact determination method includes using sudden changes in the load current of each axis, sudden changes in the amplitude of the acoustic emission signal, or pauses in coordinate readings as triggering conditions.

[0156] In some embodiments, spherical fitting uses the three coordinates of the sphere center as parameters and the sum of the squares of the differences between the distances from each contact point to the sphere center and the known radius as the minimum solution, as shown in Equation (15). The coordinates of the contact points are obtained by converting the coordinates of the tool tip in the machine tool coordinate system. The sphere center can be uniquely determined by three non-collinear contact points, and the fourth or more contact points are used for residual checking.

[0157] (15)

[0158] In equation (15), For the first The coordinates of each contact point in the machine tool coordinate system, in millimeters; Let be the coordinates of the center of the sphere to be determined in the machine tool coordinate system, in millimeters; The radius of a standard sphere is known, in millimeters. Take 1 to 4 or more. Indicates to Take the minimum value; the radius is fixed as a known quantity and is not included in the solution, so that the number of contact points can be reduced to three.

[0159] This step handles partial occlusion in stages according to the central angle span of the visible arc segment: if the arc segment is not less than half a circumference, it is directly fitted; if the arc segment is less than half a circumference, it is first attempted to re-acquire to avoid clamping and contact processes. Only when re-acquisition still cannot meet the requirements is the contact measurement performed with a tool with a calibrated tool length and the spherical surface is fitted from the contact point; the radius of the standard sphere is used as a known constraint to participate in the fitting, so that a few contact points can provide three-dimensional coordinates, and the calibration process will not be interrupted due to individual angles being occluded.

[0160] According to some embodiments of this application, the steps of determining the direction and center of the rotation axis of the B-axis based on the trajectory circle of the B-axis, and determining the direction and center of the rotation axis of the C-axis based on the trajectory circle of the C-axis, include steps S4.1 to S4.2.

[0161] In step S4.1, the center of the trajectory circle of the B-axis is taken as the center of the rotation axis of the B-axis, and the normal of the trajectory circle of the B-axis is taken as the direction of the rotation axis of the B-axis.

[0162] In some embodiments, the normal to the trajectory circle refers to the unit normal of the plane containing the fitted circular surface, which is parallel to the direction of the rotation axis. The sign of the direction is unified to ensure that the angle between the normal and the positive vertical direction of the machine tool coordinate system is less than 90 degrees, so that the direction of the same batch of samples does not have a sign jump. The center of the trajectory circle refers to the foot of the perpendicular from the center of the sphere to the rotation axis, which falls on the rotation axis. Therefore, the center of the circle and the normal together give the direction and position of the rotation axis.

[0163] In some embodiments, the direction of the center of the circle along the axis of rotation is not unique: the center of the circle can be translated any distance on the axis and still fall on the axis. Therefore, the center of the circle on the axis of rotation only represents a point on the axis, and its position along the axis direction is determined by the plane in which the trajectory circle is located. This plane is also the plane of rotation of the standard sphere during sampling.

[0164] In step S4.2, the center of the trajectory circle of the C-axis is taken as the center of the rotation axis of the C-axis, and the normal of the trajectory circle of the C-axis is taken as the direction of the rotation axis of the C-axis.

[0165] In some embodiments, the correspondence between the trajectory circle of the C-axis and the rotation axis of the C-axis is the same as in step S4.1; since the trajectory circle of the C-axis is measured under the condition that the B-axis is fixed at zero position, the direction and the center of the circle are expressed in the machine tool coordinate system when the B-axis is at zero position, and are used to solve the common perpendicular line segment of equations (7) to (9).

[0166] This step ensures that the direction of the rotation axis and the center of the circle are given at the same time using the same set of sphere center coordinates: the direction is taken from the normal of the trajectory circle, and the center is taken from the center of the trajectory circle, with no dependency on the calibration order between the two; since the center and the normal are obtained by fitting the same batch of data, the correlation between the position and direction of the rotation axis is preserved and can be used for subsequent uncertainty propagation.

[0167] According to some embodiments of this application, the steps of obtaining the common perpendicular line segment between the rotation axis of B-axis and the rotation axis of C-axis, determining the length of the common perpendicular line segment as the inter-axial offset between B-axis and C-axis, and determining the rotation center between B-axis and C-axis based on the midpoint of the common perpendicular line segment include steps S5.1 to S5.7.

[0168] In step S5.1, a first perpendicular foot point is set on the rotation axis of B-axis. The first perpendicular foot point is obtained by offsetting the center of the rotation axis of B-axis by a first parameter along the direction of the rotation axis of B-axis.

[0169] In some embodiments, the first foot of the perpendicular refers to the endpoint of the common perpendicular segment on the axis of rotation of the B-axis, which is written as equation (7). Since the center of the axis of rotation only represents a point on the axis, and its position in the direction of the axis is arbitrary, the first foot of the perpendicular is represented by an undetermined first parameter offset from the center of the perpendicular along the direction of the axis. The introduction of the first parameter changes the solution of the foot of the perpendicular from geometric construction to the solution of two scalar unknowns.

[0170] In step S5.2, a second perpendicular point is set on the rotation axis of the C-axis. The second perpendicular point is obtained by offsetting the center of the rotation axis of the C-axis by a second parameter along the direction of the rotation axis of the C-axis.

[0171] In some embodiments, the second perpendicular point is written in the same manner as in step S5.1. When the two perpendicular points are located on two axes of rotation respectively, and the line connecting them is perpendicular to both axes, the line is called the common perpendicular segment.

[0172] In step S5.3, constraint equations are established for the first and second parameters, with the line connecting the first and second perpendicular points being perpendicular to both the rotation axis of B-axis and the rotation axis of C-axis.

[0173] In some embodiments, the constraint equations are established as follows: the inner product of the line connecting the perpendicular feet and the directions of the two axes is zero, resulting in two linear equations about the first parameter and the second parameter, namely equation (7); the coefficient matrix of this system of equations is determined only by the directions of the two axes and the center of the circle, so its solution is unique and there is no need for iteration or initial values.

[0174] In some embodiments, when the directions of the two axes are approximately parallel, the coefficient matrix of equation (7) is close to singular, and its solution is extremely sensitive to direction errors. This case is solved according to the parallel case processing method given in equation (8), and the included angle between the directions of the two axes is less than the pre-set parallel criterion is used as the triggering condition.

[0175] In step S5.4, the constraint equations are solved to obtain the first parameter and the second parameter.

[0176] In some embodiments, the two linear equations are solved by Cramer's rule or by least squares, and their closed-form solutions are given by equation (8); the directions of the two axes are given by the normal of the trajectory circle and are both unit vectors, so that the coefficients of the system of equations have clear dimensions, and the dimensions of the first parameter and the second parameter are both lengths.

[0177] In step S5.5, the coordinates of the first perpendicular point in the machine tool coordinate system are determined according to the first parameter, and the coordinates of the second perpendicular point in the machine tool coordinate system are determined according to the second parameter.

[0178] In some embodiments, the coordinates of the two perpendicular points are obtained by vector addition of the corresponding center, direction, and parameters, i.e. and The coordinates of the perpendicular foot point are the endpoints of the common perpendicular segment, and they are involved in determining both the interaxial offset and the center of rotation.

[0179] In step S5.6, the length of the line connecting the first perpendicular point and the second perpendicular point is determined as the length of the common perpendicular segment, and the length of the common perpendicular segment is determined as the interaxial offset between the B-axis and the C-axis.

[0180] In some embodiments, the length of the common perpendicular segment is calculated by the Euclidean distance between the coordinates of the two perpendicular feet according to the first formula of (9); the interaxial offset is the numerical value of this length, which means the shortest distance between the two axes of rotation. When the two axes of rotation intersect, the length is zero, and when the two axes of rotation are parallel, the length is equal to the distance between the two axes.

[0181] In step S5.7, the midpoint of the line connecting the first perpendicular point and the second perpendicular point is determined as the rotation center between the B-axis and the C-axis.

[0182] In some embodiments, the midpoint is calculated by the arithmetic mean of the coordinates of the two perpendicular points according to the second equation of (9); the midpoint is located on the common perpendicular segment and not on either axis of rotation (except when the two axes intersect), so the center of rotation is the equivalent center used in the kinematics solution, rather than a solid point on the machine tool.

[0183] This embodiment transforms the solution of the common perpendicular segment into the solution of a system of linear equations with two scalar parameters, so that the position of the perpendicular foot point is given by the closed solution without the need for iteration; the directions of the two axes are given by the normal of the trajectory circle and are mutually independent observations, so that the value of the inter-axis offset does not change due to the selection of the center of the rotation axis circle, and the calibration results are reproducible.

[0184] According to some embodiments of this application, after determining the center of rotation between the B-axis and the C-axis based on the midpoint of the common perpendicular segment, the method further includes steps S6.1 to S6.2.

[0185] In step S6.1, if the inter-axis offset is less than or equal to a preset intersection threshold, it is determined that the B-axis and the C-axis intersect. The midpoint of the common perpendicular segment is determined as the rotation center. The rotation center is the intersection of the rotation axis of the B-axis and the rotation axis of the C-axis. The intersection point is the common pivot point.

[0186] In some embodiments, the intersection threshold refers to the upper limit of the length used to determine the intersection of two rotary axes. It is adjusted according to the assembly tolerance of the turntable, the repeatability of the rotary axes, and the uncertainty of the measurement system. As some feasible implementations, the intersection threshold is taken as a value between 0.01 mm and 0.05 mm. When the inter-axis offset is less than or equal to the intersection threshold, the two rotary axes intersect in terms of assembly tolerance, with the length of the common perpendicular segment approaching zero and its midpoint approaching the intersection point of the two axes.

[0187] In step S6.2, if the inter-axis offset is greater than the intersection threshold, it is determined that the B-axis and the C-axis do not intersect, and the midpoint of the common perpendicular segment is determined as the rotation center, which is the equivalent rotation center.

[0188] In some embodiments, when the interaxial offset is greater than the intersection threshold, the two rotation axes are skew lines and there is no common point on the two axes. In this case, the midpoint of the common perpendicular segment is taken as the rotation center. This point represents the rotation center of the two rotation axes in the forward kinematics solution. It does not correspond to any part surface on the machine tool in physical terms, so it is called the equivalent rotation center.

[0189] In some embodiments, the reasons why the two rotation axes do not intersect include the axial distance between the B-axis and C-axis of the turntable during assembly, the excessive degree of intersection of the two rotation axes, and the additional offset between the clamping eccentricity of the standard ball and the rotation axis; when the kinematics are solved according to the equivalent rotation center, the rotation radius and tilt of each of the two rotation axes are measured by the center respectively.

[0190] The equivalent rotation center is not on the rotation axis of the B-axis or the rotation axis of the C-axis, but is used only as the rotation center of the B-axis and C-axis in the forward kinematics of the B-axis and C-axis.

[0191] In some embodiments, the relationship between the equivalent rotation center and the two rotation axes is as follows: the sum of its distances to the two axes is equal to the interaxial offset, and the perpendiculars from it to the two axes are collinear, i.e., the common perpendicular segment; the use of this point is limited to the calculation of forward kinematics, inclined working plane parameters and five-axis transformation parameters, and it is not used as a physical reference that can be contacted on the machine tool for tool setting or edge finding.

[0192] In some embodiments, the equivalent rotation center exists in the CNC system as a parameter. Whenever the position calculation of the rotation center is required, this parameter is used in the calculation. However, when the solid geometry of the machine tool is referenced in the establishment of the workpiece coordinate system, tool compensation and collision detection, the actual structure of the machine tool is still described.

[0193] This embodiment distinguishes between the common pivot point and the equivalent rotation center based on the relationship between the interaxial offset and the intersection threshold, so that the same set of parameters covers both the intersecting and non-intersecting assembly cases of the two rotation axes. When they do not intersect, the interaxial offset is explicitly preserved and participates in the forward kinematics, avoiding the systematic positional deviation that increases with the increase of the swing angle introduced by treating the two non-intersecting axes as intersecting.

[0194] According to some embodiments of this application, after determining the common perpendicular segment between the rotation axis of B-axis and the rotation axis of C-axis, determining the length of the common perpendicular segment as the interaxial offset between B-axis and C-axis, and determining the rotation center between B-axis and C-axis based on the midpoint of the common perpendicular segment, the method further includes steps S7.1 to S7.6.

[0195] In step S7.1, the observation covariance of the coordinates of the center of the standard sphere in the machine tool coordinate system is synthesized based on the image measurement noise covariance of the monocular camera device, the encoder error covariance of each axis of the machine tool, and the covariance of the external parameters between the monocular camera device and the machine tool coordinate system.

[0196] In some embodiments, the image measurement noise covariance refers to the covariance of the positioning noise of sub-pixel edge points after propagation to the sphere center coordinates through sphere center calculation. It is related to the imaging size of the standard sphere in the image: the larger the imaging size, the smaller the sphere center displacement corresponding to the same edge positioning noise. The encoder error covariance refers to the covariance of the quantization error, backlash, and positioning error of each axis coordinate reading after conversion by extrinsic parameters. The covariance of extrinsic parameters refers to the covariance of the calibration residual of the relative pose between the camera and the machine tool.

[0197] In some embodiments, the three covariances are synthesized according to the error propagation law. When the error sources are independent of each other, the observation covariance is the sum of the three terms. When there is a common error source, the covariance term is retained in the synthesis. The propagation of image measurement noise goes through two levels of Jacobi, that is, it first propagates from the edge point coordinates to the coefficient of the contour ellipse, and then from the coefficient of the contour ellipse to the center coordinate, as shown in Equation (16).

[0198] (16)

[0199] In equation (16), The pixel coordinate noise covariance of sub-pixel edge points, in square pixels; It is the Jacobian matrix of the contour ellipse coefficients with respect to the coordinates of the edge points; Let be the covariance matrix of the contour ellipse coefficients; is the Jacobian matrix of the sphere center coordinates with respect to the contour elliptic coefficients, in millimeters; The covariance of the sphere center coordinates obtained by measuring noise in the image after the above two stages of propagation is expressed in square millimeters. The covariance of the encoder error of each axis after external parameter conversion is expressed in square millimeters. The covariance of the external parameters is expressed in square millimeters. To observe the covariance, the unit is square millimeters.

[0200] In step S7.2, based on the observation covariance, the uncertainty of at least one of the following is evaluated: the direction of the rotation axis of the B-axis, the center of the rotation axis of the B-axis, the direction of the rotation axis of the C-axis, the center of the rotation axis of the C-axis, the inter-axis offset, and the rotation center, to obtain the corresponding standard uncertainty.

[0201] In some embodiments, uncertainty assessment refers to the process of progressively propagating the calculation chain of fitting the observation covariance along the trajectory circle, determining the axis of rotation, and solving the common perpendicular segment to obtain the standard deviation of each output parameter, which is given by the Jacobian matrix of the parameter with respect to the coordinates of the sphere center according to equation (17); the propagation method includes linear propagation according to the analytical Jacobian, and sampling each sphere center coordinate according to its covariance and repeating the entire calculation chain for statistical analysis according to the Monte Carlo method.

[0202] (17)

[0203] In equation (17), It can be any one of the six parameters; The Jacobian matrix of this parameter with respect to the coordinates of the sphere center is obtained by taking the partial derivatives of equations (6), (8) and (9) with respect to each coordinate of the sphere center. This indicates retrieving the diagonal elements of the matrix; The standard uncertainty of this parameter is given; directional parameters are measured in degrees, and other parameters are measured in millimeters.

[0204] In some embodiments, the standard uncertainty of each parameter decreases as the number of sampling angles increases, and the rate of decrease is related to the number of sampling angles, the distribution of the sampling angles over the whole circumference, and the clamping eccentricity of the standard ball.

[0205] In step S7.3, based on the standard uncertainty, the number of rotation angles of the B-axis and C-axis is increased step by step in the order of increasing the number of rotation angles until the standard uncertainty is less than or equal to the preset target uncertainty.

[0206] In some embodiments, increasing the number of rotation angles step by step means expanding the sampling levels step by step according to a pre-set angle sequence. Each level supplements the sphere center coordinates under new angles in addition to the sampling data of the previous level, and re-completes the trajectory circle fitting and uncertainty assessment. When expanding, the existing data is retained without resampling the collected angles, so that the time for the entire calibration increases linearly with the increase of the level.

[0207] In some embodiments, the target uncertainty is the upper limit of uncertainty that the index determination result is required to reach before being written into the CNC system, and it is tuned according to the machining tolerance of the part and the positioning accuracy of the machine tool; as some feasible methods, the target uncertainty is taken as one-third to one-tenth of the critical dimensional tolerance on the part, and is set independently by machine model in the configuration file.

[0208] In some embodiments, the order of increasing the number of rotation angles is to first increase the sampling points in the angle range with the largest displacement of the standard sphere's center, and then increase the sampling points that cover the entire circumference and are evenly distributed. After each level of expansion, the fitting residuals of the coordinates of each sphere's center are checked simultaneously. If the residuals exceed the preset range, abnormal data are excluded before uncertainty assessment is performed.

[0209] In step S7.4, the direction of the rotation axis of the B-axis, the center of the rotation axis of the B-axis, the direction of the rotation axis of the C-axis, the center of the rotation axis of the C-axis, the inter-axis offset, and the confidence level of the rotation center are determined based on the standard uncertainty.

[0210] In some embodiments, the confidence level refers to the discrete level obtained by comparing the standard uncertainty with a pre-set level limit. The higher the level, the smaller the standard uncertainty of the parameter, as shown in Equation (18).

[0211] Level 1 Level 2 Level 3 (18)

[0212] In equation (18), The uncertainty of the objective; The standard uncertainty of this parameter is denoted as Level 1, Level 2, and Level 3, which represent the confidence levels, with Level 1 being the highest. The threshold for the level is Level 1, which means that the standard uncertainty of this parameter is required to be no greater than the target uncertainty.

[0213] In some embodiments, each of the six parameters independently provides a confidence level, and the level is saved along with the calibration process; the level is used as an attribute of the calibration result to participate in subsequent write determination, so that the calibration result has a traceable accuracy identifier.

[0214] In step S7.5, if the reliability levels of the direction of the rotation axis of B-axis, the center of the rotation axis of B-axis, the direction of the rotation axis of C-axis, the center of the rotation axis of C-axis, the inter-axis offset, and the rotation center are all greater than or equal to the preset level threshold, and the motion chain between B-axis and C-axis is correct, then the direction of the rotation axis of B-axis, the center of the rotation axis of B-axis, the direction of the rotation axis of C-axis, the center of the rotation axis of C-axis, the inter-axis offset, and the rotation center are written into the CNC system of the machine tool.

[0215] In some embodiments, the level threshold refers to the minimum confidence level required to allow parameters to be written into the CNC system; the writing threshold is composed of two conditions simultaneously: the confidence levels of all six parameters are not lower than the level threshold, and the kinematic chain judgment given by the comparison between the included angle residual and the kinematic chain verification threshold is correct; if either condition is not met, no writing is performed.

[0216] In some embodiments, of the six parameters written, the directions and centers of the two rotary axes are used to describe the pose of the rotary axes in the machine tool coordinate system, and the inter-axis offset and rotation center are used to describe the relative position between the two rotary axes. The six parameters are written after being converted according to the parameter definition of the target controller, and after writing is completed, they are read back from the CNC system and compared with it.

[0217] In step S7.6, if the confidence level of any one of the following is less than the level threshold: the direction of the rotation axis of B-axis, the center of the rotation axis of B-axis, the direction of the rotation axis of C-axis, the center of the rotation axis of C-axis, the inter-axis offset, and the rotation center, it is prohibited to write the direction of the rotation axis of B-axis, the center of the rotation axis of B-axis, the direction of the rotation axis of C-axis, the center of the rotation axis of C-axis, the inter-axis offset, and the rotation center into the CNC system of the machine tool, and the standard uncertainty is output.

[0218] In some embodiments, "disallow writing" means keeping the original rotary axis parameters in the CNC system unchanged, not modifying any rotary axis-related fields due to this calibration, and providing the standard uncertainty of each parameter, the observation covariance of each sphere center coordinate, and the fitting residual in the output, so that the operator can determine whether to continue to increase the number of sampling angles, improve imaging conditions, or first inspect the assembly status of the turntable.

[0219] In some embodiments, the output standard uncertainty refers to listing the standard uncertainty and its corresponding confidence level item by item according to the parameters, and giving the conditions required to reach the level threshold, including the number of additional sampling angles and the lower limit of the imaging size.

[0220] This embodiment quantifies and classifies the accuracy of the calibration results before they are written into the CNC system, turning the quantitative relationship between the number of sampling angles and the calibration accuracy into executable conditions. The calibration process thus automatically converges to the required accuracy without requiring the operator to repeatedly try and adjust based on experience. When the accuracy is insufficient, writing is prohibited and the required supplementary conditions are given, preventing low-precision rotation center parameters from being used for part machining.

[0221] This application also provides a machine tool. The following will be combined with... Figure 2 The machine tool is described in detail.

[0222] Figure 2 A schematic diagram of the structure of a machine tool according to an embodiment of this application is shown.

[0223] like Figure 2 As shown, the machine tool 100 according to an embodiment of this application includes a machine tool body 101, a spindle 110, a rotary table 120, a monocular camera device 130, a standard ball 140, and a numerical control system 150.

[0224] The rotary table 120 includes a B-axis 122 and a C-axis 121. The C-axis is mounted on the B-axis and tilts as the B-axis rotates. The B-axis is positioned around the Y-axis of the machine tool, and the C-axis is positioned around the Z-axis of the machine tool. The spindle 110 is configured to feed linearly only along the X-axis, Y-axis, and Z-axis of the machine tool. A monocular camera device 130 is fixedly mounted on the stationary structure of the machine tool body. A standard ball 140 is clamped on the rotary table 120. The CNC system 150 is configured to execute the steps of the monocular vision rotary axis calibration method based on machine tool motion according to the embodiments of this application.

[0225] The technical effects of the machine tool according to the embodiments of this application are similar to those of the rotary axis calibration method according to the embodiments of this application, and will not be described in detail here.

[0226] 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.

[0227] 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.

[0228] 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.

[0229] 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.

[0230] 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.

[0231] 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.

[0232] 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.

[0233] 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.

[0234] 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).

[0235] 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.

[0236] 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 monocular vision-based rotary axis calibration method based on machine tool motion, characterized in that, The machine tool includes a machine body, a spindle, a rotary table, a monocular camera, a machine reference mark, and a standard ball. The rotary table includes a B-axis and a C-axis. The C-axis is mounted on the B-axis and tilts as the B-axis rotates. The B-axis is positioned around the Y-axis of the machine tool, and the C-axis is positioned around the Z-axis of the machine tool. The spindle is configured to feed linearly only along the X, Y, and Z axes of the machine tool. The monocular camera is fixedly mounted on a stationary structure of the machine body. The machine coordinates of the corner points of the machine reference mark are pre-calibrated and stored. The standard ball is clamped onto the C-axis. The method includes: The B-axis is rotated to multiple angles while the C-axis is fixed at zero. At each angle, the monocular camera captures the B-axis image of the standard sphere. Based on the contour of the standard sphere extracted from each B-axis image, the first coordinate of the center of the standard sphere in the machine tool coordinate system at each angle is determined. The trajectory circle of the B-axis is then fitted based on the first coordinate at each angle. The C-axis is rotated to multiple angles while the B-axis is fixed at zero. At each angle, the monocular camera captures the C-axis image of the standard sphere. Based on the contour of the standard sphere extracted from each C-axis image, the second coordinate of the center of the standard sphere in the machine tool coordinate system at each angle is determined. The trajectory circle of the C-axis is then fitted based on the second coordinate at each angle. The direction and center of the rotation axis of the B-axis are determined based on the trajectory circle of the B-axis, and the direction and center of the rotation axis of the C-axis are determined based on the trajectory circle of the C-axis. Find the common perpendicular line segment between the rotation axis of the B-axis and the rotation axis of the C-axis, determine the length of the common perpendicular line segment as the interaxial offset between the B-axis and the C-axis, and determine the rotation center between the B-axis and the C-axis based on the midpoint of the common perpendicular line segment; With the B-axis fixed at a non-zero angle, the C-axis is rotated a full revolution. At each angle, the monocular camera device acquires verification images of the standard sphere. Based on the contour of the standard sphere extracted from each verification image, the verification coordinates of the center of the standard sphere in the machine tool coordinate system at each angle are determined. A verification trajectory circle is then fitted based on the verification coordinates at each angle. The direction of the rotation axis of the C-axis is determined based on the verification trajectory circle; The direction of the rotation axis of the C-axis obtained by re-measuring the full rotation of the C-axis is compared with the direction of the rotation axis of the C-axis when it is at zero position to obtain the included angle residual. If the included angle residual is less than or equal to a preset kinematic chain verification threshold, the kinematic chain between the B-axis and the C-axis is determined to be correct, and the inter-axis offset and the rotation center are written into the CNC system of the machine tool. If the included angle residual is greater than the kinematic chain verification threshold, it is determined that the B-axis and the C-axis are not orthogonal or the turntable assembly is tilted, the cause is diagnosed and the user is prompted to check.

2. The monocular vision-based rotary axis calibration method based on machine tool motion according to claim 1, characterized in that, The step of determining the first coordinates of the center of the standard sphere in the machine tool coordinate system at each angle based on the contour of the standard sphere extracted from each of the B-axis images includes: Subpixel edge extraction is performed on the contour of the standard sphere in each of the B-axis images, and the contour ellipse is fitted. A quadratic curve matrix in the camera coordinate system of the monocular camera device is constructed from the contour ellipse fitted according to the B-axis image. The quadratic curve matrix is ​​then combined with the intrinsic parameters of the monocular camera device to obtain the first visual cone quadratic form. Eigenvalue decomposition is performed on the first quadratic cone form to obtain the first sphere center direction and the first cone half-angle of the standard sphere. Based on the first half-angle of the visual cone and the known radius of the standard sphere, determine the first distance from the center of the standard sphere to the optical center of the monocular camera device; Based on the first distance and the first sphere center direction, the coordinates of the center of the standard sphere in the camera coordinate system of the monocular camera device are determined. Then, according to the extrinsic parameters between the monocular camera device and the machine tool coordinate system, the coordinates of the center of the standard sphere in the camera coordinate system are converted into the first coordinates of the center of the standard sphere in the machine tool coordinate system. The step of determining the second coordinates of the center of the standard sphere in the machine tool coordinate system at each angle based on the contour of the standard sphere extracted from each of the C-axis images includes: Subpixel edge extraction is performed on the contour of the standard sphere in each of the C-axis images, and the contour ellipse is fitted. A quadratic curve matrix in the camera coordinate system of the monocular camera device is constructed from the contour ellipse fitted according to the C-axis image. The quadratic curve matrix is ​​then combined with the intrinsic parameters of the monocular camera device to obtain the second visual cone quadratic form. Eigenvalue decomposition is performed on the second quadratic form of the visual cone to obtain the second center direction and the second half angle of the visual cone of the standard sphere; Based on the second half-angle of the visual cone and the known radius of the standard sphere, determine the second distance from the center of the standard sphere to the optical center of the monocular camera device; Based on the second distance and the second sphere center direction, the coordinates of the standard sphere's center in the camera coordinate system of the monocular camera device are determined. Then, according to the extrinsic parameters between the monocular camera device and the machine tool coordinate system, the coordinates of the standard sphere's center in the camera coordinate system are converted into the second coordinates of the standard sphere's center in the machine tool coordinate system. The step of determining the verification coordinates of the center of the standard sphere in the machine tool coordinate system at various angles based on the contour of the standard sphere extracted from each of the verification images includes: Subpixel edge extraction is performed on the contour of the standard sphere in each of the verification images, and the contour ellipse is fitted. A quadratic curve matrix in the camera coordinate system of the monocular camera device is constructed from the contour ellipse fitted according to the verification image. The quadratic curve matrix is ​​then combined with the intrinsic parameters of the monocular camera device to obtain a third visual cone quadratic form. Eigenvalue decomposition is performed on the third conic quadratic form to obtain the direction of the third center of the standard sphere and the third conic half-angle; Based on the third half-angle of the visual cone and the known radius of the standard sphere, determine the third distance from the center of the standard sphere to the optical center of the monocular camera device; Based on the third distance and the third sphere center direction, the coordinates of the center of the standard sphere in the camera coordinate system of the monocular camera device are determined, and according to the extrinsic parameters between the monocular camera device and the machine tool coordinate system, the coordinates of the center of the standard sphere in the camera coordinate system are converted into the verification coordinates of the center of the standard sphere in the machine tool coordinate system.

3. The monocular vision-based rotary axis calibration method based on machine tool motion according to claim 2, characterized in that, When determining the coordinates of the center of the standard sphere in the machine tool coordinate system at various angles based on the contour of the standard sphere extracted from each of the B-axis images, each of the C-axis images, or each of the verification images, If an angle exists that partially obscures the standard sphere, determine whether the central angle span of the visible arc segment of the standard sphere is greater than or equal to 180 degrees. When the central angle span of the visible arc segment is greater than or equal to 180 degrees, the visible arc segment is fitted to obtain the coordinates of the center of the standard sphere in the machine tool coordinate system at that angle; If the central angle span of the visible arc segment is less than 180 degrees, re-acquire the image of the standard sphere at that angle; If the central angle span is still not satisfied after re-acquisition, the surface of the standard sphere is lightly touched with a tool with a calibrated tool length, and the surface of the standard sphere is fitted by each contact point to obtain the coordinates of the center of the standard sphere in the machine tool coordinate system at that angle.

4. The monocular vision-based rotary axis calibration method based on machine tool motion according to claim 1, characterized in that, The steps of determining the direction and center of the rotation axis of the B-axis based on the trajectory circle of the B-axis, and determining the direction and center of the rotation axis of the C-axis based on the trajectory circle of the C-axis, include: The center of the trajectory circle of the B-axis is taken as the center of the rotation axis of the B-axis, and the normal of the trajectory circle of the B-axis is taken as the direction of the rotation axis of the B-axis. The center of the trajectory circle of the C-axis is taken as the center of the rotation axis of the C-axis, and the normal of the trajectory circle of the C-axis is taken as the direction of the rotation axis of the C-axis.

5. The monocular vision-based rotary axis calibration method based on machine tool motion according to claim 1, characterized in that, The steps of determining the common perpendicular segment between the rotation axis of the B-axis and the rotation axis of the C-axis, defining the length of the common perpendicular segment as the inter-axial offset between the B-axis and the C-axis, and determining the rotation center between the B-axis and the C-axis based on the midpoint of the common perpendicular segment include: A first perpendicular foot point is set on the rotation axis of the B-axis. The first perpendicular foot point is obtained by offsetting the center of the rotation axis of the B-axis by a first parameter along the direction of the rotation axis of the B-axis. A second perpendicular foot point is set on the rotation axis of the C-axis. The second perpendicular foot point is obtained by offsetting the center of the rotation axis of the C-axis by a second parameter along the direction of the rotation axis of the C-axis. Using the line connecting the first perpendicular point and the second perpendicular point as a constraint that is perpendicular to both the rotation axis of the B-axis and the rotation axis of the C-axis, constraint equations are established regarding the first parameter and the second parameter. Solve the constraint equations to obtain the first parameter and the second parameter; The coordinates of the first perpendicular point in the machine tool coordinate system are determined according to the first parameter, and the coordinates of the second perpendicular point in the machine tool coordinate system are determined according to the second parameter. The length of the line connecting the first perpendicular point and the second perpendicular point is determined as the length of the common perpendicular segment, and the length of the common perpendicular segment is determined as the interaxial offset between the B axis and the C axis; The midpoint of the line connecting the first perpendicular point and the second perpendicular point is determined as the rotation center between the B-axis and the C-axis.

6. The monocular vision-based rotary axis calibration method based on machine tool motion according to claim 5, characterized in that, After determining the center of rotation between the B-axis and the C-axis based on the midpoint of the common perpendicular segment, the method further includes: If the interaxial offset is less than or equal to a preset intersection threshold, it is determined that the B-axis intersects the C-axis, and the midpoint of the common perpendicular segment is determined as the rotation center. The rotation center is the intersection of the rotation axis of the B-axis and the rotation axis of the C-axis, and the intersection point is the common pivot point. If the interaxial offset is greater than the intersection threshold, it is determined that the B-axis and the C-axis do not intersect, and the midpoint of the common perpendicular segment is determined as the rotation center, which is an equivalent rotation center. The equivalent rotation center is not on the rotation axis of the B-axis or the rotation axis of the C-axis, but is used only as the rotation center of the B-axis and the C-axis in the forward kinematics of the B-axis and the C-axis.

7. The monocular vision-based rotary axis calibration method based on machine tool motion according to claim 1, characterized in that, After determining the common perpendicular segment between the rotation axis of the B-axis and the rotation axis of the C-axis, setting the length of the common perpendicular segment as the inter-axial offset between the B-axis and the C-axis, and determining the rotation center between the B-axis and the C-axis based on the midpoint of the common perpendicular segment, the method further includes: Based on the image measurement noise covariance of the monocular camera device, the encoder error covariance of each axis of the machine tool, and the covariance of the extrinsic parameters between the monocular camera device and the machine tool coordinate system, the observation covariance of the coordinates of the center of the standard sphere in the machine tool coordinate system is synthesized. Based on the observed covariance, the uncertainty of at least one of the following is evaluated: the direction of the rotation axis of the B-axis, the center of the rotation axis of the B-axis, the direction of the rotation axis of the C-axis, the center of the rotation axis of the C-axis, the inter-axis offset, and the rotation center, to obtain the corresponding standard uncertainty. Based on the standard uncertainty, the rotation angles of the B-axis and the C-axis are increased step by step in the order of increasing the rotation angles until the standard uncertainty is less than or equal to the preset target uncertainty. The confidence levels of the rotation axis of the B-axis, the center of the rotation axis of the B-axis, the rotation axis of the C-axis, the center of the rotation axis of the C-axis, the inter-axis offset, and the rotation center are determined based on the standard uncertainty. If the reliability levels of the rotation axis direction of the B-axis, the center of the rotation axis of the B-axis, the rotation axis direction of the C-axis, the center of the rotation axis of the C-axis, the inter-axis offset, and the rotation center are all greater than or equal to a preset level threshold, and the motion chain between the B-axis and the C-axis is correct, then the rotation axis direction of the B-axis, the center of the rotation axis of the B-axis, the rotation axis direction of the C-axis, the center of the rotation axis of the C-axis, the inter-axis offset, and the rotation center are written into the CNC system of the machine tool. If the confidence level of any one of the following—the direction of the rotation axis of the B-axis, the center of the rotation axis of the B-axis, the direction of the rotation axis of the C-axis, the center of the rotation axis of the C-axis, the inter-axis offset, and the rotation center—is less than the specified threshold, then it is prohibited to write the direction of the rotation axis of the B-axis, the center of the rotation axis of the B-axis, the direction of the rotation axis of the C-axis, the center of the rotation axis of the C-axis, the inter-axis offset, and the rotation center into the CNC system of the machine tool, and the specified standard uncertainty shall be output.

8. A machine tool, characterized in that, This includes the machine tool body, spindle, rotary table, monocular camera device, standard ball, and CNC system; The rotary table includes a B-axis and a C-axis. The C-axis is mounted on the B-axis and tilts as the B-axis rotates. The B-axis is arranged around the Y-axis of the machine tool, and the C-axis is arranged around the Z-axis of the machine tool. The spindle is configured to feed linearly only along the X-axis, Y-axis and Z-axis of the machine tool; The monocular camera device is fixedly installed on the stationary structure of the machine tool body; The standard ball is clamped in the turntable; The CNC system is configured to perform the steps of the monocular vision rotary axis calibration method based on machine tool motion according to any one of claims 1 to 7.

9. 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 the processor, they implement the steps of the monocular vision rotary axis calibration method based on machine tool motion according to any one of claims 1 to 7.

10. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by the processor, they implement the steps of the monocular vision rotary axis calibration method based on machine tool motion according to any one of claims 1 to 7.