PCB high-precision rotary positioning method based on rotary arm and image recognition

By combining a rotating arm with image recognition technology into the traditional PCB rotation positioning method, the printed circuit board image is acquired and the offset angle of the rotation starting point is corrected, and the rotation path termination angle is optimized. This solves the problem that the rotation direction error cannot be corrected in time in the traditional method, and achieves high-precision and stable rotation positioning.

CN121492042BActive Publication Date: 2026-07-31(HEFEI) SIN MING TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
(HEFEI) SIN MING TECH CO LTD
Filing Date
2025-12-24
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

In traditional high-precision PCB rotation positioning methods, the initial judgment error of the rotation direction cannot be corrected in time, resulting in cumulative error shift, affecting rotation stability and positioning consistency, and reducing system control accuracy and execution efficiency.

Method used

By establishing a method that combines a rotating arm with image recognition, images of the printed circuit board surface are acquired, the polar direction of the marked graphics is extracted, image mark direction lines are generated, the rotating arm is controlled to adjust its angle, the offset angle of the rotation starting point is corrected, and the rotation path termination angle is optimized by combining the distribution characteristics of the image marks to ensure the consistency of the rotation direction.

Benefits of technology

It improves the accuracy and robustness of rotation control, enhances the precision and stability of rotation positioning, reduces error accumulation, and improves the overall operating efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121492042B_ABST
    Figure CN121492042B_ABST
Patent Text Reader

Abstract

This invention relates to the field of positioning control technology, specifically a high-precision PCB rotation positioning method based on a rotating arm and image recognition. The method includes the following steps: establishing a circular arc direction around the board boundary using a rotating arm; acquiring images and extracting markers; monitoring changes in the rotation start angle and correcting the starting point offset; adjusting the rotation path direction while maintaining image orientation consistency; and finally outputting a PCB rotation positioning scheme. In this invention, the rotation direction is determined based on arc alignment. Angle adjustment guidance is achieved by matching the direction lines of the polar features and image markers. Initial direction deviations are corrected by judging angle consistency during the start-up phase. Starting point offset compensation improves rotation control accuracy. Image distribution continuity is introduced as a direction reference during path adjustment to ensure stable and consistent motion trajectory. Target alignment is achieved through direction angle correction during the termination phase, enhancing the accuracy and robustness of rotation positioning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of positioning control technology, and in particular to a high-precision PCB rotation positioning method based on a rotating arm and image recognition. Background Technology

[0002] The field of positioning control technology mainly involves the precise positioning and attitude adjustment of mechanical devices in space, including displacement control and attitude change control of mechanisms such as robotic arms, manipulators, and platforms, as well as the technical means to achieve precise target positioning in conjunction with sensors and image recognition systems. The position and attitude adjustment control methods covered in this field typically include core components such as angle measurement, position feedback, coordinate transformation, motion path planning, and drive control of actuators, and are widely used in high-precision operation scenarios such as industrial automation, robotics, electronic manufacturing, medical equipment, and aerospace. Positioning control systems achieve precise capture and manipulation of target objects by integrating the perception layer and the execution layer, improving operational efficiency and system stability. Traditional high-precision PCB rotation positioning methods refer to the use of specialized fixtures or mechanical structures combined with visual inspection methods to perform rotational correction and position adjustment of printed circuit boards. Traditional methods generally involve setting up a rotating platform or gear assembly to drive the PCB to rotate, and using a fixed camera to acquire position images of identification marks on the PCB. The rotation angle is calculated by the deviation between the mark position and the target position in the image, and then the rotation mechanism is controlled for correction. This process typically relies on a fixed vision system to identify image feature points and performs error compensation and rotation angle adjustment based on the mapping relationship between the image coordinate system and the mechanical coordinate system, thereby achieving precise positioning of the PCB workpiece.

[0003] Traditional methods rely on mechanical drive structures to correct image deviations during rotational positioning. However, since the rotation path is based on a single angular deviation, there is a lack of a dynamic correlation mechanism between the rotation direction and image features throughout the entire process. This can easily lead to the initial judgment error of the rotation direction not being corrected in time during subsequent processes. At the same time, the control logic does not consider the impact of the rotation start point offset on the end point accuracy, which can easily lead to cumulative error offset. Furthermore, the spatial distribution changes of the image marker position are not continuously analyzed, resulting in insufficient adjustment of the rotation termination angle. This affects the overall rotational stability and positioning consistency, and consequently, error accumulation occurs in multi-station collaborative operations, reducing the system's control accuracy and execution efficiency. Summary of the Invention

[0004] To achieve the above objectives, the present invention adopts the following technical solution: a high-precision PCB rotation positioning method based on a rotating arm and image recognition, comprising the following steps: S1: Establish a rotating arm structure consisting of a fixed end and a rotating end, calculate the rotation direction of the end of the rotating arm from the current position to the target edge around the printed circuit board boundary configuration, and output the arc motion direction; S2: Based on the arc motion direction, acquire an image of the printed circuit board surface, extract the marked graphics in the image, analyze the polar direction of each marked graphic to the rotation center, match the directional relationship between the two, and generate image marked direction lines; S3: Control the rotation arm to start the angle adjustment operation according to the image mark direction line, monitor the angle change direction during the rotation start stage, determine whether the angle change direction is consistent with the image mark direction line, if not consistent, correct the angle reference position and output the rotation start point offset angle. S4: Adjust the rotation starting point offset angle, adjust the end angle direction of the rotation control path, and combine the continuous distribution characteristics of the marked graphics in the image to establish a consistent relationship between the rotation target point and the image marking direction; S5: Based on the consistency between the rotation target point and the image mark direction, compare the direction angle of the mark line in the image before and after rotation, correct the termination angle direction of the end of the rotating arm, and output the printed circuit board rotation positioning scheme.

