A multi-specification workpiece planning and grabbing method and system based on a 2D drawing
Patent Information
- Application Number
- CN202611397271.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-09
- Publication Date
- 2026-10-30
AI Technical Summary
[0005]针对现有技术中提到的问题,本发明提出一种基于2D图纸的多规格工件规划抓取方法及系统,通过获取2D图纸中各类工件信息,通过算法解析,最终在软件端实现抓取位姿规划和展示功能,并将抓取位姿发送到机械臂,最终实现精准抓取,旨在解决仅提取图纸二维轮廓几何信息,无法关联工件重心、夹持基准、壁厚、材质及抓取点固定固化,抓取不稳定等问题
本发明通过构建二维双向关系图并结合删除出度为2的端点的迭代遍历,实现了对任意2D图纸的解析,无论工件规格如何变化,均能从线条层面自动识别闭合轮廓并建立层级关系,无需人工建立模板库或预处理图纸,仅需导入图纸即可完成工件识别,极大缩短换型周期,适配多品种快速切换生产;此外,本发明通过将外接矩形离散为网格并结合离散积分量化计算工件重心,将重心作为抓取点位确定的基准,使抓取点位根据每个工件的实际重心位置动态生成,配合抓取组别的全局规划,在保证抓取稳定性的同时通过配对分组减少机械臂往返运动次数、降低路径干涉概率,提升了单位时间内的抓取效率;最后,本发明构建工件位姿并结合下料姿态生成变换矩阵,将抓取点位映射至码垛位置,形成从图纸解析到抓取规划再到下料码垛的完整自动化闭环,且下料姿态可根据现场需求通过软件交互灵活调整,适应不同码垛场景,最终实现了从2D图纸输入到机械臂抓取码垛指令输出的全流程自动化。
Smart Images

