Insertion machine alignment method, device, insertion machine and storage medium
By using a combination of 3D and 2D cameras in the plug-in machine, the offset coordinates of the plug-in are calculated, which solves the deviation problem during the plug-in machine alignment operation, and realizes high-precision plug-in insertion, reducing the risk of equipment damage and scrapping.
Patent Information
- Application Number
- CN202411895870.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-12-23
AI Technical Summary
In the prior art, there are deviations in the alignment operation of the plug-in machine, resulting in plug-in insertion errors, which may damage the plug-in or scrap the printed circuit board.
Move the plug-in to the 3D camera field of view through a robot, use the 3D camera to obtain the 3D information of the plug-in, and combine the 2D camera to obtain the 2D information of the hole position, calculate the offset coordinates of the plug-in, and accurately locate the plug-in insertion hole position.
It effectively solves the deviation problem during plug-in machine alignment operation, improves the accuracy of plug-in insertion, and reduces the risk of plug-in damage and printed circuit board scrapping.
Smart Images

Figure CN119364751B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic assembly technology, and in particular to an insertion machine alignment method, device, insertion machine and storage medium. Background Art
[0002] The traditional electronic assembly industry is mainly based on workers, who manually insert electronic components into circuit boards, which is cumbersome and inefficient. With the development of the times, machines are mass-produced, and the speed of manual insertion can no longer meet the needs of the times, and the loopholes of poor craftsmanship are undoubtedly exposed. The manufacture and production of insertion machines have greatly changed this situation. Using insertion machines to automatically install electronic components on circuit boards has improved the level of insertion technology while reducing costs, repeating the same operation, and minimizing the chance of error.
[0003] In the prior art, a 2D camera is used to insert different plug-ins into designated holes. However, due to the poor compatibility of the 2D camera with materials and colors, as well as the problem of skewed plug-ins, the plug-ins may be inserted into the corresponding holes with deviation errors, which may damage the plug-ins at best and scrap the sheet metal at worst. Summary of the invention
[0004] In view of this, the present application provides an insertion machine alignment method, device, insertion machine and storage medium to solve the technical problem of deviation when the insertion machine performs alignment operation.
[0005] A first aspect of the present application provides an insertion machine alignment method, the method comprising:
[0006] The manipulator picks up the plug-in according to its model and moves it to a positioning position within the field of view of the 3D camera, and places the hole position on the printed circuit board corresponding to the plug-in within the field of view of the 2D camera;
[0007] Determine, according to the pixel coordinates of the pin of the plug-in in the 3D pixel coordinate system corresponding to the 3D camera, the first pin mechanical coordinates of the pin in the mechanical coordinate system corresponding to the manipulator;
[0008] Determine the mechanical coordinates of the hole position in the mechanical coordinate system corresponding to the manipulator according to the pixel coordinates of the hole position corresponding to the pin in the 2D pixel coordinate system corresponding to the 2D camera;
[0009] Obtaining a rotation angle of the plug-in around a rotation center according to a difference between a pin angle of the pin in the 3D camera imaging and a hole angle of the hole corresponding to the pin in the 2D camera imaging;
[0010] Obtaining, according to the rotation center coordinates of the rotation center and the first pin mechanical coordinates, a second pin mechanical coordinate after the plug-in is rotated around the rotation center at the rotation angle;
[0011] Obtaining a plug-in offset coordinate according to the second pin mechanical coordinate and the hole position mechanical coordinate;
[0012] The manipulator is controlled to insert the plug-in into the hole according to the plug-in offset coordinates.
[0013] In an optional embodiment, determining the first stitch mechanical coordinate of the stitch in the mechanical coordinate system corresponding to the manipulator according to the pixel coordinate of the stitch of the plug-in in the 3D pixel coordinate system corresponding to the 3D camera comprises:
[0014] Obtaining a 3D rotation matrix and a 3D translation matrix corresponding to the 3D pixel coordinate system;
[0015] Using the 3D rotation matrix and the 3D translation matrix, an affine transformation operation is performed on the pixel coordinates of the pins of the plug-in in the 3D pixel coordinate system to obtain the first pin mechanical coordinates.
[0016] In an optional embodiment, determining the mechanical coordinates of the hole position in the mechanical coordinate system corresponding to the manipulator according to the pixel coordinates of the hole position corresponding to the pin in the 2D pixel coordinate system corresponding to the 2D camera includes:
[0017] Obtaining a 2D rotation matrix and a 2D translation matrix corresponding to the 2D pixel coordinate system;
[0018] Using the 2D rotation matrix and the 2D translation matrix, an affine transformation operation is performed on the pixel coordinates of the hole position corresponding to the stitch in the 2D pixel coordinate system to obtain the mechanical coordinates of the hole position.
[0019] In an optional implementation, the acquiring the 3D rotation matrix and the 3D translation matrix corresponding to the 3D pixel coordinate system includes:
[0020] Control the manipulator to move to N1 calibration points on the calibration plate in sequence within the field of view of the 3D camera, and record the test pixel coordinates of the calibration point at each calibration point of the 3D camera and the test mechanical coordinates of the manipulator;
[0021] Generate a test pixel coordinate matrix based on the N1 test pixel coordinates;
[0022] Generate a test machine coordinate matrix based on the N1 test machine coordinates;
[0023] The 3D rotation matrix and the 3D translation matrix are calculated according to the test pixel coordinate matrix and the test mechanical coordinate matrix.
[0024] In an optional embodiment, obtaining the second pin mechanical coordinates of the plug-in after the plug-in is rotated around the rotation center at the rotation angle according to the rotation center coordinates of the rotation center and the first pin mechanical coordinates includes:
[0025] Substituting the rotation center coordinates, the rotation angle, and the first stitch mechanical coordinates into a preset rotation calculation model, the second stitch mechanical coordinates are obtained.
[0026] In an optional embodiment, the rotation center coordinates of the rotation center are obtained by:
[0027] Controlling the plug-in spindle of the manipulator to rotate N2 times according to a preset rotation angle and a preset rotation direction;
[0028] After each rotation, the 3D camera is used to obtain the pixel coordinates of the marking points on the main axis of the plug-in;
[0029] Perform fitting based on the coordinates of the N2 marked pixels to obtain a fitting circle;
[0030] Obtaining the pixel coordinates of the center of the fitted circle;
[0031] Obtaining corresponding mechanical coordinates of the circle center according to the pixel coordinates of the circle center;
[0032] The rotation center coordinates are determined according to the circle center mechanical coordinates.
[0033] In an optional embodiment, after controlling the manipulator to insert the plug-in into the hole according to the plug-in offset coordinates, the method further includes:
[0034] Determine whether each pin of the plug-in matches a hole corresponding to each pin;
[0035] When each pin of the plug-in does not match the hole position corresponding to each pin, the robot automatically replaces the plug-in with the next plug-in of the same model.
[0036] A second aspect of the present application provides an insertion machine alignment device, the device comprising:
[0037] A moving module is used for the manipulator to absorb the plug-in according to the model of the plug-in and move it to a positioning position within the field of view of the 3D camera, and to place the hole position on the printed circuit board corresponding to the plug-in within the field of view of the 2D camera;
[0038] A determination module, used to determine a first pin mechanical coordinate of the pin in a mechanical coordinate system corresponding to the manipulator according to a pixel coordinate of the pin of the plug-in in a 3D pixel coordinate system corresponding to the 3D camera;
[0039] The determination module is further used to determine the hole position mechanical coordinates of the hole position in the mechanical coordinate system corresponding to the manipulator according to the pixel coordinates of the hole position corresponding to the stitch in the 2D pixel coordinate system corresponding to the 2D camera;
[0040] A calculation module, used to obtain a rotation angle of the plug-in around a rotation center according to a difference between a pin angle of the pin in the 3D camera imaging and a hole angle of a hole corresponding to the pin in the 2D camera imaging;
[0041] A rotation module, used for obtaining, according to the rotation center coordinates of the rotation center and the first pin mechanical coordinates, the second pin mechanical coordinates after the plug-in is rotated around the rotation center at the rotation angle;
[0042] An offset module, used for obtaining a plug-in offset coordinate according to the second pin mechanical coordinate and the hole position mechanical coordinate;
[0043] An assembly module is used to control the manipulator to insert the plug-in into the hole according to the plug-in offset coordinates.
[0044] A third aspect of the present application provides an inserter, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the inserter alignment method when executing the computer program.
[0045] A fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, and the computer program, when executed, implements the steps of the plug-in machine alignment method.
[0046] The present application uses a manipulator to absorb a plug-in according to its model and move it to a positioning position within the field of view of a 3D camera, and places a hole on a printed circuit board corresponding to the plug-in within the field of view of a 2D camera, determines a first pin mechanical coordinate of the pin in a mechanical coordinate system corresponding to the manipulator according to the pixel coordinate of the pin of the plug-in in a 3D pixel coordinate system corresponding to the 3D camera, determines a hole mechanical coordinate of the hole in a mechanical coordinate system corresponding to the manipulator according to the pixel coordinate of the hole corresponding to the pin in a 2D pixel coordinate system corresponding to the 2D camera, obtains a rotation angle of the plug-in around a rotation center according to a difference between a pin angle of the pin in the 3D camera imaging and a hole angle of the hole corresponding to the pin in the 2D camera imaging, obtains a second pin mechanical coordinate of the plug-in after the plug-in is rotated around the rotation center at the rotation angle according to the rotation center coordinate of the rotation center and the first pin mechanical coordinate, obtains a plug-in offset coordinate according to the second pin mechanical coordinate and the hole mechanical coordinate, and controls the manipulator to insert the plug-in into the hole according to the plug-in offset coordinate, so as to solve the technical problem of deviation when the plug-in machine performs alignment operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a hardware structure diagram of a plug-in machine provided in an embodiment of the present application;
[0048] Figure 2 It is a flow chart of a method for aligning an insertion machine provided in an embodiment of the present application;
[0049] Figure 3 is a schematic diagram of a coordinate system in an insertion machine provided in an embodiment of the present application;
[0050] Figure 4 It is a schematic diagram of the corresponding hole positions of the plug-in pins provided in the embodiment of the present application;
[0051] Figure 5 is a schematic diagram of rotation center calibration provided in an embodiment of the present application;
[0052] Figure 6 It is a functional module diagram of an insertion machine alignment device provided in an embodiment of the present application;
[0053] Figure 7 A schematic diagram of the structure of a plug-in machine provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to any or all possible combinations comprising one or more of the listed items.
[0055] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0056] An insertion machine refers to a mechanical device that automatically and standardly inserts some regular electronic components into the conductive through holes of a printed circuit board. It can improve the assembly density of printed circuit boards, improve vibration resistance, increase production efficiency, and reduce production costs.
[0057] In the prior art, a plug-in machine has a built-in 2D camera for inserting plug-ins of different models into designated holes of a printed circuit board. Since the 2D camera cannot identify the material, color, shape, etc. of the plug-in well, it is difficult to accurately judge the different models of similar plug-ins. Furthermore, when inserting the plug-in into the designated hole of the printed circuit board, it is difficult to judge the deviation in the installation process of the plug-in, which may cause damage to the plug-in at the least and scrap the printed circuit board at the worst.
[0058] In order to solve the above-mentioned technical problems existing in the prior art, the embodiments of the present application provide an insertion machine alignment method, device, insertion machine and storage medium.
[0059] See also Figure 1 The figure shows a hardware structure diagram of a plug-in machine provided in an embodiment of the present application. The signal receiving module built into the plug-in machine receives the electrical signal for triggering alignment, and sends the electrical signal for triggering alignment to the 3D sensor and 2D camera corresponding to the 3D camera respectively. The 3D camera and the 2D camera trigger the photo-taking command respectively, and convert the captured image data into byte data streams and send them to the industrial computer. The industrial computer performs logical processing according to the received byte data stream, determines the XYA data for the offset of the manipulator on the industrial computer, and sends the XYA data to the result execution module built into the plug-in machine for the offset alignment operation. Among them, X represents the distance moved by the manipulator in the X direction, Y represents the distance moved by the manipulator in the Y direction, and A represents the rotation angle of the manipulator around the rotation center.
[0060] Figure 2 It is a flow chart of a plug-in machine alignment method provided in an embodiment of the present application. The plug-in machine alignment method is executed by the plug-in machine, and the plug-in machine alignment method specifically includes the following steps.
[0061] S21, the robot arm picks up the plug-in according to the model of the plug-in and moves it to a positioning position within the field of view of the 3D camera, and places the hole position on the printed circuit board corresponding to the plug-in within the field of view of the 2D camera.
[0062] Plug-ins refer to various electronic components installed into the conductive through-holes of printed circuit boards by plug-in machines, including but not limited to: capacitors, inductors, connectors, etc. The plug-in has multiple pins, and each pin is inserted into the corresponding hole to achieve the assembly of the plug-in and the printed circuit board. A manipulator is an automatic operating device that can imitate certain movements of human hands and arms, grab, move objects or operate tools according to a fixed program, and can be programmed to complete various expected operations. The positioning position is the initial movement of the manipulator pre-set by the plug-in machine to absorb the plug-in, which is located within the field of view of the 3D camera.
[0063] A 2D camera is a digital camera built into a plug-in machine specifically for machine vision inspection. The product structure mainly includes lenses, image sensors, processors and displays. It has the characteristics of high speed, high precision, high reliability and is not affected by ambient light. Images are collected through the lens, the image sensor converts light into electronic signals, the processor processes the electronic signals, and finally presents a 2D image on the display.
[0064] A 3D camera is a digital camera that can be used to enjoy stereoscopic images or animations with the naked eye. You can enjoy the effect of stereoscopic images with your naked eyes without using professional glasses. A 3D camera is generally equipped with two lenses so that it can reproduce stereoscopic images. A 2D camera can only provide the surface contour and color information of an object, but cannot obtain the three-dimensional form of the object. In contrast, a 3D camera can provide richer information, including the three-dimensional shape, depth, three-dimensional position, material and texture of the plug-in. By scanning the depth and color data of the plug-in to generate point cloud data and reconstruct it into a 3D model diagram, the three-dimensional information and shape of the plug-in can be obtained to distinguish the model of the plug-in.
[0065] Different plug-in models have different shapes, sizes, and pin numbers, and the corresponding hole positions on the printed circuit board are also different. The plug-in machine determines the model of the plug-in picked up by the robot, and determines the hole position on the printed circuit board corresponding to the plug-in according to the model. The robot picks up the plug-in and moves it to the positioning position within the field of view of the 3D camera, adjusts the position of the 2D camera, and places the corresponding hole position on the printed circuit board of the plug-in within the field of view of the 2D camera.
[0066] In the above optional implementation, the position of the hole on the printed circuit board corresponding to the plug-in is determined by judging the model of the plug-in, and the plug-in is photographed by a 3D camera to obtain the image data corresponding to the plug-in, so that the shape, size, number of pins, and material of the plug-in can be judged to determine the model of the plug-in. Since 3D cameras have problems of poor resolution and low precision, while 2D cameras have high resolution and clear shooting, by adjusting the position of the 2D camera and placing the hole within the field of view of the 2D camera, the position of the hole corresponding to the plug-in on the printed circuit board can be accurately determined.
[0067] S22, determining a first stitch mechanical coordinate of the stitch in a mechanical coordinate system corresponding to the manipulator according to the pixel coordinate of the stitch of the plug-in in the 3D pixel coordinate system corresponding to the 3D camera.
[0068] See also Figure 3 As shown in the figure, it is a schematic diagram of the coordinate system in the plug-in machine. The coordinate system with Or as the coordinate origin is the 2D pixel coordinate system corresponding to the 2D camera, the coordinate system with Ow on the printed circuit board as the coordinate origin is the real world coordinate system, the coordinate system with Oc as the coordinate origin is the 3D pixel coordinate system corresponding to the 3D camera, and the coordinate system with Ot as the coordinate origin is the mechanical coordinate system corresponding to the manipulator.
[0069] The 3D pixel coordinate system is a coordinate system formed by the image captured by the 3D camera. It takes a certain point in the image as the coordinate reference point. The coordinate reference point can be the center point of the image or the endpoint of the upper left corner of the image. Each object in the image captured by the 3D camera corresponds to a pixel coordinate. The mechanical coordinate system is a coordinate system formed by the manipulator as the reference point. The origin of the mechanical coordinate system usually corresponds to a physical point or a reference point of the device. For example, the origin can be the reference point of the manipulator, the x-axis may point to the forward direction of the manipulator, and the y-axis may point to the side of the manipulator. The first stitch mechanical coordinate is the mechanical coordinate corresponding to the stitch in the mechanical coordinate system.
[0070] When the manipulator absorbs the plug-in and moves it to the positioning position within the field of view of the 3D camera, the pixel coordinates of the pins of the plug-in in the 3D pixel coordinate system corresponding to the 3D camera are first obtained, and then the first pin mechanical coordinates of the pins of the plug-in in the mechanical coordinate system corresponding to the manipulator are determined according to the pixel coordinates, that is, the pixel coordinates of the pins of the plug-in in the image are converted into the mechanical coordinates of the pins of the plug-in in the mechanical coordinate system.
[0071] In the above optional implementation, by using a 3D camera to obtain the pixel coordinates of the pins of the plug-in in the pixel coordinate system, and then converting the pixel coordinates into corresponding mechanical coordinates, precise positioning of the mechanical coordinates of the plug-in can be achieved, which helps to ensure accurate position and motion control when the manipulator performs tasks.
[0072] In an optional embodiment, determining the first stitch mechanical coordinate of the stitch in the mechanical coordinate system corresponding to the manipulator according to the pixel coordinate of the stitch of the plug-in in the 3D pixel coordinate system corresponding to the 3D camera comprises:
[0073] Obtaining a 3D rotation matrix and a 3D translation matrix corresponding to the 3D pixel coordinate system;
[0074] Using the 3D rotation matrix and the 3D translation matrix, an affine transformation operation is performed on the pixel coordinates of the pins of the plug-in in the 3D pixel coordinate system to obtain the first pin mechanical coordinates.
[0075] Affine transformation operation refers to an affine transformation or affine mapping between two vector spaces that is geometrically defined. A vector space undergoes a linear transformation and a translation to transform into another vector space. A linear transformation corresponds to a rotation coefficient, and a translation transformation corresponds to a translation coefficient. A 3D rotation matrix refers to a matrix composed of rotation coefficients corresponding to the conversion of pixel coordinates in a 3D pixel coordinate system into mechanical coordinates through an affine transformation. A 3D translation matrix refers to a matrix composed of translation coefficients corresponding to the conversion of pixel coordinates in a 3D pixel coordinate system into mechanical coordinates through an affine transformation.
[0076] In practical applications, the coordinates of the pins of the plug-in that are photographed need to be reflected in the mechanical coordinate system where the manipulator is located, so the pixel coordinates of the plug-in imaged by the 3D camera need to be converted into mechanical coordinates in the mechanical coordinate system through affine transformation operations. That is, by using the 3D rotation matrix and the 3D translation matrix, the pixel coordinates of the pins of the plug-in imaged by the 3D camera in the 3D pixel coordinate system are affine transformed, and the first pin mechanical coordinates of the pins of the plug-in in the mechanical coordinate system corresponding to the manipulator can be obtained.
[0077] For example, assuming that the 3D camera takes an exposure photo, the pixel coordinates of the pins of the plug-in are obtained as , the 3D rotation matrix is , the 3D translation matrix is , through the 3D rotation matrix and 3D translation matrix to the pixel coordinates After performing the affine transformation operation, the mechanical coordinates of the first pin of the plug-in pin in the mechanical coordinate system are obtained. The process is as follows:
[0078] ;make , ,but .
[0079] In the above optional implementation, the 3D rotation matrix and the 3D translation matrix corresponding to the 3D pixel coordinate system are obtained, and any pixel coordinate in the 3D pixel coordinate system corresponding to the 3D camera can be converted into a mechanical coordinate in the mechanical coordinate system through the 3D rotation matrix and the 3D translation matrix, so as to achieve the unification of the 3D pixel coordinate system and the mechanical coordinate.
[0080] In an optional implementation, the acquiring the 3D rotation matrix and the 3D translation matrix corresponding to the 3D pixel coordinate system includes:
[0081] Control the manipulator to move to N1 calibration points on the calibration plate in sequence within the field of view of the 3D camera, and record the test pixel coordinates of the calibration point at each calibration point of the 3D camera and the test mechanical coordinates of the manipulator;
[0082] Generate a test pixel coordinate matrix based on the N1 test pixel coordinates;
[0083] Generate a test machine coordinate matrix based on the N1 test machine coordinates;
[0084] The 3D rotation matrix and the 3D translation matrix are calculated according to the test pixel coordinate matrix and the test mechanical coordinate matrix.
[0085] The calibration board refers to a board used to determine the conversion relationship between pixel coordinates and mechanical coordinates in machine vision. By shooting the calibration board with a camera, the image coordinates of a certain point in the camera image and the mechanical coordinates in the corresponding mechanical coordinate system of the robot can be obtained. The calibration board can be a flat plate with a fixed-pitch pattern array or a printed circuit board without plug-ins inserted. Among them, the calibration point can be a specific marking point on the printed circuit board or a hole feature point corresponding to the insertion position of a plug-in. The calibration point position can be convenient for camera shooting and recognition.
[0086] The manipulator moves to the calibration point position, and the camera identifies each calibration point on the printed circuit board, and obtains the mechanical coordinates and pixel coordinates corresponding to each calibration point, thereby completing the unification of the mechanical coordinate system and the pixel coordinate system. The calibration board is fixed on the workbench with a fixed point and a fixed edge as reference. The camera takes a picture and identifies a calibration point on the calibration board. The 3D camera will expose once to acquire an image, and obtain the pixel coordinates of the calibration point from the acquired image. The pixel coordinates obtained at this time are called test pixel coordinates. N1 positions correspond to N1 images, and N1 images correspond to N1 test pixel coordinates. After the manipulator moves to the center position of a marking point, the mechanical coordinates of the manipulator are obtained. The mechanical coordinates obtained at this time are called test mechanical coordinates. N1 positions correspond to N1 test mechanical coordinates. The test pixel coordinates of each position correspond to the test mechanical coordinates of that position one by one.
[0087] For example, the manipulator moves to the three calibration points on the calibration plate, and then the corresponding three test pixel coordinates are obtained. , , , and correspondingly obtain 3 test mechanical coordinates , , .
[0088] Based on 3 test pixel coordinates , , The generated test pixel coordinate matrix is , based on 3 test machine coordinates , , The generated test machine coordinate matrix is , respectively as follows:
[0089] ; ;
[0090] The test pixel coordinate matrix is multiplied by the affine transformation matrix to obtain the test mechanical coordinate matrix, and the affine transformation matrix is calculated.
[0091] Calculate the test pixel coordinate matrix The inverse matrix , according to the inverse matrix And test mechanical coordinate matrix , calculate the affine transformation matrix . Inverse Matrix and the affine transformation matrix They are as follows:
[0092] ; ;in, is the 3D rotation matrix, is the 3D translation matrix.
[0093] It should be noted that the number of test pixel coordinates and corresponding test mechanical coordinates is at least 3. The more test pixel coordinates and corresponding test mechanical coordinates there are, the higher the accuracy of the calculated 3D rotation matrix and 3D translation matrix.
[0094] After obtaining the 3D rotation matrix and the 3D translation matrix, during the subsequent plug-in assembly, the 3D camera captures an image of the plug-in once and obtains the pixel coordinates of the pins of the plug-in in the pixel coordinate system, which can be converted into mechanical coordinates in the mechanical coordinate system where the pins of the plug-in are located through the 3D rotation matrix and the 3D translation matrix.
[0095] In the above optional implementation, a test pixel coordinate matrix is generated based on N1 test pixel coordinates, and a test mechanical coordinate matrix is generated based on N1 test mechanical coordinates, so that the obtained multiple test pixel coordinates and test mechanical coordinates can be intuitively represented and easy to calculate. According to the test pixel coordinate matrix and the test mechanical coordinate matrix, a 3D rotation matrix and a 3D translation matrix are calculated, so that the pixel coordinates of the 3D camera imaging can be subsequently subjected to affine transformation operations by using the 3D rotation matrix and the 3D translation matrix to obtain the corresponding mechanical coordinates, which is helpful for effective information transmission and unified integration of coordinates between different coordinate systems.
[0096] S23, determining the mechanical coordinates of the hole position in the mechanical coordinate system corresponding to the manipulator according to the pixel coordinates of the hole position corresponding to the stitch in the 2D pixel coordinate system corresponding to the 2D camera.
[0097] The hole position mechanical coordinates are the corresponding mechanical coordinates in the mechanical coordinate system obtained by converting the pixel coordinates of the hole position corresponding to the pin of the plug-in in the 2D pixel coordinate system corresponding to the 2D camera through the radiometric transformation operation.
[0098] In an optional embodiment, determining the mechanical coordinates of the hole position in the mechanical coordinate system corresponding to the manipulator according to the pixel coordinates of the hole position corresponding to the pin in the 2D pixel coordinate system corresponding to the 2D camera includes:
[0099] Obtaining a 2D rotation matrix and a 2D translation matrix corresponding to the 2D pixel coordinate system;
[0100] Using the 2D rotation matrix and the 2D translation matrix, an affine transformation operation is performed on the pixel coordinates of the hole position corresponding to the stitch in the 2D pixel coordinate system to obtain the mechanical coordinates of the hole position.
[0101] The 2D rotation matrix refers to the matrix composed of the corresponding rotation coefficients when the pixel coordinates in the 2D pixel coordinate system are converted to the mechanical coordinates through the affine transformation. The 2D translation matrix refers to the matrix composed of the corresponding translation coefficients when the pixel coordinates in the 2D pixel coordinate system are converted to the mechanical coordinates through the affine transformation.
[0102] Place the printed circuit board in the field of view of the 2D camera, mark the hole positions on the printed circuit board, and use the 2D camera to capture the hole area on the printed circuit board to obtain the hole area image of the printed circuit board under the field of view of the 2D camera. Use the feature recognition algorithm of the plug-in machine to perform feature recognition on the mark points of the hole area image to obtain the test pixel coordinates at the calibration point, and use the industrial computer to obtain the test mechanical coordinates of the corresponding hole positions. In this way, the test pixel coordinates of the mark points of N1' hole positions and the corresponding N1' test mechanical coordinates are obtained. Figure 4The figure shows the schematic diagram of the corresponding hole positions of the plug-in pins.
[0103] A test pixel coordinate matrix is generated based on N1' test pixel coordinates, and a test mechanical coordinate matrix is generated based on N1' test mechanical coordinates. According to the test pixel coordinate matrix and the test mechanical coordinate matrix, a 2D rotation matrix and a 2D translation matrix are calculated. The specific calculation process is the same as that for calculating the 3D rotation matrix and the 3D translation matrix, and will not be repeated here.
[0104] In practical applications, the coordinates of the hole positions need to be reflected in the mechanical coordinate system, so the pixel coordinates of the hole positions in the 2D camera image need to be converted into the mechanical coordinates in the mechanical coordinate system through affine transformation operations. That is, by using the 2D rotation matrix and the 2D translation matrix, the pixel coordinates of the hole positions in the 2D pixel coordinate system of the 2D camera image are affine transformed, and the mechanical coordinates of the hole positions in the mechanical coordinate system can be obtained.
[0105] For example, assuming that a 2D camera takes an exposure photo, the pixel coordinates of the hole position are obtained as , the 2D rotation matrix is , the 2D translation matrix is , pixel coordinates are transformed by 2D rotation matrix and 2D translation matrix After affine transformation operation, the mechanical coordinates of the hole position in the mechanical coordinate system are obtained. The process is as follows:
[0106] ;make , ,but .
[0107] In the above optional implementation, the 2D rotation matrix and the 2D translation matrix corresponding to the 2D pixel coordinate system are obtained, and any pixel coordinate in the 2D pixel coordinate system corresponding to the 2D camera can be converted into a mechanical coordinate in the mechanical coordinate system through the 2D rotation matrix and the 2D translation matrix, so as to achieve the unification of the 2D pixel coordinate system and the mechanical coordinate.
[0108] S24, obtaining a rotation angle of the plug-in around a rotation center according to a difference between a pin angle of the pin in the 3D camera imaging and a hole angle of the hole corresponding to the pin in the 2D camera imaging.
[0109] The pin angle refers to the angle between the projection line of the line connecting the two pins in the 3D camera imaging on the printed circuit board and the horizontal line of the printed circuit board. The hole angle refers to the angle between the line connecting the two holes in the 2D camera imaging and the horizontal line of the printed circuit board where the holes are located. The rotation center is the joint axis of the manipulator plug-in spindle. On the rotation axis of the joint, the rotation joint of the manipulator can be controlled to rotate at an angle. The rotation angle is the angle at which the rotation joint of the manipulator is controlled to rotate.
[0110] Get the projection lines of a group of pins of the plug-in in the 3D camera imaging projected on the printed circuit board, measure the angle between the projection line and the horizontal line of the printed circuit board, and the obtained angle is the pin angle. Get the connecting lines of a group of holes on the printed circuit board in the 2D camera imaging, measure the angle between the connecting lines and the horizontal line of the printed circuit board, and the obtained angle is the hole angle. Calculate the difference between the pin angle and the hole angle to get the rotation angle of the plug-in around the rotation center, that is, the angle of rotation of the rotary joint of the manipulator. When the difference between the pin angle and the hole angle is a positive number, the rotary joint of the manipulator controls the plug-in to rotate in a clockwise direction. When the difference between the pin angle and the hole angle is 0, it means that the pins of the plug-in completely correspond to the hole positions, and the rotary joint of the manipulator does not need to rotate. When the difference between the pin angle and the hole angle is a negative number, the rotary joint of the manipulator controls the plug-in to rotate in a counterclockwise direction.
[0111] For example, assuming that the pin angle is 30 degrees and the hole angle is -20 degrees, the rotation angle is 50 degrees and the rotation direction is clockwise. Assuming that the pin angle is -30 degrees and the hole angle is 20 degrees, the rotation angle is 50 degrees and the rotation direction is counterclockwise.
[0112] In the above optional implementation, the difference between the pin angle in the 3D camera imaging and the hole angle corresponding to the pin in the 2D camera imaging is calculated to obtain the angle difference between the pin and the hole, so as to adjust the position and orientation of the plug-in in real time, ensure that the pin of the plug-in can be correctly inserted into the hole, and realize more precise positioning of the pin position of the plug-in.
[0113] S25, obtaining, according to the rotation center coordinates of the rotation center and the first pin mechanical coordinates, a second pin mechanical coordinate after the plug-in is rotated around the rotation center at the rotation angle.
[0114] The rotation center coordinates are the mechanical coordinates corresponding to the joint axis of the main axis of the plug-in of the manipulator. The second pin mechanical coordinates are the mechanical coordinates corresponding to the pin of the plug-in after rotation in the mechanical coordinate system.
[0115] The plug-in spindle of the manipulator controls the plug-in to rotate in the corresponding rotation direction at the corresponding rotation angle, and obtains the second pin mechanical coordinates corresponding to the pin of the rotated plug-in according to the rotation center coordinates of the rotation center and the first pin mechanical coordinates.
[0116] In an optional embodiment, obtaining the second pin mechanical coordinates of the plug-in after the plug-in is rotated around the rotation center at the rotation angle according to the rotation center coordinates of the rotation center and the first pin mechanical coordinates includes:
[0117] Substituting the rotation center coordinates, the rotation angle, and the first stitch mechanical coordinates into a preset rotation calculation model, the second stitch mechanical coordinates are obtained.
[0118] The manipulator obtains the mechanical coordinates of the second pin corresponding to the pin of the plug-in after rotation through the preset rotation calculation model. Substitute the rotation center coordinates, rotation angle, and first pin mechanical coordinates into the preset rotation calculation model for calculation to obtain the second pin mechanical coordinates. The preset rotation calculation model can be expressed by the following formula:
[0119] x= (x1 - x2)cos(θ) - (y1 - y2)sin(θ) + x2;
[0120] y= (x1 - x2)sin(θ) + (y1 - y2)cos(θ) + y2 .
[0121] Among them, the mechanical coordinates of the first pin are (x1, y1), the rotation center coordinates are (x2, y2), the rotation angle is θ, and the mechanical coordinates of the second pin are (x, y).
[0122] Exemplarily, assuming that the mechanical coordinates of the first pin are (4, 4), the rotation center coordinates are (0, 0), and the rotation angle is 50 degrees, substituting into the preset rotation calculation model, the mechanical coordinates of the second pin are (-0.49, 5.63).
[0123] In the above optional implementation, by substituting the rotation center coordinates, rotation angle, and first pin mechanical coordinates into a preset rotation calculation model for calculation, the second pin mechanical coordinates are obtained, and the mechanical coordinates of the pin of the plug-in after rotation around the rotation center are obtained. The mechanical coordinates of the pin position change are obtained in real time, thereby improving the positioning accuracy and reliability of the plug-in machine.
[0124] In an optional embodiment, the rotation center coordinates of the rotation center are obtained by:
[0125] Controlling the plug-in spindle of the manipulator to rotate N2 times according to a preset rotation angle and a preset rotation direction;
[0126] After each rotation, the 3D camera is used to obtain the pixel coordinates of the marking points on the main axis of the plug-in;
[0127] Perform fitting based on the coordinates of the N2 marked pixels to obtain a fitting circle;
[0128] Obtaining the pixel coordinates of the center of the fitted circle;
[0129] Obtaining corresponding mechanical coordinates of the circle center according to the pixel coordinates of the circle center;
[0130] The rotation center coordinates are determined according to the circle center mechanical coordinates.
[0131] The preset rotation angle is a preset angle value for the rotation of the main axis of the control plug-in. The preset rotation angle can be set to an acute angle to facilitate marking the rotation point. The preset rotation direction can be clockwise or counterclockwise. For example, see Figure 5 As shown, this is a schematic diagram of rotation center calibration. The robot is controlled to rotate once every 30° in a clockwise direction, for a total of 6 rotations.
[0132] A marking point is set on the manipulator's plug-in spindle, which controls the plug-in spindle to rotate N2 times (according to the three-point circle principle, N2>=3) at a preset rotation angle in the preset rotation direction. After each rotation, the pixel coordinates of the marking point of the plug-in spindle are obtained through the 3D camera. The pixel coordinates of the marking point are used as the marking pixel coordinates. N2 rotations correspond to N2 marking pixel coordinates. According to the three-point circle principle, fitting is performed based on the N2 marking pixel coordinates to obtain the fitting circle, and the pixel coordinates of the center of the fitting circle are obtained. Through the 3D rotation matrix and the 3D translation matrix After performing affine transformation operation on the circle center pixel coordinates, the circle center mechanical coordinates corresponding to the circle center pixel coordinates are obtained, and the circle center mechanical coordinates are determined as the rotation center coordinates of the plug-in spindle.
[0133] For example, assume that the pixel coordinates of the center of the circle are , according to the 3D rotation matrix and the 3D translation matrix The pixel coordinates of the center of the circle Perform affine transformation to obtain the mechanical coordinates of the circle center The process is as follows:
[0134] ;
[0135] In the above optional implementation, a 3D camera is used to obtain the pixel coordinates of the marking points on the main axis of the plug-in, and a circle is fitted based on the pixel coordinates of the marking points to determine the pixel coordinates of the center of the circle. The pixel coordinates of the marking points can be automatically identified and processed without manual intervention, thereby improving the level of automation and providing high-precision positioning and measurement. and the 3D translation matrix The pixel coordinates of the circle center are converted into the mechanical coordinates of the circle center to obtain the rotation center coordinates. The pixel coordinates of the fitting circle center can be unified into the mechanical coordinates of the mechanical coordinate system, so that the manipulator can perform actual execution actions according to the mechanical coordinates.
[0136] S26, obtaining the plug-in offset coordinates according to the second pin mechanical coordinates and the hole position mechanical coordinates.
[0137] The plug-in offset coordinates are the reference for the robot to control the plug-in to move its position, and are the position coordinates for the robot to control the plug-in to shift in the x and y directions. The plug-in offset coordinates are the difference between the mechanical coordinates of the second pin and the mechanical coordinates of the hole.
[0138] The difference between the horizontal coordinate value of the second stitch mechanical coordinate and the horizontal coordinate value of the hole position mechanical coordinate is calculated to obtain the horizontal coordinate value of the second stitch mechanical coordinate, and the difference between the vertical coordinate value of the second stitch mechanical coordinate and the vertical coordinate value of the hole position mechanical coordinate is calculated to obtain the vertical coordinate value of the second stitch mechanical coordinate.
[0139] In the above optional implementation, by respectively calculating the horizontal coordinate difference and the vertical coordinate difference between the second pin mechanical coordinate and the hole position mechanical coordinate, the offset coordinate is obtained, so that the position difference between the pin and the hole position can be determined, and the distance the robot moves can be controlled according to the offset coordinate to correct the error and achieve precise positioning and assembly.
[0140] S27, controlling the manipulator to insert the plug-in into the hole according to the plug-in offset coordinates.
[0141] The robot is controlled to move a distance in a corresponding direction according to the offset coordinates, and the robot is controlled to absorb the plug-in and move the distance of the horizontal coordinate value in the x direction, move the distance of the vertical coordinate value in the y direction, and insert the pins of the plug-in into the corresponding holes.
[0142] In an optional embodiment, after controlling the manipulator to insert the plug-in into the hole according to the plug-in offset coordinates, the method further includes:
[0143] Determine whether each pin of the plug-in matches a hole corresponding to each pin;
[0144] When each pin of the plug-in does not match the hole position corresponding to each pin, the robot automatically replaces the plug-in with the next plug-in of the same model.
[0145] After the pins of the plug-in are inserted into the corresponding holes, the 2D camera captures an image of the area where the pins and the holes are combined to obtain a pin-hole combined image, and features are extracted for each pin and the corresponding hole, including the shape, size, and relative position information of the pin and the hole. Based on the feature-extracted information, geometric matching is performed to determine whether the difference between the center of the pin and the center of the corresponding hole meets a preset error threshold. When the difference between the center of the pin and the center of the hole is less than or equal to the preset error threshold, it is determined that the pin of the plug-in matches the hole corresponding to the pin. When the difference between the center of the pin and the center of the hole is greater than the preset error threshold, it is determined that the pin of the plug-in does not match the hole corresponding to the pin.
[0146] When each pin of the plug-in matches the corresponding hole position of each pin, it indicates that the plug-in is successfully assembled with the corresponding hole position on the printed circuit board. When each pin of the plug-in does not match the corresponding hole position of each pin, the robot automatically replaces the plug-in with the next plug-in of the same model.
[0147] In the above optional implementation, after controlling the robot to insert the plug-in into the hole according to the offset coordinates of the plug-in, it determines whether each pin matches the hole corresponding to each pin and automatically replaces the plug-in if it does not match. An extra layer of matching verification is added to improve the accuracy of the plug-in machine's positioning, and it can quickly respond to mismatches without interrupting production, thereby improving production efficiency and reducing error rates. Automatic replacement of plug-ins reduces manual intervention, reduces labor costs, and can adapt to changes in plug-ins of different models.
[0148] In this application, since 3D cameras have the problems of poor resolution and low accuracy, while 2D cameras have higher resolution and clear pictures, by adjusting the position of the 2D camera and placing the hole position within the field of view of the 2D camera, the position of the hole position corresponding to the plug-in on the printed circuit board can be accurately determined, and the plug-in can be moved to a positioning position within the field of view of the 3D camera to determine the type of the plug-in; the first pin mechanical coordinates of the pin in the mechanical coordinate system corresponding to the manipulator are determined according to the pixel coordinates of the pin of the plug-in in the 3D pixel coordinate system corresponding to the 3D camera, so as to achieve precise positioning of the mechanical coordinates of the plug-in, which helps to ensure accurate position and motion control when the manipulator performs tasks; the mechanical coordinates of the hole position in the mechanical coordinate system corresponding to the manipulator are determined according to the pixel coordinates of the hole position corresponding to the pin in the 2D pixel coordinate system corresponding to the 2D camera, and the 2D pixel coordinate system is converted to the mechanical Coordinate system; according to the difference between the pin angle of the pin in the 3D camera imaging and the hole angle of the hole corresponding to the pin in the 2D camera imaging, the rotation angle of the plug-in around the rotation center is obtained, and the position and orientation of the plug-in can be adjusted in real time to ensure that the pins of the plug-in can be correctly inserted into the holes, so as to achieve more accurate positioning of the pin position of the plug-in; according to the rotation center coordinates of the rotation center and the first pin mechanical coordinates, the second pin mechanical coordinates of the plug-in after the plug-in is rotated around the rotation center at the rotation angle are obtained, and the mechanical coordinates of the pin position change after the rotation of the plug-in can be obtained, so as to improve the positioning accuracy and reliability of the plug-in machine; according to the second pin mechanical coordinates and the hole mechanical coordinates, the plug-in offset coordinates are obtained, and the manipulator is controlled to insert the plug-in into the hole according to the plug-in offset coordinates, so as to correct the distance error between the pin of the plug-in and the corresponding hole, so as to achieve accurate positioning and assembly.
[0149] Figure 6 60 is a functional module diagram of the plug-in machine alignment device shown in an embodiment of the present application. In some embodiments, the plug-in machine alignment device 60 may include multiple functional modules composed of computer program segments. The computer program of each program segment in the plug-in machine alignment device 60 may be stored in the memory of the plug-in machine and executed by at least one processor to execute (see Figure 2 Description) The function of the plug-in machine alignment.
[0150] In this embodiment, the insertion machine alignment device 60 can be divided into multiple functional modules according to the functions it performs. The functional modules may include: a moving module 601, a determining module 602, a calculating module 603, a rotating module 604, an offset module 605, an assembling module 606, a judging module 607 and a replacing module 608. The module referred to in the present invention refers to a series of computer program segments that can be executed by at least one processor and can complete fixed functions, which are stored in a memory.
[0151] The moving module 601 is used for the manipulator to absorb the plug-in according to the model of the plug-in and move it to a positioning position within the field of view of the 3D camera, and to place the hole position on the printed circuit board corresponding to the plug-in within the field of view of the 2D camera.
[0152] The determination module 602 is used to determine a first stitch mechanical coordinate of the stitch in a mechanical coordinate system corresponding to the manipulator according to the pixel coordinate of the stitch of the plug-in in the 3D pixel coordinate system corresponding to the 3D camera.
[0153] The determination module 602 is further configured to determine the hole position mechanical coordinates in the mechanical coordinate system corresponding to the manipulator according to the pixel coordinates of the hole position corresponding to the stitch in the 2D pixel coordinate system corresponding to the 2D camera.
[0154] The calculation module 603 is used to obtain the rotation angle of the plug-in around the rotation center according to the difference between the pin angle of the pin in the 3D camera imaging and the hole angle of the hole corresponding to the pin in the 2D camera imaging.
[0155] The rotation module 604 is used to obtain the second pin mechanical coordinates of the plug-in after the plug-in is rotated around the rotation center at the rotation angle according to the rotation center coordinates of the rotation center and the first pin mechanical coordinates.
[0156] The offset module 605 is used to obtain the plug-in offset coordinates according to the second pin mechanical coordinates and the hole position mechanical coordinates.
[0157] The assembly module 606 is used to control the manipulator to insert the plug-in into the hole according to the plug-in offset coordinates.
[0158] The judging module 607 is used to judge whether each pin of the plug-in matches the hole position corresponding to each pin.
[0159] The replacement module 608 is used for automatically replacing the plug-in with the next plug-in of the same model by the robot when each pin of the plug-in does not match the hole position corresponding to each pin.
[0160] It should be understood that the various variations and specific embodiments of the plug-in machine alignment method provided in the above-mentioned embodiment are also applicable to the plug-in machine alignment device in this embodiment. Through the aforementioned detailed description of the plug-in machine alignment method, those skilled in the art can clearly know the implementation process of the plug-in machine alignment device in this embodiment. For the sake of brevity of the specification, it will not be described in detail here.
[0161] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, all or part of the steps of the plug-in machine alignment method are implemented.
[0162] See also Figure 7 FIG. 2 is a schematic diagram of the structure of the plug-in machine provided in the embodiment of the present application. In a preferred embodiment of the present application, the plug-in machine includes a memory 71 , at least one processor 72 , and at least one communication bus 73 .
[0163] Those skilled in the art should understand that Figure 7 The structure of the plug-in machine shown does not constitute a limitation of the embodiments of the present application, and can be either a bus structure or a star structure. The plug-in machine 7 can also include more or less other hardware or different component arrangements than shown in the figure.
[0164] In some embodiments, the plug-in machine 7 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits, programmable gate arrays, digital processors, and embedded devices. The plug-in machine 7 may also include client devices, which include but are not limited to any electronic product that can interact with the client through a keyboard, mouse, remote control, touchpad, or voice control device, such as a personal computer, tablet computer, smart phone, digital camera, etc.
[0165] In some embodiments, the memory 71 stores a computer program, and when the computer program is executed by the at least one processor 72, all or part of the steps in the plug-in machine alignment method as described above are implemented. The memory 71 includes a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data. Further, the computer-readable storage medium mainly includes a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function, and the like.
[0166] In some embodiments, the at least one processor 72 is the control core (ControlUnit) of the plug-in machine 7, and uses various interfaces and lines to connect various components of the entire plug-in machine 7, and executes various functions of the plug-in machine 7 and processes data by running or executing programs or modules stored in the memory 71, and calling data stored in the memory 71. For example, when the at least one processor 72 executes the computer program stored in the memory, it implements all or part of the steps of the plug-in machine alignment method described in the embodiment of the present application; or implements all or part of the functions of the plug-in machine alignment device. The at least one processor 72 can be composed of an integrated circuit, for example, it can be composed of a single packaged integrated circuit, or it can be composed of multiple integrated circuits with the same function or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips.
[0167] In some embodiments, the at least one communication bus 73 is configured to realize connection and communication between the memory 71 and the at least one processor 72, etc. Although not shown, the plug-in machine 7 may also include a power supply (such as a battery) for powering each component. Preferably, the power supply may be logically connected to the at least one processor 72 through a power management device, so that the power management device can realize functions such as management of charging, discharging, and power consumption management. The power supply may also include any components such as one or more DC or AC power supplies, recharging devices, power fault detection circuits, power converters or inverters, power status indicators, etc. The plug-in machine 7 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0168] The above integrated unit implemented in the form of software function modules can be stored in a computer-readable storage medium. The above software function modules are stored in a storage medium and include several instructions for a processor to execute parts of the methods described in various embodiments of the present application.
[0169] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0170] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0171] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.
Claims
1. A method for aligning an insertion machine, characterized in that: The method comprises: The manipulator picks up the plug-in according to its model and moves it to a positioning position within the field of view of the 3D camera, and places the hole position on the printed circuit board corresponding to the plug-in within the field of view of the 2D camera; Determine, according to the pixel coordinates of the pin of the plug-in in the 3D pixel coordinate system corresponding to the 3D camera, the first pin mechanical coordinates of the pin in the mechanical coordinate system corresponding to the manipulator; Determine the mechanical coordinates of the hole position in the mechanical coordinate system corresponding to the manipulator according to the pixel coordinates of the hole position corresponding to the pin in the 2D pixel coordinate system corresponding to the 2D camera; According to the difference between the pin angle of the pin in the 3D camera imaging and the hole angle of the hole corresponding to the pin in the 2D camera imaging, the rotation angle of the plug-in around the rotation center is obtained, wherein the pin angle refers to the angle between the projection line of the line connecting the two pins in the 3D camera imaging on the printed circuit board and the horizontal line of the printed circuit board, and the hole angle refers to the angle between the line connecting the two holes in the 2D camera imaging and the horizontal line of the printed circuit board where the holes are located; Obtaining, according to the rotation center coordinates of the rotation center and the first pin mechanical coordinates, a second pin mechanical coordinate after the plug-in is rotated around the rotation center at the rotation angle; Obtaining a plug-in offset coordinate according to the second pin mechanical coordinate and the hole position mechanical coordinate; Controlling the manipulator to insert the plug-in into the hole according to the plug-in offset coordinates; The obtaining, according to the rotation center coordinates of the rotation center and the first pin mechanical coordinates, of the second pin mechanical coordinates after the plug-in is rotated around the rotation center at the rotation angle comprises: Substituting the rotation center coordinates, the rotation angle, and the first stitch mechanical coordinates into a preset rotation calculation model, the second stitch mechanical coordinates are obtained; wherein the preset rotation calculation model can be expressed by the following formula: x=(x1-x2)cos(θ)-(y1-y2)sin(θ)+x2; y=(x1-x2)sin(θ)+(y1-y2)cos(θ)+y2; Among them, the mechanical coordinates of the first pin are (x1, y1), the coordinates of the rotation center are (x2, y2), the rotation angle is θ, and the mechanical coordinates of the second pin are (x, y).
2. The insertion machine alignment method according to claim 1, characterized in that: Determining the first stitch mechanical coordinate of the stitch in the mechanical coordinate system corresponding to the manipulator according to the pixel coordinate of the stitch of the plug-in in the 3D pixel coordinate system corresponding to the 3D camera comprises: Obtaining a 3D rotation matrix and a 3D translation matrix corresponding to the 3D pixel coordinate system; Using the 3D rotation matrix and the 3D translation matrix, an affine transformation operation is performed on the pixel coordinates of the pins of the plug-in in the 3D pixel coordinate system to obtain the first pin mechanical coordinates.
3. The insertion machine alignment method according to claim 1, characterized in that: Determining the mechanical coordinates of the hole position in the mechanical coordinate system corresponding to the manipulator according to the pixel coordinates of the hole position corresponding to the pin in the 2D pixel coordinate system corresponding to the 2D camera comprises: Obtaining a 2D rotation matrix and a 2D translation matrix corresponding to the 2D pixel coordinate system; Using the 2D rotation matrix and the 2D translation matrix, an affine transformation operation is performed on the pixel coordinates of the hole position corresponding to the stitch in the 2D pixel coordinate system to obtain the mechanical coordinates of the hole position.
4. The insertion machine alignment method according to claim 2, characterized in that: The obtaining of the 3D rotation matrix and the 3D translation matrix corresponding to the 3D pixel coordinate system comprises: Control the manipulator to move to N1 calibration points on the calibration plate in sequence within the field of view of the 3D camera, and record the test pixel coordinates of the calibration point at each calibration point of the 3D camera and the test mechanical coordinates of the manipulator; Generate a test pixel coordinate matrix based on the N1 test pixel coordinates; Generate a test machine coordinate matrix based on the N1 test machine coordinates; The 3D rotation matrix and the 3D translation matrix are calculated according to the test pixel coordinate matrix and the test mechanical coordinate matrix.
5. The insertion machine alignment method according to claim 1, characterized in that: The rotation center coordinates of the rotation center are obtained by: Controlling the plug-in spindle of the manipulator to rotate N2 times according to a preset rotation angle and a preset rotation direction; After each rotation, the 3D camera is used to obtain the pixel coordinates of the marking points on the main axis of the plug-in; Perform fitting based on the coordinates of the N2 marked pixels to obtain a fitting circle; Obtaining the pixel coordinates of the center of the fitted circle; Obtaining corresponding mechanical coordinates of the circle center according to the pixel coordinates of the circle center; The rotation center coordinates are determined according to the circle center mechanical coordinates.
6. The insertion machine alignment method according to any one of claims 1 to 5, characterized in that: After controlling the manipulator to insert the plug-in into the hole according to the plug-in offset coordinates, the method further includes: Determine whether each pin of the plug-in matches a hole corresponding to each pin; When each pin of the plug-in does not match the hole position corresponding to each pin, the robot automatically replaces the plug-in with the next plug-in of the same model.
7. An insertion machine alignment device, characterized in that: The device comprises: A moving module is used for the manipulator to absorb the plug-in according to the model of the plug-in and move it to a positioning position within the field of view of the 3D camera, and to place the hole position on the printed circuit board corresponding to the plug-in within the field of view of the 2D camera; A determination module, used to determine a first pin mechanical coordinate of the pin in a mechanical coordinate system corresponding to the manipulator according to a pixel coordinate of the pin of the plug-in in a 3D pixel coordinate system corresponding to the 3D camera; The determination module is further used to determine the hole position mechanical coordinates of the hole position in the mechanical coordinate system corresponding to the manipulator according to the pixel coordinates of the hole position corresponding to the stitch in the 2D pixel coordinate system corresponding to the 2D camera; A calculation module, for obtaining a rotation angle of the plug-in around the rotation center according to a difference between a pin angle of the pin in the 3D camera imaging and a hole angle of the hole corresponding to the pin in the 2D camera imaging, wherein the pin angle refers to an angle between a projection line of a line connecting two pins in the 3D camera imaging on a printed circuit board and a horizontal line of the printed circuit board, and the hole angle refers to an angle between a line connecting two holes in the 2D camera imaging and a horizontal line of the printed circuit board where the holes are located; A rotation module, used for obtaining, according to the rotation center coordinates of the rotation center and the first pin mechanical coordinates, the second pin mechanical coordinates after the plug-in is rotated around the rotation center at the rotation angle; An offset module, used for obtaining a plug-in offset coordinate according to the second pin mechanical coordinate and the hole position mechanical coordinate; An assembly module, used for controlling the manipulator to insert the plug-in into the hole according to the offset coordinates of the plug-in; The rotation module is specifically used for: Substituting the rotation center coordinates, the rotation angle, and the first stitch mechanical coordinates into a preset rotation calculation model, the second stitch mechanical coordinates are obtained; wherein the preset rotation calculation model can be expressed by the following formula: x=(x1-x2)cos(θ)-(y1-y2)sin(θ)+x2; y=(x1-x2)sin(θ)+(y1-y2)cos(θ)+y2; Among them, the mechanical coordinates of the first pin are (x1, y1), the coordinates of the rotation center are (x2, y2), the rotation angle is θ, and the mechanical coordinates of the second pin are (x, y).
8. An insertion machine, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the plug-in machine alignment method as claimed in any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the insertion machine alignment method as described in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Industrial robot 3D vision precision plug-in mounting guide control method of disc type multi-station gripper
CN114260903A