[0005] As a further embodiment of the present invention, the arc motion direction includes the rotation direction determination criteria, the target edge azimuth angle, and the end position orientation; the image marking direction line includes the polar coordinate direction of the marking graphic, the rotation direction matching line, and the image recognition direction vector; the rotation starting point offset angle includes the angle difference, the reference direction offset, and the rotation start error; the consistency relationship between the rotation target point and the image marking direction includes the rotation path end angle adjustment, the image marking distribution direction, and the direction consistency reference axis; and the printed circuit board rotation positioning scheme includes the termination angle correction value, the marking line angle difference, and the positioning angle optimization.

[0006] As a further aspect of the present invention, the continuous distribution feature of the marker graphics refers to the arrangement direction and relative positional relationship of the markers in the image, which helps to determine the consistency of the rotation direction; The rotation target point is the reference graphic position where the direction of the end point of the rotation path is most consistent with the direction of the image marker graphic.

[0007] As a further aspect of the present invention, the termination angle direction of the end of the rotating arm refers to the final angle position of the end after the rotational movement, which matches the direction of the image marker line.

[0008] As a further aspect of the present invention, the specific steps of S1 are as follows: S101: Based on the configuration of the fixed end and the rotating end, extract the polar coordinates of the current position of the rotating arm end and the edge point of the printed circuit board, calculate the angle difference between the two, compare it with the preset rotation direction mark angle, obtain the required angle offset of the rotation direction, and generate the end offset angle value. S102: Call the end offset angle value, combine it with the length of the rotating arm and the position of the fixed end, calculate the tangent direction vector of the path function and compare it with the rotation direction vector to determine the consistency of the motion direction and obtain the arc direction identification label; S103: Based on the arc direction identification label, and combined with the angle between the line direction connecting the fixed point to the target point and the current end pointing, determine the consistency, filter the direction labels that meet the conditions, and obtain the arc movement direction.

[0009] As a further aspect of the present invention, the specific steps of S2 are as follows: S201: Based on the arc motion direction, acquire the image of the printed circuit board surface, extract the coordinates of the marked graphic area in the image area, combine the coordinate boundary contour to perform pixel block aggregation processing on the graphic, and perform polar coordinate transformation on the aggregated boundary contour to obtain the polar direction value corresponding to each marked graphic and generate a marked polar direction set. S202: Call the marked polar direction set, construct a direction vector matrix based on the offset between the rotation center position and the image coordinate origin position, map the polar direction value of the marked graphic to the direction vector matrix, extract the direction line data consistent with the direction of the circular arc movement, and obtain the direction line matching result set; S203: Based on the direction line matching result set, filter the direction line index values ​​corresponding to the position of the marked graphic, perform line segment interpolation on the coordinates of the endpoints of the direction lines corresponding to the index values, reconstruct the visual direction trajectory line segments of each marked graphic, and establish the image marked direction lines.

[0010] As a further aspect of the present invention, the specific steps of S3 are as follows: S301: Based on the direction lines marked in the image, control the rotating arm to perform an angle adjustment start operation, collect the rotation angle value corresponding to the sampling time of the rotation start phase, perform differential operation on adjacent sampling angle values, extract the angle change direction vector, serialize the angle change direction vector to generate the start angle change direction sequence; S302: Call the start angle change direction sequence, match the direction vector in the sequence with the direction vector corresponding to the direction line marked in the image, mark the inconsistent direction index according to the preset direction consistency judgment rule, and aggregate all inconsistent indexes to obtain the direction inconsistency index set. S303: Based on the set of inconsistent direction indices, call the current angle reference value of the rotating arm, calculate the reference deviation based on the angle sampling value corresponding to the index, and use the deviation to correct the current angle reference value of the rotating arm. The correction method is to add a reverse offset to the original angle value, and summarize the corrected angle values ​​to establish the rotation starting point offset angle.

[0011] As a further aspect of the present invention, the specific steps of S4 are as follows: S401: Based on the rotation starting point offset angle, the starting point angle parameter of the current rotation path is offset and corrected, the end angle position of the path is updated, and the rotation path angle vector sequence is re-established to obtain the corrected path angle sequence. S402: Call the corrected path angle sequence, sort all angle values ​​by angle difference according to the angle relationship between the rotation end direction vector and the polar direction set of the marked graphics in the image, and filter the marked graphics index corresponding to the smallest difference to generate the end direction matching graphic index; S403: Based on the end direction matching graphic index, extract the position coordinates of the graphic in the image, and analyze the position sequence of adjacent graphics in the continuous distribution structure. By performing weighted averaging and trend smoothing on the polar direction difference of the adjacent sequence, determine whether the graphic direction is consistent with the end direction of the rotation path, and establish the consistency relationship between the rotation target point and the image mark direction.

[0012] As a further aspect of the present invention, the specific steps of S5 are as follows: S501: Based on the consistency between the rotation target point and the image mark direction, extract the corresponding direction angle of the rotation target point in the image mark line, and combine the image frames before and after the rotation operation to extract the angle vectors of the direction lines corresponding to the mark graphics before and after the rotation, calculate the angle difference between the two, and generate a mark line angle difference set. S502: Call the set of angle differences of the marker line, take the current position direction angle of the end of the rotating arm as the reference, judge the positive and negative signs of each difference, and perform offset reverse compensation on the angle differences with opposite directions, calculate the weighted average of the set of angle differences of the marker line, and use the average value to update the current end direction angle to obtain the corrected end angle direction; S503: Based on the corrected end angle direction, combined with the control point set and rotation speed parameters in the current rotation path, construct a rotation control path parameter set, and use the parameter set as the output control configuration to establish a printed circuit board rotation positioning scheme.