Figure CN123000849A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of drawing inspection, specifically to a method and system for planning and grasping multi-specification workpieces based on 2D drawings. Background Technology
[0002] With the development of flexible automated production lines, the grasping tasks of robotic arms are evolving from single-specification, fixed-path to multi-specification, unstructured directions, and the specifications of workpieces are showing high diversity and continuity. How to efficiently transform the geometric semantic information contained in 2D drawings into dynamic grasping strategies that can be executed by robotic arms has become the key to achieving highly flexible automated operations.
[0003] Existing automated grasping solutions typically rely on pre-established 2D model libraries or specific visual templates. They acquire workpiece images using industrial cameras, employ computer vision algorithms to identify object categories and determine poses, and then use motion planning algorithms to drive a robotic arm to perform grasping actions. This solution can achieve automated grasping in single-size, fixed scenarios.
[0004] The above solutions have the following shortcomings when dealing with multi-specification scenarios: 1. The use of a single drawing template matching mode requires the establishment of a separate template library for each specification. Adding new specifications requires manual preprocessing of drawings, feature extraction, and parameter debugging, resulting in long changeover cycles, difficulty in adapting to rapid production switching of multiple varieties, poor ability to distinguish between workpieces with similar contours and different sizes of the same type, easy to misidentify, and low reliability in mixed material sorting scenarios. 2. Only extracting the two-dimensional contour geometric information of the drawing cannot be associated with process information such as the workpiece's center of gravity and clamping reference. The gripping points are fixed and fixed, resulting in poor gripping stability. 3. Grip planning is mostly single-point fixed gripping, without combining the distribution density, priority, and interference relationship of multiple workpieces for global planning. When multiple workpieces are densely arranged, problems such as path interference and low efficiency are prone to occur. Summary of the Invention
[0005] To address the problems mentioned in the prior art, this invention proposes a multi-specification workpiece planning and grasping method and system based on 2D drawings. By acquiring various workpiece information from the 2D drawings and analyzing it through algorithms, the grasping pose planning and display functions are finally realized on the software side, and the grasping pose is sent to the robotic arm to achieve precise grasping. This invention aims to solve the problems of only extracting the two-dimensional contour geometric information of the drawings, which cannot be associated with the workpiece's center of gravity, clamping reference, wall thickness, material, and fixed grasping points, resulting in unstable grasping.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: This invention proposes a method for planning and grasping multi-specification workpieces based on 2D drawings, comprising the following steps: S1. Obtain the target drawing, read the line information in the target drawing, construct a two-dimensional bidirectional relationship diagram based on the connection relationship of the endpoints in the line information; sort the endpoints according to the out-degree of each endpoint to obtain the sorting result; Based on the sorting results, a depth-first traversal is performed on the two-dimensional bidirectional relationship graph. After each closed curve is extracted, the endpoints with an out-degree of 2 on the closed curve are deleted from the two-dimensional bidirectional relationship graph, and the traversal continues until the traversal is completed, resulting in a set of closed curves. Based on the set of closed curves, the inclusion relationship between the closed curves and the identified workpieces is determined in descending order of the enclosing area of the closed curves. Based on the inclusion relationship, a hierarchical structure of the closed curves is established to obtain the contour information of the workpieces. S2. Determine the circumscribed rectangle of the workpiece based on its contour information, discretize the circumscribed rectangle into a grid, determine whether each grid is within the workpiece contour, calculate the center of gravity of the workpiece based on the marking results, determine the gripping point based on the circumscribed rectangle, center of gravity and the module length of the gripping module, and determine the gripping pose and gripping group of the workpiece based on the gripping point. S3. Determine the workpiece pose based on the center of gravity and the circumscribed rectangle, determine the transformation matrix based on the workpiece pose and the received unloading posture, and transform the gripping point according to the transformation matrix to obtain the unloading point. S4. Send the gripping pose and unloading point to the robotic arm so that the robotic arm can grip and stack the workpiece.
[0007] As a further improvement to the present invention, before constructing the two-dimensional bidirectional relationship graph, the following is also included: The endpoint coordinates in the line information are sorted, with endpoints with smaller horizontal coordinates being prioritized for primary sorting and endpoints with smaller vertical coordinates being prioritized for secondary sorting. Each endpoint is assigned a number according to the sorting order. The two-dimensional bidirectional relationship diagram is constructed based on the numbering and connection relationship of each endpoint.
[0008] As a further improvement of the present invention, a depth-first traversal of the two-dimensional bidirectional relationship graph is performed based on the sorting result, including: Traverse the two-dimensional bidirectional graph, count the out-degree of each endpoint and the number of its adjacent endpoints, and sort the endpoints by out-degree in ascending order; perform a depth-first traversal of the endpoints based on the sorting results until the endpoints that have already been traversed are retraced, and record the traversal path as a closed curve.
[0009] As a further improvement of the present invention, the inclusion relationship between the closed curves and the identified workpieces is determined sequentially according to the order of the enclosing areas of the closed curves from largest to smallest, and a hierarchical structure of the closed curves is established based on the inclusion relationship, including: Calculate the minimum bounding box area of each closed curve, and sort the closed curves from largest to smallest according to the minimum bounding box area; take out the closed curves in the sorted order, and determine the inclusion relationship between the taken closed curve and the existing workpiece chain in the hierarchical structure. If the taken closed curve is included by the existing workpiece chain, insert the closed curve into the workpiece chain; otherwise, add the closed curve as a new workpiece chain to the hierarchical structure, until all closed curves have been processed.
[0010] As a further improvement of the present invention, the step of discretizing the circumscribed rectangle into a grid includes: Rotate the minimum bounding rectangle of the workpiece to be parallel to the two-dimensional coordinate axis, and discretize the rotated bounding rectangle into a unit square grid; determine whether each grid is located within the workpiece contour. If the grid is located within the workpiece contour, set the identifier of the grid to 1, otherwise set it to 0.
[0011] As a further improvement of the present invention, the discrete integral calculation of the workpiece's centroid includes: The coordinates of the workpiece's center of gravity are calculated using the following formula:
[0012] In the formula: Indicates the first The x-coordinate of a discrete grid; Indicates the first The ordinate of a discrete grid; Indicates the first The area of each discrete grid cell is related to an identifier; if the identifier is 1, then... Indicates the grid size; an identifier of 0 indicates... It is 0.
[0013] As a further improvement of the present invention, determining the gripping point position based on the size of the circumscribed rectangle, the center of gravity, and the module length of the gripping module includes: Based on the dimensions of the circumscribed rectangle and the shape of the workpiece, the workpiece is divided into single-jaw gripping workpieces and double-jaw gripping workpieces; The gripping point for a single-claw gripping a workpiece is the center of gravity. For a dual-jaw gripper grasping a workpiece, calculate the gripping length on both sides of the center of gravity along the long side of the circumscribed rectangle. l and r ,like l and r If the sum is greater than the module length, then decrease alternately. l and r Until l and r The sum is less than the module length, according to the final determined l and r Determine two grab points.
[0014] As a further improvement of the present invention, determining the gripping posture and gripping group of the workpiece based on the gripping point includes: According to the identification order of the workpieces, each single-claw gripping workpiece is traversed. If the gripping positions of two single-claw gripping workpieces are both within the module range of the gripping module, then the two workpieces are marked as gripping groups that are gripped simultaneously. When the two grippers grasp a single workpiece, the gripping posture is determined based on the two gripping points of the workpiece, where the gripping point with the smaller horizontal coordinate is recorded as the first point and the gripping point with the larger horizontal coordinate is recorded as the second point. When the two jaws grip two workpieces, the gripping posture is determined according to the gripping points of each workpiece; when the single jaw grips a workpiece, the gripping posture is determined according to the width direction of the circumscribed rectangle.
[0015] As a further improvement of the present invention, determining the workpiece pose based on the center of gravity and the circumscribed rectangle includes: The center point of the circumscribed rectangle is determined as the workpiece position; the direction from the center point to the centroid is determined as the workpiece reference direction, based on the longitudinal direction of the circumscribed rectangle. If the angle between the workpiece reference direction and the longitudinal direction is obtuse, the workpiece reference direction is reversed; the workpiece pose is determined based on the workpiece position and the workpiece reference direction. Based on the workpiece gripping pose and unloading posture, the transformation matrix is calculated using the following formula:
[0016] In the formula: Indicates the workpiece gripping pose; This indicates the action of feeding material.
[0017] This invention proposes a multi-specification workpiece planning and grasping system based on 2D drawings, comprising: The acquisition and recognition module is used to acquire the target drawing, read the line information in the target drawing, and construct a two-dimensional bidirectional relationship graph based on the connection relationship of the endpoints in the line information; sort the endpoints according to their out-degree to obtain a sorting result; perform a depth-first traversal of the two-dimensional bidirectional relationship graph based on the sorting result, and after extracting each closed curve, delete the endpoints with an out-degree of 2 on the closed curve from the two-dimensional bidirectional relationship graph and continue traversing until the traversal is completed to obtain a set of closed curves; based on the set of closed curves, determine the inclusion relationship between the closed curves and the identified workpieces in descending order of the enclosing area of the closed curves, establish a hierarchical structure of the closed curves based on the inclusion relationship, and obtain the contour information of the workpieces; The center of gravity determination module is used to determine the outer rectangle of the workpiece based on the workpiece's contour information, discretize the outer rectangle into a grid, determine whether each grid is located within the workpiece contour, calculate the center of gravity of the workpiece based on the marking results, determine the gripping point based on the outer rectangle, center of gravity, and the module length of the gripping module, and determine the gripping pose and gripping group of the workpiece based on the gripping point. The unloading point determination module is used to determine the workpiece pose based on the center of gravity and the circumscribed rectangle, determine the transformation matrix based on the workpiece pose and the received unloading posture, and transform the gripping point according to the transformation matrix to obtain the unloading point. The output module is used to send the gripping pose and unloading point to the robotic arm so that the robotic arm can grip and stack the workpiece.
[0018] Compared with the prior art, the present invention achieves the following technical effects: This invention achieves the parsing of any 2D drawing by constructing a two-dimensional bidirectional relationship graph and combining iterative traversal with the deletion of endpoints with an out-degree of 2. Regardless of changes in workpiece specifications, it can automatically identify closed contours and establish hierarchical relationships at the line level. No manual template library or preprocessing of drawings is required; workpiece identification can be completed simply by importing the drawing, greatly shortening the changeover cycle and adapting to rapid production switching across multiple product types. Furthermore, this invention discretizes the circumscribed rectangle into a grid and uses discrete integral quantization to calculate the workpiece's center of gravity, using the center of gravity as the reference for determining the gripping point position. This ensures that the gripping point position is based on the actual center of gravity position of each workpiece. Dynamic generation, combined with global planning of grasping groups, ensures grasping stability while reducing the number of back-and-forth movements of the robotic arm and lowering the probability of path interference through pairing and grouping, thereby improving grasping efficiency per unit time. Finally, this invention constructs the workpiece pose and generates a transformation matrix by combining the unloading posture, mapping the grasping points to the palletizing position, forming a complete automated closed loop from drawing analysis to grasping planning to unloading and palletizing. Moreover, the unloading posture can be flexibly adjusted through software interaction according to on-site needs, adapting to different palletizing scenarios, and ultimately realizing full-process automation from 2D drawing input to robotic arm grasping and palletizing command output. Attached Figure Description
[0019] Figure 1 This is a schematic diagram of the overall process of the present invention; Figure 2 This is a schematic diagram of the overall architecture of the present invention. Detailed Implementation
[0020] In the following description, only certain exemplary embodiments are briefly described. As those skilled in the art will recognize, the described embodiments can be modified in various ways without departing from the spirit or scope of the invention. Therefore, the drawings and description are considered to be exemplary in nature and not restrictive.
[0021] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," and "circumferential" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0022] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0023] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection, an electrical connection, or a communication connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0024] In this invention, unless otherwise explicitly specified and limited, "above" or "below" the second feature can include direct contact between the first and second features, or contact between the first and second features through another feature between them. Furthermore, "above," "over," and "on top" of the second feature includes the first feature being directly above or diagonally above the second feature, or simply indicates that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature includes the first feature being directly above or diagonally above the second feature, or simply indicates that the first feature is at a lower horizontal level than the second feature.
[0025] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0026] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0027] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0028] The accompanying drawings illustrate various structural schematic diagrams according to embodiments disclosed in this invention. These drawings are not to scale, and some details have been enlarged for clarity, and some details may have been omitted. The shapes of the various regions and layers shown in the drawings, as well as their relative sizes and positional relationships, are merely exemplary and may deviate from reality due to manufacturing tolerances or technical limitations. Furthermore, those skilled in the art can design regions / layers with different shapes, sizes, and relative positions as needed.
[0029] Example 1 See Figure 1 This embodiment proposes a method for planning and grasping multi-specification workpieces based on 2D drawings, including the following steps: S1. Obtain the target drawing, read the line information in the target drawing, construct a two-dimensional bidirectional relationship diagram based on the connection relationship of the endpoints in the line information; sort the endpoints according to the out-degree of each endpoint to obtain the sorting result; Based on the sorting results, a depth-first traversal is performed on the two-dimensional bidirectional relationship graph. After each closed curve is extracted, the endpoints with an out-degree of 2 on the closed curve are deleted from the two-dimensional bidirectional relationship graph, and the traversal continues until the traversal is completed, resulting in a set of closed curves. Based on the set of closed curves, the inclusion relationship between the closed curves and the identified workpieces is determined in descending order of the enclosing area of the closed curves. Based on the inclusion relationship, a hierarchical structure of the closed curves is established to obtain the contour information of the workpieces. S2. Determine the circumscribed rectangle of the workpiece based on its contour information, discretize the circumscribed rectangle into a grid, determine whether each grid is within the workpiece contour, calculate the center of gravity of the workpiece based on the marking results, determine the gripping point based on the circumscribed rectangle, center of gravity and the module length of the gripping module, and determine the gripping pose and gripping group of the workpiece based on the gripping point. S3. Determine the workpiece pose based on the center of gravity and the circumscribed rectangle, determine the transformation matrix based on the workpiece pose and the received unloading posture, and transform the gripping point according to the transformation matrix to obtain the unloading point. S4. Send the gripping pose and unloading point to the robotic arm so that the robotic arm can grip and stack the workpiece.
[0030] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0031] In a laser cutting production line, after the workpiece is cut, it is laid flat on the cutting worktable. A robotic arm then picks up workpieces of different sizes and stacks them into a material frame or pallet. To automate this process, the system mainly consists of an information processing computer, a robotic arm equipped with a magnetic chuck end effector, a ground-rail walking mechanism, and a cutting machine tool. The overall architecture can be found in [reference needed]. Figure 2 As shown in the figure. Among them, the 2D engineering drawings, as the sole carrier of the workpiece's geometric dimensions and process references, are pre-input into the information processing computer. The computer's built-in algorithm system completes the entire process from drawing analysis, workpiece recognition, gripping point planning to material unloading and stacking calculation. Finally, it sends precise motion trajectory and magnetization control commands to the robotic arm, driving the robotic arm to complete the automatic gripping and orderly stacking of the workpiece.
[0032] To address the issues of similar production lines mentioned in the background section, this embodiment proposes a multi-specification workpiece planning and gripping method based on 2D drawings. By analyzing and automatically identifying all workpieces within the drawings, combining discrete integral calculations to determine the workpiece's center of gravity, and dynamically planning gripping points and gripping groups, the method finally generates unloading and palletizing points through posture transformation, thus achieving a fully automated process from drawing input to robotic arm gripping execution.
[0033] Step 1: Obtain the target drawing and read the line information in the target drawing. Construct a two-dimensional bidirectional relationship graph based on the connection relationship of the endpoints in the line information. Sort the endpoints according to their out-degree to obtain the sorting result. Perform a depth-first traversal on the two-dimensional bidirectional relationship graph based on the sorting result. After extracting each closed curve, delete the endpoints with an out-degree of 2 on the closed curve from the two-dimensional bidirectional relationship graph and continue traversing until the traversal is completed to obtain a set of closed curves. Based on the set of closed curves, determine the inclusion relationship between the closed curves and the identified workpieces in descending order of the enclosing area of the closed curves. Establish a hierarchical structure of the closed curves based on the inclusion relationship to obtain the contour information of the workpieces.
[0034] This step automatically identifies the complete outline of each workpiece from a line drawing without the need for pre-setting any templates. In practical applications, the target drawing file is first acquired by the information processing computer. The target drawing file supports various common engineering drawing formats such as DXF, DWG, and JSON. This embodiment uses the most widely used DXF format as an example. The software preferably calls the libdxf third-party library to read the information in the drawing file, classifying the line elements into three basic types: straight lines, arcs, and circles, and extracting the endpoint coordinate data of all lines.
[0035] This embodiment requires numbering all endpoints first. Numbering follows a coordinate sorting rule: endpoints with smaller x-coordinate values are prioritized for primary sorting; if x-coordinates are the same, endpoints with smaller y-coordinate values are prioritized for secondary sorting. A unique ID is assigned to each endpoint according to the sorting results. Based on the numbered endpoints and the connection relationships of each line, a two-dimensional bidirectional relationship graph M is constructed. Each node in the two-dimensional bidirectional relationship graph represents an endpoint, and the lines connecting nodes represent the connection relationships of lines. These connections are bidirectional; that is, if endpoint A and endpoint B are connected by a straight line, the two-dimensional bidirectional relationship graph simultaneously records that A's adjacent points include B, and B's adjacent points include A. The advantage of using a two-dimensional bidirectional relationship graph in this embodiment is that subsequent contour traversal can be performed along two directions, avoiding path breakage problems that occur during unidirectional traversal, and is particularly suitable for handling complex contours including arcs.
[0036] After constructing the two-dimensional bidirectional relationship graph, traverse the graph, count the out-degree of each endpoint (i.e., the number of lines connected to each endpoint), and sort all endpoints in ascending order of out-degree to obtain the ordered endpoint set S. It's important to understand that endpoints at contour corners have higher out-degrees, while the midpoints of contour edges have an out-degree of 2, belonging to a continuous contour line.
[0037] Then, a depth-first traversal is performed on the two-dimensional bidirectional graph to obtain all closed curves. The specific process is as follows: take the endpoint with the smallest out-degree from the ordered endpoint set S as the starting point, perform a depth-first traversal, and visit the adjacent endpoints in turn along the connection relationship in the two-dimensional bidirectional graph. Each edge visited is marked as visited, until an endpoint that has been visited is visited again. At this time, the complete path traversed constitutes a closed curve, and the closed curve is stored in the closed curve set C.
[0038] After extracting a closed curve, the out-degree of all endpoints on the closed curve is counted. Endpoints with an out-degree of 2 are deleted from the two-dimensional bidirectional relationship graph M and the ordered endpoint set S, and the connection relationships of the remaining endpoints in the two-dimensional bidirectional relationship graph are updated simultaneously. The reason for deleting endpoints with an out-degree of 2 in this embodiment is that these endpoints only belong to the current closed curve and do not participate in the formation of other contours. Removing them significantly reduces the computational load of subsequent traversals and avoids repeated traversals. The above process of depth traversal and endpoint deletion is repeated until the ordered endpoint set S is empty. At this point, all closed contours in the drawing have been extracted into the closed curve set C.
[0039] Based on the set of closed curves C, different workpieces and internal holes within workpieces are distinguished by hierarchy. First, the minimum bounding box area of each closed curve in set C is calculated. All closed curves are then sorted in descending order of area, resulting in the sorted set C. s .
[0040] Then, an empty workpiece chain set WL is initialized to store the contour hierarchy of each workpiece. This is done sequentially from the sorted curve set C. s Extract the closed curve with the largest area from the workpiece chain set WL. Iterate through the existing workpiece chains in the workpiece chain set WL, determining if the extracted closed curve is contained within the outermost contour of a workpiece chain. If contained, insert the closed curve into the corresponding workpiece chain's hierarchical structure as an internal hole or concave contour of the workpiece. If not contained by any existing workpiece chain, treat the closed curve as the outermost contour of a new workpiece, generating a new workpiece chain and adding it to the workpiece chain set WL. Repeat this process until the sorted curve set C is reached. s All curves have been processed.
[0041] At this point, each workpiece in the target drawing corresponds to a workpiece chain in the workpiece chain set WL, thus obtaining the workpiece's contour information and completing the automatic identification from lines to workpieces. The entire identification process is based entirely on the topological connectivity and geometric inclusion relationships of the lines, requiring no prior workpiece templates.
[0042] In the system's software interface, after recognition is completed, the outline and size parameters of each workpiece will be displayed separately. For the production site, newly added workpiece specifications only need to import the corresponding 2D drawings, without the need for manual modeling and parameter debugging, which can adapt to the production needs of rapid switching between multiple varieties.
[0043] Step 2: Determine the circumscribed rectangle of the workpiece based on its contour information, discretize the circumscribed rectangle into a grid, determine whether each grid is within the workpiece contour, and calculate the center of gravity of the workpiece based on the marking results. Determine the gripping points based on the circumscribed rectangle, the center of gravity, and the module length of the gripping module, and determine the gripping pose and gripping group of the workpiece based on the gripping points.
[0044] First, calculate the minimum bounding rectangle for each workpiece. Rotate the minimum bounding rectangle to a position parallel to the two-dimensional coordinate axes, denoted as the bounding rectangle R. Numerical solution is then performed using discrete mesh integration. The bounding rectangle R is discretized into small square grids of unit length 1, with each grid corresponding to a unit area in the drawing.
[0045] An algorithm for detecting points within a closed curve is used to determine whether the center point of each small square grid falls within the outer contour of the workpiece and is not within the range of internal holes. If the center point of the small square grid is within the solid area of the workpiece, the identifier of the grid is set to 1, indicating that the area belongs to the workpiece; otherwise, it is set to 0, indicating that the area is blank or a hole.
[0046] Based on the discretized grid markings, the formula for calculating the centroid coordinates of the workpiece through discrete integration is as follows:
[0047] In the formula: Indicates the first The x-coordinate of a discrete grid; Indicates the first The ordinate of a discrete grid; Indicates the first The area of each discrete grid cell is related to an identifier; if the identifier is 1, then... Indicates the grid size; an identifier of 0 indicates... It is 0.
[0048] The above formula is significant because it determines the center of gravity of a uniformly thick sheet. For magnetic chuck gripping, the workpiece experiences the most balanced force when the point of application of the resultant adsorption force passes through the center of gravity, preventing tilting or deflection and maximizing gripping stability. Compared to traditional methods that fix the geometric center of gripping, gripping points based on the actual center of gravity can accommodate workpieces of any irregular shape or eccentricity.
[0049] After the center of gravity calculation is completed, the gripping point and gripping mode for each workpiece are determined by combining the dimensions of the workpiece's circumscribed rectangle and the length ml of the gripping module. The gripping modes are divided into single-jaw gripping and double-jaw gripping: for smaller workpieces, the single-jaw gripping mode is used, and the gripping point is directly set to the center of gravity position p; for larger workpieces that exceed the stable adsorption range of a single jaw, the double-jaw gripping mode is used, and the two gripping points are distributed along the long side of the circumscribed rectangle.
[0050] In this embodiment, the calculation process for the dual-claw gripping points is as follows: First, along the long side of the circumscribed rectangle, calculate the distance *l* from the center of gravity to the left contour and the distance *r* from the right contour. If the sum of *l* and *r* is greater than the length *ml* of the gripping module, it indicates that the workpiece length exceeds the span of the suction cup module, making it impossible to grip the two ends of the workpiece. In this case, it is necessary to alternately decrease the values of *l* and *r*, i.e., first decrease *l* by one unit step, then decrease *r* by one unit step, repeating this process until the sum of *l* and *r* is less than or equal to the length *ml* of the gripping module. Based on the finally determined values of *l* and *r*, measure the corresponding lengths from the center of gravity to the left and right along the long side to obtain the left gripping point *pl* and the right gripping point *pr*. By using an alternating decrease method, it can be ensured that the two gripping points are always distributed as symmetrically as possible relative to the center of gravity, so that the load on the two suction cups is basically balanced, avoiding excessive force on one side.
[0051] After calculating the gripping point for a single workpiece, it's necessary to group all single-claw gripped workpieces to enable simultaneous gripping of two workpieces. The specific process is as follows: Following the workpiece identification order, all single-claw gripped workpieces are traversed, and the distance between the gripping positions of the current and subsequent workpieces is determined sequentially. If the gripping positions of both workpieces are within the effective suction range of the gripping module, they are marked as belonging to the same gripping group, allowing for simultaneous gripping of both workpieces in a single movement. After traversing all workpieces, each workpiece is assigned to its corresponding gripping group. This global grouping planning fully utilizes the suction capacity of the dual-claw module, reduces the number of round trips of the robotic arm, and proactively avoids path interference issues in densely packed arrangements, effectively improving overall gripping efficiency.
[0052] After the gripping points are determined, the end effector gripping pose for each gripping mode needs to be calculated, which is divided into three working conditions. The first condition is the gripping of a single workpiece by two grippers. Let the two gripping points of the workpiece be p1 and p2, and it is agreed that the x-coordinate value of p1 is less than the x-coordinate value of p2; the x-direction vector of the gripping pose is determined by normalizing the vector obtained by subtracting p1 from p2, that is, along the line connecting the two suction cups; the z-direction vector is set as a unit vector (0,0,1) perpendicular to the workpiece plane; the y-direction vector is obtained by performing a cross product operation between the z-direction vector and the x-direction vector, thus forming an orthogonal normalized end effector attitude coordinate system, and the calculation formula is as follows:
[0053]
[0054]
[0055] In the formula: Capture pose in the x-direction; Capture pose in the z-direction; Capture the pose in the y-direction.
[0056] The second scenario involves two grippers grasping two workpieces. The gripping points p1 and p2 of the two workpieces are taken respectively and sorted according to the size of the horizontal coordinate. The pose calculation method is the same as that for gripping a single workpiece with two grippers, so that the end suction cup can be aligned with the gripping points of the two workpieces at the same time, and the two-piece adsorption can be completed in one descent.
[0057] The third scenario involves a single-jaw gripper grasping a workpiece. The width of the workpiece's bounding rectangle is taken as the reference direction, `base_dirt`, which is used as the x-direction vector for the gripping pose. The calculation methods for the z and y directions are the same as those for the dual-jaw gripping of a single workpiece, ensuring that the orientation of the single-jaw suction cup is aligned with the workpiece's width direction. The calculation formula is as follows:
[0058] Once the gripping group and gripping pose of all workpieces are calculated, they will be visualized in the software interface. Users can view the grouping of each workpiece, the distribution of gripping points, and the end-effector posture to confirm in advance whether they meet the requirements of the on-site working conditions. If necessary, the gripping mode of individual workpieces can also be manually adjusted.
[0059] Step 3: Determine the workpiece pose based on the center of gravity and the circumscribed rectangle; determine the transformation matrix based on the workpiece pose and the received unloading posture; transform the gripping point position according to the transformation matrix to obtain the unloading point position.
[0060] First, define the workpiece's pose reference, and set the workpiece's position P. C Let the coordinates of the center point of the circumscribed rectangle of the workpiece be set; the workpiece's orientation reference is based on the longitudinal direction of the circumscribed rectangle, which is... At the same time, define the boundary from the center P of the circumscribed rectangle. C Pointing to the center of gravity P G The vector is the workpiece reference direction n, which reflects the workpiece's eccentric orientation and is used to unify the placement direction during stacking.
[0061] Determine the angle between the workpiece's reference direction n and its longitudinal direction. If the angle is obtuse, then adjust the longitudinal direction... By inverting the two angles, we ensure that the included angle is always acute, thus maintaining consistency in the definition of the workpiece orientation. The three orthogonal directions of the final workpiece orientation are shown below:
[0062]
[0063]
[0064] In the formula: The workpiece pose is in the x-direction; The workpiece pose is in the z-direction; The workpiece pose is in the y-direction.
[0065] The subsequent calculation of the material unloading point transformation is performed. This is done by inputting the target unloading posture into the software interface based on the palletizing requirements. This includes parameters such as placement angle and translation offset. First, the workpiece gripping posture is determined. Material feeding posture of the target The transformation matrix is calculated using the following formula:
[0066] The physical meaning of the above formula is that by grasping the pose... The inverse matrix transforms the workpiece from its original pose on the cutting table to its standard square pose at the origin, and then the unloading posture is used to transform the workpiece. The matrix transformation is applied to the preset unloading position.
[0067] By multiplying the gripping points P1 and P2 of the workpiece by the transformation matrix T, the unloading points corresponding to the unloading positions can be obtained. The calculation formula is as follows:
[0068]
[0069] In the formula: and This is the material unloading point.
[0070] Since the transformation matrix of the embodiment is calculated in real time based on pose, the unloading posture can be adjusted at any time on the software side. For example, when stacking, each layer of workpieces needs to be staggered by 90°, or it needs to be offset along a specific direction. Only the target unloading posture needs to be modified. The parameters can be used to recalculate all material cutting points without repeating drawing analysis and data capture planning.
[0071] Step 4: Send the gripping pose and unloading point to the robotic arm so that the robotic arm can grip and stack the workpiece.
[0072] In this embodiment, the information processing computer packages all information such as gripping pose, unloading pose, and suction cup magnetization timing, and sends it to the robot arm's controller via Ethernet communication. The robot arm executes the gripping cycle sequentially according to the group order: First, it moves directly above the target workpiece, adjusts its end effector posture to match the calculated gripping pose, then descends vertically to the workpiece surface, the magnetic suction cup is energized and magnetized, and after firmly adhering to the workpiece, it lifts it up; next, the robot arm moves along the planned path to above the palletizing area, adjusts its end effector to the unloading pose, descends vertically to the palletizing height, the suction cup is de-energized and demagnetized, and the workpiece is placed stably; finally, the robot arm lifts up and enters the next gripping cycle.
[0073] Example 2 This embodiment is basically the same as Embodiment 1, except that this embodiment proposes a multi-specification workpiece planning and grasping system based on 2D drawings, including: The acquisition and recognition module is used to acquire the target drawing, read the line information in the target drawing, and construct a two-dimensional bidirectional relationship graph based on the connection relationship of the endpoints in the line information; sort the endpoints according to their out-degree to obtain a sorting result; perform a depth-first traversal of the two-dimensional bidirectional relationship graph based on the sorting result, and after extracting each closed curve, delete the endpoints with an out-degree of 2 on the closed curve from the two-dimensional bidirectional relationship graph and continue traversing until the traversal is completed to obtain a set of closed curves; based on the set of closed curves, determine the inclusion relationship between the closed curves and the identified workpieces in descending order of the enclosing area of the closed curves, establish a hierarchical structure of the closed curves based on the inclusion relationship, and obtain the contour information of the workpieces; The center of gravity determination module is used to determine the outer rectangle of the workpiece based on the workpiece's contour information, discretize the outer rectangle into a grid, determine whether each grid is located within the workpiece contour, calculate the center of gravity of the workpiece based on the marking results, determine the gripping point based on the outer rectangle, center of gravity, and the module length of the gripping module, and determine the gripping pose and gripping group of the workpiece based on the gripping point. The unloading point determination module is used to determine the workpiece pose based on the center of gravity and the circumscribed rectangle, determine the transformation matrix based on the workpiece pose and the received unloading posture, and transform the gripping point according to the transformation matrix to obtain the unloading point. The output module is used to send the gripping pose and unloading point to the robotic arm so that the robotic arm can grip and stack the workpiece.
[0074] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered illustrative and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the scope of the invention. No reference numerals in the claims should be construed as limiting the scope of the claims.
[0075] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can be appropriately combined to form other embodiments that can be understood by those skilled in the art. The above content is only for illustrating the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. Any modifications made based on the technical concept proposed in this invention shall fall within the scope of protection of the claims of this invention.
Claims
1. A method for planning and grasping multi-specification workpieces based on 2D drawings, characterized in that, Includes the following steps: S1. Obtain the target drawing, read the line information in the target drawing, construct a two-dimensional bidirectional relationship diagram based on the connection relationship of the endpoints in the line information; sort the endpoints according to the out-degree of each endpoint to obtain the sorting result; Based on the sorting results, a depth-first traversal is performed on the two-dimensional bidirectional relationship graph. After each closed curve is extracted, the endpoints with an out-degree of 2 on the closed curve are deleted from the two-dimensional bidirectional relationship graph, and the traversal continues until the traversal is completed, resulting in a set of closed curves. Based on the set of closed curves, the inclusion relationship between the closed curves and the identified workpieces is determined in descending order of the enclosing area of the closed curves. Based on the inclusion relationship, a hierarchical structure of the closed curves is established to obtain the contour information of the workpieces. S2. Determine the circumscribed rectangle of the workpiece based on its contour information, discretize the circumscribed rectangle into a grid, determine whether each grid is within the workpiece contour, calculate the center of gravity of the workpiece based on the marking results, determine the gripping point based on the circumscribed rectangle, center of gravity and the module length of the gripping module, and determine the gripping pose and gripping group of the workpiece based on the gripping point. S3. Determine the workpiece pose based on the center of gravity and the circumscribed rectangle, determine the transformation matrix based on the workpiece pose and the received unloading posture, and transform the gripping point according to the transformation matrix to obtain the unloading point. S4. Send the gripping pose and unloading point to the robotic arm so that the robotic arm can grip and stack the workpiece.
2. The method for planning and grasping multi-specification workpieces based on 2D drawings according to claim 1, characterized in that, Before constructing the two-dimensional bidirectional relationship graph, the following is also included: The endpoint coordinates in the line information are sorted, with endpoints with smaller horizontal coordinates being prioritized for primary sorting and endpoints with smaller vertical coordinates being prioritized for secondary sorting. Each endpoint is assigned a number according to the sorting order. The two-dimensional bidirectional relationship diagram is constructed based on the numbering and connection relationship of each endpoint.
3. The method for planning and grasping multi-specification workpieces based on 2D drawings according to claim 1, characterized in that, Based on the sorting results, a depth-first traversal of the two-dimensional bidirectional relationship graph is performed, including: Traverse the two-dimensional bidirectional graph, count the out-degree of each endpoint and the number of its adjacent endpoints, and sort the endpoints by out-degree in ascending order; perform a depth-first traversal of the endpoints based on the sorting results until the endpoints that have already been traversed are retraced, and record the traversal path as a closed curve.
4. The method for planning and grasping multi-specification workpieces based on 2D drawings according to claim 1, characterized in that, The inclusion relationships between closed curves and identified workpieces are determined sequentially according to the order of their enclosing areas from largest to smallest. A hierarchical structure of closed curves is then established based on these inclusion relationships, including: Calculate the minimum bounding box area of each closed curve, and sort the closed curves from largest to smallest according to the minimum bounding box area; take out the closed curves in the sorted order, and determine the inclusion relationship between the taken closed curve and the existing workpiece chain in the hierarchical structure. If the taken closed curve is included by the existing workpiece chain, insert the closed curve into the workpiece chain; otherwise, add the closed curve as a new workpiece chain to the hierarchical structure, until all closed curves have been processed.
5. The method for planning and grasping multi-specification workpieces based on 2D drawings according to claim 1, characterized in that, Discretizing the circumscribed rectangle into a grid includes: Rotate the minimum bounding rectangle of the workpiece to be parallel to the two-dimensional coordinate axis, and discretize the rotated bounding rectangle into a unit square grid; determine whether each grid is located within the workpiece contour. If the grid is located within the workpiece contour, set the identifier of the grid to 1, otherwise set it to 0.
6. The method for planning and grasping multi-specification workpieces based on 2D drawings according to claim 1, characterized in that, The discrete integral calculation of the workpiece's centroid includes: The coordinates of the workpiece's center of gravity are calculated using the following formula: In the formula: Indicates the first The x-coordinate of a discrete grid; Indicates the first The ordinate of a discrete grid; Indicates the first The area of each discrete grid cell is related to an identifier; if the identifier is 1, then... Indicates the grid size; an identifier of 0 indicates... It is 0.
7. The method for planning and grasping multi-specification workpieces based on 2D drawings according to claim 1, characterized in that, Determining the gripping point location based on the dimensions of the circumscribed rectangle, its centroid, and the module length of the gripping module includes: Based on the dimensions of the circumscribed rectangle and the shape of the workpiece, the workpiece is divided into single-jaw gripping workpieces and double-jaw gripping workpieces; The gripping point for a single-claw gripping a workpiece is the center of gravity. For a dual-jaw gripper grasping a workpiece, calculate the gripping length on both sides of the center of gravity along the long side of the circumscribed rectangle. l and r ,like l and r If the sum is greater than the module length, then decrease alternately. l and r Until l and r The sum is less than the module length, according to the final determined l and r Determine two grab points.
8. The method for planning and grasping multi-specification workpieces based on 2D drawings according to claim 1, characterized in that, Determining the workpiece's gripping pose and gripping group based on the gripping points includes: According to the identification order of the workpieces, each single-claw gripping workpiece is traversed. If the gripping positions of two single-claw gripping workpieces are both within the module range of the gripping module, then the two workpieces are marked as gripping groups that are gripped simultaneously. When the two grippers grasp a single workpiece, the gripping posture is determined based on the two gripping points of the workpiece, where the gripping point with the smaller horizontal coordinate is recorded as the first point and the gripping point with the larger horizontal coordinate is recorded as the second point. When the two jaws grip two workpieces, the gripping posture is determined according to the gripping points of each workpiece; when the single jaw grips a workpiece, the gripping posture is determined according to the width direction of the circumscribed rectangle.
9. The method for planning and grasping multi-specification workpieces based on 2D drawings according to claim 1, characterized in that, Determining the workpiece pose based on the center of gravity and the circumscribed rectangle includes: The center point of the circumscribed rectangle is determined as the workpiece position; the direction from the center point to the centroid is determined as the workpiece reference direction, based on the longitudinal direction of the circumscribed rectangle. If the angle between the workpiece reference direction and the longitudinal direction is obtuse, the workpiece reference direction is reversed; the workpiece pose is determined based on the workpiece position and the workpiece reference direction. Based on the workpiece gripping pose and unloading posture, the transformation matrix is calculated using the following formula: In the formula: Indicates the workpiece gripping pose; This indicates the action of feeding material.
10. A multi-specification workpiece planning and grasping system based on 2D drawings, characterized in that, include: The acquisition and recognition module is used to acquire the target drawing, read the line information in the target drawing, and construct a two-dimensional bidirectional relationship graph based on the connection relationship of the endpoints in the line information; sort the endpoints according to their out-degree to obtain a sorting result; perform a depth-first traversal of the two-dimensional bidirectional relationship graph based on the sorting result, and after extracting each closed curve, delete the endpoints with an out-degree of 2 on the closed curve from the two-dimensional bidirectional relationship graph and continue traversing until the traversal is completed to obtain a set of closed curves; based on the set of closed curves, determine the inclusion relationship between the closed curves and the identified workpieces in descending order of the enclosing area of the closed curves, establish a hierarchical structure of the closed curves based on the inclusion relationship, and obtain the contour information of the workpieces; The center of gravity determination module is used to determine the outer rectangle of the workpiece based on the workpiece's contour information, discretize the outer rectangle into a grid, determine whether each grid is located within the workpiece contour, calculate the center of gravity of the workpiece based on the marking results, determine the gripping point based on the outer rectangle, center of gravity, and the module length of the gripping module, and determine the gripping pose and gripping group of the workpiece based on the gripping point. The unloading point determination module is used to determine the workpiece pose based on the center of gravity and the circumscribed rectangle, determine the transformation matrix based on the workpiece pose and the received unloading posture, and transform the gripping point according to the transformation matrix to obtain the unloading point. The output module is used to send the gripping pose and unloading point to the robotic arm so that the robotic arm can grip and stack the workpiece.