[0013] As a further aspect of the present invention, the offset reverse compensation of the angle difference in opposite directions refers to the compensation operation of correcting the rotation direction deviation and restoring the target alignment state by inverting the angle difference in opposite directions and applying it to the current position.

[0014] Compared with the prior art, the advantages and positive effects of the present invention are as follows: In this invention, the rotation direction is determined based on the arc alignment method, and the angle adjustment guidance is achieved by matching the direction lines of the polar features with the image markers. The initial direction deviation is corrected by the angle consistency judgment in the start-up stage, and the rotation control accuracy is improved by using the starting point offset compensation. The continuity of image distribution is introduced as a direction reference in the path adjustment to ensure that the motion trajectory is stable and consistent. The target alignment is achieved by the direction angle correction in the termination stage, which enhances the accuracy and robustness of rotation positioning. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 This is a schematic diagram of the steps of the present invention; Figure 2 This is a detailed schematic diagram of S1 of the present invention; Figure 3 This is a detailed schematic diagram of S2 of the present invention; Figure 4 This is a detailed schematic diagram of S3 of the present invention; Figure 5 This is a detailed schematic diagram of S4 of the present invention; Figure 6 This is a detailed schematic diagram of S5 of the present invention. Detailed Implementation

[0017] The technical solution of the present invention will now be described with reference to the accompanying drawings.

[0018] In embodiments of the present invention, words such as "exemplarily," "for example," etc., are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present the concept in a concrete manner. Furthermore, in embodiments of the present invention, the meaning expressed by "and / or" can be both, or either one.

[0019] In the embodiments of this invention, the terms "image" and "picture" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning. Similarly, the terms "of," "corresponding (relevant)," and "corresponding" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning.

[0020] In this embodiment of the invention, sometimes a subscript such as W1 may be written in a non-subscript form such as W1. When the difference is not emphasized, the meaning they express is the same.

[0021] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.

[0022] Please see Figure 1 This invention provides a high-precision PCB rotation positioning method based on a rotating arm and image recognition, comprising the following steps: S1: Using the rotating arm structure formed by the fixed end and the rotating end, around the boundary configuration of the printed circuit board, calculate the rotation direction required for the end of the rotating arm to align with the edge of the printed circuit board from the current position along the arc direction, and output the arc movement direction by combining the geometric relationship between the fixed point and the target point. S2: Based on the direction of circular arc motion, acquire images of the printed circuit board surface and extract marking graphics, analyze the polar direction of each marking graphic at the center of rotation, and match the direction lines with the direction of rotation to generate image marking direction lines; S3: Based on the direction line marked on the image, control the rotating arm to start the angle adjustment operation, determine whether the direction of angle change during the rotation start phase is consistent with the direction line marked on the image, if not, perform angle reference position correction and output the rotation start point offset angle. S4: Use the rotation starting point offset angle in the rotation path control process, adjust the end angle direction of the rotation control path, and combine it with the continuous distribution structure of the marked graphics in the image to establish a consistent relationship between the rotation target point and the image mark direction. S5: Based on the consistency between the rotation target point and the image mark direction, compare the direction angle of the mark line in the image before and after rotation, correct the termination angle direction of the end of the rotating arm, and output the printed circuit board rotation positioning scheme.

[0023] The circular motion direction includes the rotation direction determination criteria, the target edge azimuth angle, and the end position orientation. The image marker direction line includes the polar coordinate direction of the marker graphic, the rotation direction matching line, and the image recognition direction vector. The rotation start point offset angle includes the angle difference, the reference direction offset, and the rotation start error. The consistency relationship between the rotation target point and the image marker direction includes the rotation path end angle adjustment, the image marker distribution direction, and the direction consistency reference axis. The printed circuit board rotation positioning scheme includes the termination angle correction value, the marker line angle difference, and the positioning angle optimization.

[0024] Please see Figure 2 The specific steps of S1 are as follows: S101: Based on the configuration of the fixed end and the rotating end, extract the polar coordinates of the current position of the rotating arm end and the edge point of the printed circuit board, calculate the angle difference between the two, compare it with the preset rotation direction mark angle, obtain the required angle offset of the rotation direction, and generate the end offset angle value. First, the initialization program is initiated, constructing a two-dimensional Cartesian coordinate system in the central processing unit with the fixed end of the rotating arm as the origin, i.e., both the x-coordinate and y-coordinate are 0. The mechanical structural parameters of the rotating arm are read from non-volatile memory, confirming its physical length as 600 mm. Then, communication is established via an industrial fieldbus with an absolute encoder installed at the joint of the rotating arm to read the current joint angle value in real time, which is set to 45 degrees. Using forward kinematics calculation logic, the cosine and sine functions from the trigonometric function library are called to calculate the product of the cosine and sine values ​​of the rotating arm length and the current angle value, respectively, thus obtaining the current x-coordinate and y-coordinate values ​​of the rotating arm end in the Cartesian coordinate system. The calculated results are 424.26 mm and 424.26 mm, respectively. Simultaneously, feature capture is performed on the edge of the printed circuit board on the worktable to identify the pixel coordinates of key edge points. These coordinates are then converted into position coordinates in the same physical coordinate system using pre-calibrated camera intrinsic and extrinsic parameter matrices. The measured coordinates of this edge point are 430.50 mm x-coordinate and 410.20 mm y-coordinate. Next, a polar coordinate transformation program is executed. For the end position of the rotating arm, the ratio of its y-coordinate to its x-coordinate is calculated, and the arctangent of this ratio is performed, yielding a current polar angle of 45 degrees for the end of the rotating arm. Similarly, the same arctangent operation is performed on the edge point coordinates of the printed circuit board, calculating a polar angle of approximately 43.61 degrees. Subtracting these two polar angle values ​​and taking the absolute value of the difference yields an angle difference of 1.39 degrees. An internally preset rotation direction indicator angle, representing the target angle position that the rotating arm should reach in this process, is set to 55 degrees. The total angular offset required for the rotating arm to rotate is calculated by subtracting the rotation direction indicator angle from the current polar angle at the end of the rotating arm. Specifically, 55 degrees minus 45 degrees yields a result of +10 degrees. This calculated value is then confirmed as the end-position offset angle, which clearly defines the angular displacement required for the rotating arm to move from its current position to the target position, providing crucial input data for subsequent path planning.

[0025] S102: Call the end offset angle value, combine it with the length of the rotating arm and the position of the fixed end, calculate the tangent direction vector of the path function and compare it with the rotation direction vector to determine the consistency of the motion direction and obtain the arc direction recognition label; The generated end offset angle value of +10 degrees is read, and the length value of the rotating arm (600 mm) and the origin position data of the fixed end in the coordinate system are retrieved again. Based on these geometric parameters, a parameterized function for the arc path is constructed in the memory of the motion controller. This function is constructed without relying on traditional discrete points, but rather by establishing a continuous equation regarding the time variable. The evolution of the horizontal axis over time is defined as the cosine of the sum of the length value multiplied by the product of the initial angle, the time variable, and the offset angle; the evolution of the vertical axis corresponds to the sine value. The time variable is set to a closed interval from 0 to 1. To verify the motion direction, the rotation direction vector is first defined based on the sign of the end offset angle value: since the offset angle value is positive, the theoretical rotation direction is determined to be counterclockwise, and a normal vector perpendicular to the rotation plane is constructed, which follows the right-hand rule and points outward from the plane. Subsequently, the tangent vector at time 0.1 in the path function is selected; that is, the derivative of the path function is calculated and substituted into the time parameter to calculate the velocity vector direction at that moment. The calculated velocity vector direction is multiplied by a preset counterclockwise reference vector and compared in direction. After verification by the arithmetic logic unit, it is confirmed that the calculated path tangent direction and the counterclockwise reference direction are consistent in the geometric quadrant, and the dot product result is positive, indicating that the planned circular arc path does indeed extend in a counterclockwise direction. Based on this verification result, a circular arc direction identification label containing a positive identifier is generated. This label not only confirms that the geometric direction of the motion is counterclockwise but also has a positive logical attribute, used for subsequent steps to filter the direction of visual markers, ensuring consistency between mechanical motion and visual recognition in terms of directional logic.

[0026] S103: Identify the label based on the arc direction, combine the angle between the line direction connecting the fixed point to the target point and the current end point, determine the consistency, filter the direction labels that meet the conditions, and obtain the arc movement direction; The verified arc direction identification tag is retrieved, indicating that the current movement is counterclockwise. Then, the line data connecting the fixed end origin to the preset target point is extracted. The coordinates of the target point are obtained through trigonometric function calculations using the rotating arm length of 600 mm and the target angle of 55 degrees, resulting in an x-coordinate of 344.15 mm and a y-coordinate of 491.49 mm. A target vector is constructed pointing from the origin to the target point, and a current vector is constructed pointing from the origin to the current end position of the rotating arm. To quantify the relative positional relationship between these two vectors, a vector angle calculation program is executed. First, the dot product of the current vector and the target vector is calculated, divided by the product of the magnitudes of the two vectors, to obtain the cosine of the angle, which is then calculated to be approximately 10 degrees. To confirm the consistency of direction, the cross product principle of two-dimensional vectors is used: the product of the x-coordinate of the current end vector and the y-coordinate of the target vector is calculated, and then the product of the y-coordinate of the current end vector and the x-coordinate of the target vector is subtracted. After substituting the specific values ​​424.26 and 491.49 into the calculations, a positive result was obtained. In planar geometric logic, a positive cross product result means that the target vector is located on the counter-clockwise side of the current vector. Comparing this calculation result with the counter-clockwise attribute in the arc direction recognition label confirmed that the two were perfectly consistent. This indicates that the path from the current position to the target position by rotating 10 degrees counter-clockwise is geometrically reasonable and there is no directional conflict. Based on this, the counter-clockwise direction was formally selected and locked as the final arc motion direction, and this direction command was issued to the vision acquisition and motion control unit.

[0027] Please see Figure 3 The specific steps of S2 are as follows: S201: Based on the direction of circular arc motion, acquire images of the printed circuit board surface, extract the coordinates of the marked graphic area within the image area, combine the coordinate boundary contour to perform pixel block aggregation processing on the graphic, and perform polar coordinate transformation on the aggregated boundary contour to obtain the polar direction value corresponding to each marked graphic, and generate a set of marked polar directions. A trigger signal is sent to a high-precision industrial camera mounted at the end of a rotating arm to acquire a high-resolution grayscale image covering the surface of a printed circuit board. After image acquisition, the image data is preprocessed, with a grayscale threshold of 200, and the image is segmented into a binary pixel matrix. A connected component analysis algorithm is run to scan the bright areas in the binary image, aggregating adjacent pixels into independent graphic objects, and extracting the boundary contour coordinate sequence of each graphic object. For each identified marker graphic, the centroid coordinates of its pixel region are first calculated, and then a local polar coordinate transformation is performed on each pixel coordinate point on the boundary contour, using the centroid as a local pole. During the transformation, the distance from the contour point to the centroid is calculated as the polar radius, and the azimuth angle of the contour point relative to the centroid is calculated as the polar angle. Statistical analysis is performed on the polar angle values ​​of all contour points to construct a polar angle histogram, and the peak angle in the histogram is identified. This peak value represents the main extension direction or polar feature of the marker graphic. For example, three marker shapes are identified in an image, and their polar direction values ​​are calculated to be 30.50 degrees, 182.10 degrees, and 270.00 degrees, respectively. These angle values ​​obtained through pixel geometry analysis are compiled and stored to generate a marker polar direction set, providing basic feature data for subsequent matching with the direction of mechanical motion.

[0028] S202: Call the marked polar direction set, construct the direction vector matrix based on the offset between the rotation center position and the image coordinate origin position, map the polar direction value of the marked graphic to the direction vector matrix, extract the direction line data consistent with the direction of the circular arc movement, and obtain the direction line matching result set; Orientation mapping is performed based on the relative position of the rotation center in the image coordinate system. Since the camera moves with the rotating arm or is fixed at a specific angle, a transformation relationship exists between the image coordinate system and the physical rotation coordinate system. The projected coordinates of the rotation center in the image plane coordinate system are read, and an offset vector matrix is ​​constructed pointing from the rotation center to the image origin. Each angle value in the marker's polar direction set is mapped to this vector matrix, and the radial angle of each marker relative to the rotation center is calculated. Based on the geometric characteristics of circular motion, the direction of motion should be perpendicular to the radial direction. Therefore, the radial angle of each marker is increased by 90 degrees to deduce the theoretical counterclockwise tangent direction. Taking one marker as an example, its calculated radial angle is approximately 88.26 degrees, and the theoretical tangent direction after increasing by 90 degrees is 178.26 degrees. Then, the marker's own principal polar direction value of 182.10 degrees is compared with the deduced theoretical tangent direction, and the absolute value of the angular deviation between the two is calculated. A matching tolerance threshold of 15 degrees is set. After calculation, the deviation of this marker was 3.84 degrees, which is less than the threshold, and it was determined to be a match; while the deviations of other markers, such as 154.94 degrees or 97.90 degrees, all exceeded the threshold. All marker data that met the matching conditions were extracted, and interference items were removed. Only the direction line data with extremely high geometric consistency with the direction of circular motion was retained, thus obtaining the direction line matching result set.

[0029] S203: Based on the direction line matching result set, filter the direction line index values ​​corresponding to the position of the marked graphic, perform line segment interpolation on the coordinates of the endpoints of the direction lines corresponding to the index values, reconstruct the visual direction trajectory line segments of each marked graphic, and establish the image marked direction lines; The coordinate data of all edge points constituting the outline of the marker graphic are extracted from the image memory. To improve the accuracy of the direction line and eliminate single-pixel-level quantization noise, instead of simply connecting these points, line segment interpolation and fitting are performed on the index values ​​of these coordinate points. A least squares linear regression model is used, and the x and y coordinates of the edge points are substituted into the regression equation to calculate the slope and intercept of the best-fitting straight line that represents the overall extension trend of the graphic. The slope of the calculated straight line corresponds to a direction angle of 182.10 degrees. Based on this fitted straight line equation, a visual virtual line segment is reconstructed on the background data layer of the image. This line segment passes through the centroid of the marker graphic and extends in a defined direction, with a length set to 50 pixels. This reconstructed line segment is not only a visual aid but also an internal benchmark reference used for subsequent angular deviation measurements, thus establishing the image marker direction line.

[0030] Please see Figure 4 The specific steps of S3 are as follows: S301: Based on the direction lines marked in the image, control the rotating arm to perform an angle adjustment start operation, collect the rotation angle value corresponding to the sampling time of the rotation start phase, perform differential operation on adjacent sampling angle values, extract the angle change direction vector, serialize the angle change direction vector to generate the start angle change direction sequence; The purpose of controlling the rotary arm to perform minute angle adjustment start-up operations is to detect the mechanical characteristics at the moment of start-up. The encoder angle feedback values ​​of the rotary arm are continuously recorded at a frequency of 1000 Hz for the first 100 milliseconds of start-up. After the acquisition is completed, a time series containing 100 angle values ​​is obtained. A difference operation is performed on two adjacent sampled angle values ​​in this sequence, i.e., the angle value at the later time step is subtracted from the angle value at the earlier time step, resulting in a series of angle changes. The sign characteristics of these changes are then extracted, with positive changes marked as 1, negative changes as -1, and no change as 0, thus generating a start-up angle change direction sequence composed of 1, -1, and 0. For example, the beginning of the sequence may present an alternating pattern of 1, -1, 1. This serialized representation intuitively reveals the minute oscillations or backlashes that may occur during start-up against static friction.

[0031] S302: Call the start angle change direction sequence, match the direction vectors in the sequence with the direction vectors corresponding to the direction lines marked in the image, mark the inconsistent direction indices according to the preset direction consistency judgment rules, and aggregate all inconsistent indices to obtain the direction inconsistency index set; The ideal direction of motion is counter-clockwise, corresponding to a direction vector value of 1. Each element in the sequence is traversed chronologically, and a logical judgment is made according to a preset consistency rule: if a direction vector value in the sequence is -1, while the ideal direction is 1, then a direction inconsistency is determined to have occurred at that moment. The sequence index positions of all inconsistencies are recorded. For example, if a reverse jump is detected in the second item of the sequence, the index of that position is extracted. Subsequently, all indices marked as inconsistent are aggregated, isolated noise points are removed, and the focus is on consecutive or frequently occurring reverse indices. Finally, a set of direction inconsistency indices containing all confirmed abnormal moments is obtained, which precisely points to the specific time node where the mechanical rollback occurred during the startup process.

[0032] S303: Based on the inconsistency index set, call the current angle reference value of the rotating arm, calculate the reference deviation based on the angle sampling value corresponding to the index, and use the deviation to correct the current angle reference value of the rotating arm. The correction method is to add a reverse offset to the original angle value, and summarize the corrected angle values ​​to establish the rotation starting point offset angle. For each abnormal time point recorded in the index set, the corresponding rotating arm angle sampling value is retrieved and compared with the baseline value of the previous normal time point to calculate the reverse offset generated at that instant. The absolute values ​​of all detected reverse offsets are summed to calculate the total angle loss caused by mechanical backlash or flexible deformation during the startup phase. This total loss is calculated to be approximately 0.004 degrees. The current initial angle baseline value of the rotating arm, 45 degrees, is retrieved, and the baseline value is corrected using this total loss. The correction method involves adding the calculated reverse offset to the original angle value as compensation; specifically, this offset is subtracted from the original angle value, thus logically adjusting the rotation starting point to 44.996 degrees. Through this process, the corrected rotation starting point offset angle is established, eliminating the impact of startup nonlinearity error on subsequent trajectory accuracy.

[0033] Please see Figure 5 The specific steps of S4 are as follows: S401: Based on the offset angle of the rotation starting point, the starting angle parameter of the current rotation path is offset and corrected, the end angle position of the path is updated, and the rotation path angle vector sequence is re-established to obtain the corrected path angle sequence. Based on the calculated rotation starting point offset angle of 44.996 degrees, the starting point parameters of the current rotation path are globally corrected. The original planned path rotates from 45 degrees to 55 degrees, but after introducing the starting point correction, the path travel parameters need to be adjusted to maintain the absolute position of the physical endpoint. The corrected starting point angle value is substituted into the original S-shaped velocity control function, and the angle position corresponding to each interpolation cycle on the path is recalculated. With a time step of 1 millisecond, the angle vector sequence of the entire motion process is updated. The new travel increment is calculated as 55 degrees minus 44.996 degrees, which is 10.004 degrees. Based on this increment, the calculation of all interpolation points is completed sequentially, and the rotation path angle vector sequence is re-established. This process ensures that the control command considers the actual starting state from the beginning, obtains the corrected path angle sequence, and makes the motion trajectory more closely match the real physical environment.

[0034] S402: Call the corrected path angle sequence, sort all angle values ​​by angle difference according to the angle relationship between the rotation end direction vector and the polar direction set of the marked graphics in the image, and filter the marked graphics index corresponding to the smallest difference to generate the end direction matching graphic index; The corrected path angle sequence is invoked, and the target direction vector corresponding to its end is extracted. This vector corresponds to a physical angle of 55 degrees. The previously generated set of marker polar directions is read again, and the task now is to find visual features that match the final target state. The angle between the direction vector at the end of the rotation path and the polar direction of each marker in the set is calculated. Specifically, the difference between the geometric tangent direction corresponding to the target angle of 55 degrees (approximately 188.26 degrees) and each marker angle is calculated, and the absolute value is taken. All calculated angle differences are sorted in ascending order, and the marker graphic corresponding to the smallest difference at the top of the sorted list is the best match. After calculation, the deviation between the target marker graphic and the predicted endpoint direction is approximately 6.1 degrees, which is within a reasonable range and much smaller than other interference items. Based on this, the marker graphic index corresponding to this difference is selected to generate the endpoint direction matching graphic index, clarifying that this marker is not only a reference at the start but also a key visual landmark used for final alignment at the end of the rotation.

[0035] S403: Based on the matching graphic index of the end direction, extract the position coordinates of the graphic in the image, and analyze the position sequence of adjacent graphics in the continuous distribution structure. By performing weighted averaging and trend smoothing on the polar direction difference of the adjacent sequence, determine whether the graphic direction is consistent with the end direction of the rotation path, and establish the consistency relationship between the rotation target point and the image marker direction. Extract the center coordinates of the graphic in the image coordinate system. To prevent misjudgment based on a single feature point, further analyze the neighborhood structure of the graphic in the image, extracting the sequence of adjacent graphic positions, such as consecutive pads on a circuit board. Calculate the polar angle of the line vectors connecting these adjacent points and the difference between adjacent polar angles. Perform curvature smoothing on these difference data, calculating the local curvature value using a three-point circular arc fitting algorithm. If the calculated curvature value is lower than a preset straightness threshold (e.g., 0.001), the region is determined to have a straight-line feature. Finally, determine whether the extension direction of the smoothed graphic sequence is consistent with the theoretical tangent direction of the rotation path endpoint. If the consistency error is within the allowable range, establish a consistency relationship between the rotation target point and the image marker direction, formally confirming the correspondence between the visual feature and the mechanical rotation target.

[0036] Please see Figure 6 The specific steps of S5 are as follows: S501: Based on the consistent relationship between the rotation target point and the image marker direction, extract the corresponding direction angle of the rotation target point in the image marker line, and combine the image frames before and after the rotation operation to extract the angle vectors of the corresponding direction lines of the marker graphics before and after rotation, calculate the angle difference between the two, and generate a set of marker line angle difference values. Extract the specific direction angle corresponding to the rotation target point in the image marker line. Simultaneously retrieve the image frame before the rotation operation and the image frame after the rotation (or the predicted frame), and extract the angle vectors of the direction lines corresponding to the marker graphic before and after rotation, respectively. Perform a subtraction operation to calculate the difference between the angle vector before and after rotation. For example, if the angle before rotation is 192.05 degrees and the measured angle after rotation is 182.10 degrees, the difference is -9.95 degrees. Generate a marker line angle difference set from this calculation result. This difference set visually reflects the actual rotation angle amplitude performed by the rotating arm under visual observation. This value shows that the actual rotation amount is 0.05 degrees less than the theoretical command value of 10.00 degrees, reflecting the physical lag in the mechanical transmission.

[0037] S502: Call the mark line angle difference set, take the current position direction angle of the rotating arm end as the reference, judge the positive and negative signs of each difference, and perform offset reverse compensation for the angle difference with opposite direction, calculate the weighted average of the mark line angle difference set, and use the average value to update the current end direction angle to obtain the corrected end angle direction; The data of 9.95 degrees from the mark line angle difference set is used for comparison with the theoretical increment of 10 degrees of the current position direction angle of the rotating arm end. The deviation between the theoretical increment and the measured difference is calculated, i.e., 10 degrees minus 9.95 degrees, resulting in an error value of +0.05 degrees. This error value is then judged by its sign: a positive sign indicates that the actual rotation angle is less than the target angle, indicating under-rotation; a negative sign indicates over-rotation. For the under-rotation situation in this embodiment, the offset reverse compensation logic is executed to superimpose the positive error value onto the current end-point direction angle target. Specifically, the original target angle of 55 degrees is adjusted to 55.05 degrees to compensate for the 0.05-degree gap detected by vision. Through this update operation, the corrected end-point angle direction is obtained, ensuring that the rotating arm can accurately reach the physical alignment position under the closed-loop control of visual feedback.

[0038] S503: Based on the corrected end angle direction, combined with the control point set and rotation speed parameters in the current rotation path, construct a rotation control path parameter set, and use the parameter set as the output control configuration to establish a printed circuit board rotation positioning scheme. The corrected end angle is 55.05 degrees. Combined with the planned control point set in the current rotation path and the preset rotation speed parameters, the final rotation control path parameter set is constructed. This parameter set integrates the starting point correction from step S303 and the end-point visual compensation from step S502. The maximum angular velocity is set to 5 degrees per second, and the angular acceleration to 10 degrees squared per second. The total travel angle to be executed is calculated as 55.05 degrees minus 44.996 degrees, or 10.054 degrees. These kinematic parameters are encapsulated into a standard control command package and sent as the output control configuration to the servo driver. The servo driver drives the rotating arm to perform precise movements based on this parameter set, thereby establishing and completing the rotational positioning scheme for the printed circuit board. The results show that by fusing error suppression in the starting phase and visual compensation in the end-point phase, a high-precision motion trajectory with calibrated start and end points is successfully generated, achieving micron-level positioning.

[0039] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A high-precision PCB rotation positioning method based on a rotating arm and image recognition, characterized in that, Includes the following steps: S1: Using the rotating arm structure consisting of a fixed end and a rotating end, the rotation direction of the end of the rotating arm from the current position to the target edge is calculated around the boundary configuration of the printed circuit board, and the direction of the arc motion is output. S2: Based on the arc motion direction, acquire an image of the printed circuit board surface, extract the marked graphics in the image, analyze the polar direction of each marked graphic to the rotation center, match the directional relationship between the two, and generate image marked direction lines; S3: Control the rotation arm to start the angle adjustment operation according to the image mark direction line, monitor the angle change direction during the rotation start stage, determine whether the angle change direction is consistent with the image mark direction line, if not consistent, correct the angle reference position and output the rotation start point offset angle. S4: Adjust the rotation starting point offset angle, adjust the end angle direction of the rotation control path, and combine the continuous distribution characteristics of the marked graphics in the image to establish a consistent relationship between the rotation target point and the image marking direction; S5: Based on the consistency between the rotation target point and the image mark direction, compare the direction angle of the mark line in the image before and after rotation, correct the termination angle direction of the end of the rotating arm, and output the printed circuit board rotation positioning scheme. The specific steps for S3 are as follows: S301: Based on the direction lines marked in the image, control the rotating arm to perform an angle adjustment start operation, collect the rotation angle value corresponding to the sampling time of the rotation start phase, perform differential operation on adjacent sampling angle values, extract the angle change direction vector, serialize the angle change direction vector to generate the start angle change direction sequence; S302: Call the start angle change direction sequence, match the direction vector in the sequence with the direction vector corresponding to the direction line marked in the image, mark the inconsistent direction index according to the preset direction consistency judgment rule, and aggregate all inconsistent indexes to obtain the direction inconsistency index set. S303: Based on the set of inconsistent direction indices, call the current angle reference value of the rotating arm, calculate the reference deviation based on the angle sampling value corresponding to the index, and use the deviation to correct the current angle reference value of the rotating arm. The correction method is to add a reverse offset to the original angle value, and summarize the corrected angle values ​​to establish the rotation starting point offset angle. The specific steps of S4 are as follows: S401: Based on the rotation starting point offset angle, the starting point angle parameter of the current rotation path is offset and corrected, the end angle position of the path is updated, and the rotation path angle vector sequence is re-established to obtain the corrected path angle sequence. S402: Call the corrected path angle sequence, sort all angle values ​​by angle difference according to the angle relationship between the rotation end direction vector and the polar direction set of the marked graphics in the image, and filter the marked graphics index corresponding to the smallest difference to generate the end direction matching graphic index; S403: Based on the end direction matching graphic index, extract the position coordinates of the graphic in the image, and analyze the position sequence of adjacent graphics in the continuous distribution structure. By performing weighted averaging and trend smoothing on the polar direction difference of the adjacent sequence, determine whether the graphic direction is consistent with the end direction of the rotation path, and establish the consistency relationship between the rotation target point and the image mark direction.

2. The PCB high-precision rotation positioning method based on rotating arm and image recognition according to claim 1, characterized in that, The circular motion direction includes the rotation direction determination criteria, the target edge azimuth angle, and the end position orientation. The image marker direction line includes the polar coordinate direction of the marker graphic, the rotation direction matching line, and the image recognition direction vector. The rotation start point offset angle includes the angle difference, the reference direction offset, and the rotation start error. The consistency relationship between the rotation target point and the image marker direction includes the rotation path end angle adjustment, the image marker distribution direction, and the direction consistency reference axis. The printed circuit board rotation positioning scheme includes the termination angle correction value, the marker line angle difference, and the positioning angle optimization.

3. The high-precision PCB rotation positioning method based on a rotating arm and image recognition according to claim 1, characterized in that, The continuous distribution feature of the marked graphics refers to the arrangement direction and relative positional relationship of the marks in the image, which helps to determine the consistency of the rotation direction; The rotation target point is the reference graphic position where the direction of the end point of the rotation path is most consistent with the direction of the image marker graphic.

4. The PCB high-precision rotation positioning method based on rotating arm and image recognition according to claim 1, characterized in that, The termination angle direction of the end of the rotating arm refers to the final angular position of the end after the rotational movement, which matches the direction of the image marker line.

5. The PCB high-precision rotation positioning method based on rotating arm and image recognition according to claim 1, characterized in that, The specific steps of S1 are as follows: S101: Based on the configuration of the fixed end and the rotating end, extract the polar coordinates of the current position of the rotating arm end and the edge point of the printed circuit board, calculate the angle difference between the two, compare it with the preset rotation direction mark angle, obtain the required angle offset of the rotation direction, and generate the end offset angle value. S102: Call the end offset angle value, combine it with the length of the rotating arm and the position of the fixed end, calculate the tangent direction vector of the path function and compare it with the rotation direction vector to determine the consistency of the motion direction and obtain the arc direction identification label; S103: Based on the arc direction identification label, and combined with the angle between the line direction connecting the fixed point to the target point and the current end pointing, determine the consistency, filter the direction labels that meet the conditions, and obtain the arc movement direction.

6. The high-precision PCB rotation positioning method based on a rotating arm and image recognition according to claim 1, characterized in that, The specific steps of S2 are as follows: S201: Based on the arc motion direction, acquire the image of the printed circuit board surface, extract the coordinates of the marked graphic area in the image area, combine the coordinate boundary contour to perform pixel block aggregation processing on the graphic, and perform polar coordinate transformation on the aggregated boundary contour to obtain the polar direction value corresponding to each marked graphic and generate a marked polar direction set. S202: Call the marked polar direction set, construct a direction vector matrix based on the offset between the rotation center position and the image coordinate origin position, map the polar direction value of the marked graphic to the direction vector matrix, extract the direction line data consistent with the direction of the circular arc movement, and obtain the direction line matching result set; S203: Based on the direction line matching result set, filter the direction line index values ​​corresponding to the position of the marked graphic, perform line segment interpolation on the coordinates of the endpoints of the direction lines corresponding to the index values, reconstruct the visual direction trajectory line segments of each marked graphic, and establish the image marked direction lines.

7. The PCB high-precision rotation positioning method based on rotating arm and image recognition according to claim 1, characterized in that, The specific steps of S5 are as follows: S501: Based on the consistency between the rotation target point and the image mark direction, extract the corresponding direction angle of the rotation target point in the image mark line, and combine the image frames before and after the rotation operation to extract the angle vectors of the direction lines corresponding to the mark graphics before and after the rotation, calculate the angle difference between the two, and generate a mark line angle difference set. S502: Call the set of angle differences of the marker line, take the current position direction angle of the end of the rotating arm as the reference, judge the positive and negative signs of each difference, and perform offset reverse compensation on the angle differences with opposite directions, calculate the weighted average of the set of angle differences of the marker line, and use the average value to update the current end direction angle to obtain the corrected end angle direction; S503: Based on the corrected end angle direction, combined with the control point set and rotation speed parameters in the current rotation path, construct a rotation control path parameter set, and use the parameter set as the output control configuration to establish a printed circuit board rotation positioning scheme.

8. The high-precision PCB rotation positioning method based on a rotating arm and image recognition according to claim 1, characterized in that, The aforementioned offset reverse compensation of the angle difference in opposite directions refers to the compensation operation that corrects the rotation direction deviation and restores the target alignment state by inverting the angle difference in opposite directions and applying it to the current position.