Mechanical arm control track generation method

By identifying and separating trajectory lines in design files, detecting sharp points, and performing fitting and compensation, the accuracy and cost issues of converting garment CAD design data into sewing trajectories are solved, achieving high-precision automated trajectory generation suitable for robotic sewing.

CN121821369APending Publication Date: 2026-04-10HANGZHOU TAIWEI YUNCHUANG INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-31
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing technologies for converting garment CAD design data into sewing trajectories suffer from low accuracy, high cost, and low equipment conversion efficiency, especially in the field of fully automated robotic sewing, where there is a lack of high-precision trajectory generation solutions.

Method used

By identifying trajectory lines in the design file, separating and detecting cusps, generating multiple trajectory sub-lines, performing fitting and compensation, constructing a coordinate system, and outputting sampling point data, the system achieves automated conversion from garment CAD design data to high-precision sewing trajectories.

Benefits of technology

It improves the accuracy of trajectory generation and equipment adaptability, reduces the cost of manual intervention, and is suitable for automated processing scenarios such as robotic sewing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121821369A_ABST
    Figure CN121821369A_ABST
Patent Text Reader

Abstract

The invention relates to a mechanical arm control track generation method. Track lines in a design file are recognized and separated; carrying out sharp point detection on each track line, and breaking at the sharp point to generate a plurality of track sub-lines; analyzing the point set data of each track sub-line and fitting the point set data; a sampling interval is calculated according to the sampling frequency and the track routing speed, and a compensation coefficient is introduced for correction; and constructing a coordinate system for each fitted track sub-line, and outputting sampling point coordinates, directions and curvature data of the track sub-lines in the coordinate system. According to the method, the automatic conversion from the clothing CAD design data to the high-precision sewing track is realized, the track generation precision and the equipment adaptability are effectively improved, the manual intervention cost is reduced, and the method is suitable for automatic processing scenes such as robot sewing.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of trajectory generation, in particular to a mechanical arm control trajectory generation method. BACKGROUND

[0002] At present, the traditional garment CAD technology is mainly applied to manual auxiliary design (such as pattern making and code placing) and automatic cutting link, and its data mainly serves manual operation or two-dimensional cutting equipment. In the field of fully automatic robot sewing, there is still a lack of mature implementation scheme which can directly convert CAD design data into high-precision sewing trajectory. The existing scheme mainly relies on: Manual teaching: the operator holds a teaching device to control the movement of the mechanical arm along the sewing trajectory to record points one by one. This way is inefficient and difficult to ensure the repeatability. It needs to collect all target fabrics and sewing trajectories separately, which is high in cost.

[0003] Data conversion: directly export garment CAD data, which cannot contain the physical properties (such as stretching and deformation) of the fabric. It is affected by the printing accuracy of the pattern printing equipment and the manual cutting error, and it is difficult to accurately reproduce the precision in digital CAD. At the same time, it lacks transformation and bridging with automatic devices, and needs to be re-collected and converted for different automatic sewing equipment, which does not support hot replacement. SUMMARY

[0004] Therefore, it is necessary to provide a mechanical arm control trajectory generation method to solve the problems of low precision, high cost and low conversion efficiency between other devices in the process of converting traditional CAD design data into high-precision sewing trajectory.

[0005] The present application provides a mechanical arm control trajectory generation method, which comprises: identifying the trajectory lines in the design file and separating the trajectory lines from the design file; detecting the cusp of each trajectory line, and breaking the trajectory line with cusp to obtain a plurality of trajectory sub-lines generated after breaking; analyzing each trajectory sub-line to obtain point set data of each trajectory sub-line, and fitting the trajectory sub-line based on the point set data of each trajectory sub-line to generate a fitted trajectory sub-line; calculating a sampling interval according to a sampling frequency and a trajectory line speed, and introducing a compensation coefficient to modify the sampling interval; the sampling interval is the interval between two adjacent sampling points on the fitted trajectory sub-line; outputting the sampling point data of each fitted trajectory sub-line.

[0006] Further, the mechanical arm control trajectory generation method further comprises: Convert the coordinates of each point contained in each trajectory line within the design file to coordinates in the image coordinate system.

[0007] Furthermore, the process of identifying trajectory lines in the design file and separating the trajectory lines from the design file includes: Read the design file to obtain discrete lines, identify and mark the discrete lines, and then perform geometric reconstruction on the marked discrete lines to generate multiple complete geometric paths; Treat each complete geometric path as a trajectory line.

[0008] Furthermore, the process of reading the design file, obtaining discrete lines, and identifying and labeling the discrete lines includes: For each discrete line, layer attributes are extracted, and all discrete lines are filtered in the first round based on the validity of the layer attributes; For discrete lines that pass the first round of screening, a second round of screening is conducted based on the validity of their geometric type. For the discrete lines that pass the second round of screening, extract their color and corresponding geometric data.

[0009] Furthermore, the geometric reconstruction of the identified discrete lines to generate multiple complete geometric paths includes: Different candidate pools are created based on different layer properties, and discrete lines are stored in the corresponding candidate pools; Geometric growth is performed based on the discrete lines in each candidate pool until each discrete line in each candidate pool becomes at least part of a complete geometric path.

[0010] Furthermore, the geometric growth based on discrete lines in each candidate pool until each discrete line in each candidate pool becomes at least part of a complete geometric path includes: Select a trajectory line; Analyze the trajectory line to obtain the trajectory point sequence; Traverse each trajectory point in the trajectory point sequence along the trajectory direction, and determine whether each trajectory point is a candidate cusp based on its local geometric features. Based on the preset cusp determination criteria, the final cusp is selected from the candidate cusps. Return to the previous step and select a trajectory line until all trajectory lines have been selected.

[0011] Furthermore, each trajectory line undergoes cusp detection, and the trajectory lines containing cusps are broken to obtain multiple sub-trajectory lines generated after the breaks, including: Select a trajectory line; Analyze the trajectory line to obtain the trajectory point sequence; Traverse each trajectory point in the trajectory point sequence along the trajectory direction, and determine whether each trajectory point is a candidate cusp based on its local geometric features. Based on the preset cusp determination criteria, the final cusp is selected from the candidate cusps. Return to the previous step and select a trajectory line until all trajectory lines have been selected.

[0012] Furthermore, the step of performing cusp detection on each trajectory line and breaking the trajectory lines containing cusps to obtain multiple sub-trajectory lines generated after breaking them also includes: Select a trajectory line that finds the final apex; The trajectory line of the final cusp is analyzed to obtain cusp data, which includes the number of final cusps and the position of the final cusps in the trajectory line of the final cusp. Based on the position of each final cusp, the trajectory line that finds the final cusp is broken to obtain multiple broken trajectory sub-lines; Return to the selected trajectory line that has found its final cusp, and continue until all trajectory lines that have found their final cusps have been selected.

[0013] Furthermore, the step of calculating the sampling interval based on the sampling frequency and trajectory speed, and then correcting the sampling interval by introducing a compensation coefficient, includes: Set the sampling frequency, and set the corresponding actual routing speed according to the equipment parameters and operating requirements; The theoretical sampling interval is calculated based on the actual routing speed and sampling frequency; Based on the theoretical sampling interval, the trajectory arc length is integrally sampled to obtain the sampling point sequence; A compensation coefficient is introduced, and the theoretical sampling interval is corrected by dynamically adjusting the compensation coefficient to obtain the actual sampling interval, so as to compensate for the change in the actual sampling interval caused by deformation.

[0014] Furthermore, the output of sampling point data for each fitted trajectory sub-line includes: Select a fitted trajectory sub-line; Analyze the fitted trajectory sub-line to obtain all sampling points on the fitted trajectory sub-line; Create a coordinate system with any sampling point as the origin; Based on the location information of this sampling point, the coordinate information of other sampling points in the coordinate system is obtained; Return to the previous step and select a fitted trajectory sub-line, until all fitted trajectory sub-lines have been selected.

[0015] This application relates to a method for generating control trajectories for robotic arms. The method involves identifying and separating trajectory lines in a design file; detecting cusps in each trajectory line and breaking it at the cusps to generate multiple sub-trajectories; parsing and fitting the point set data of each sub-trajectory; calculating the sampling interval based on the sampling frequency and trajectory speed, and introducing a compensation coefficient for correction; constructing a coordinate system for each fitted sub-trajectory and outputting the coordinates, direction, and curvature data of its sampling points in the coordinate system. This method enables automated conversion from garment CAD design data to high-precision sewing trajectories, effectively improving trajectory generation accuracy and equipment adaptability, reducing manual intervention costs, and is suitable for automated processing scenarios such as robotic sewing. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating a robotic arm control trajectory generation method provided in an embodiment of this application. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0018] like Figure 1 As shown, in one embodiment of this application, the robotic arm control trajectory generation method includes the following steps S100 to S500.

[0019] S100 identifies trajectory lines in the design file and separates the trajectory lines from the design file.

[0020] S200 performs cusp detection on each trajectory line and breaks the trajectory lines with cusps to obtain multiple trajectory sub-lines generated after the breaks.

[0021] S300 analyzes each trajectory sub-line to obtain the point set data of each trajectory sub-line, and fits the trajectory sub-line based on the point set data of each trajectory sub-line to generate the fitted trajectory sub-line.

[0022] Specifically, for each trajectory sub-line, a cubic B-spline (Orderk=3) is used for fitting. The cubic spline not only ensures the continuity of the curve position, but also ensures the continuity of the first derivative (velocity direction) and the second derivative (curvature / acceleration), which meets the requirements of compliant control of the robotic arm.

[0023] Set the smoothing factor s=50. The image coordinate system is approximately 2790*1372 pixels. s=50 means that the allowed total squared error is around 50. Physically, this means we allow a tiny deviation of 0.5 to 1 pixel (approximately 0.1mm to 0.2mm) between the fitted sewing path and the original DXF image. This is to filter out quantization noise. Points exported from CAD or pixelated points inherently have jagged edges. We don't want the robotic arm to track these jagged edges; we want to "smooth out the peaks and fill the valleys" to create a smooth curve. s=50 at this resolution smooths out the jagged edges without distorting the shape. This parameter controls the trade-off between smoothness and fitness (the degree of fit between the fitted curve and the original data points). A larger s value allows the curve to deviate from the original noise within a certain range, thus "straightening out" small jitters and obtaining a smoother physical trajectory.

[0024] S400, calculate the sampling interval based on the sampling frequency and trajectory speed, and introduce a compensation coefficient to correct the sampling interval; the sampling interval is the distance between two adjacent sampling points on the fitted trajectory sub-line.

[0025] S500 outputs the sampling point data for each fitted trajectory sub-line.

[0026] Specifically, a coordinate system is constructed for each fitted trajectory sub-line, and the coordinate data of the sampling points of the fitted trajectory sub-line in the coordinate system, the direction data between adjacent sampling points, and the curvature data between adjacent directions are output.

[0027] Sampling point coordinate data refers to the coordinate data of the sampling point in the coordinate system; the direction data between adjacent sampling points refers to the slope data of two adjacent sampling points; the curvature data between adjacent directions refers to the difference in slope data between two adjacent sampling points.

[0028] First, the system receives the input design file, such as DXF or DWG format. This file typically contains discrete lines (e.g., line segments, arcs, splines) representing the sewing path. By parsing the file structure, all discrete lines that could potentially represent the sewing trajectory are identified. Subsequently, these initially identified discrete lines are filtered for validity (e.g., based on layer name, color, and line type), removing non-trajectory elements such as annotation lines and dimension lines, thereby separating the pure trajectory lines.

[0029] In this embodiment, the separated trajectory lines undergo cusp detection. A cusp is a point where the trajectory direction changes drastically, such as the collar corner or armhole apex in a garment pattern. Using a sliding window method, the front-to-back tangential angle at each point on the trajectory is calculated. If the angle is less than a preset threshold, such as 90 degrees, it is marked as a candidate cusp. After detection, the original trajectory line is broken at each finally determined cusp, generating multiple smoother "trajectory sub-lines" without drastic directional changes. This ensures the accuracy of subsequent fitting and sampling, avoiding robotic arm jitter or trajectory distortion caused by improper fitting or insufficient sampling at cusps.

[0030] Next, each trajectory sub-line is analyzed to obtain its discrete point set, i.e., the coordinates of all vertices constituting the line. Using this point set data, curve fitting algorithms, such as B-spline curve fitting and polynomial fitting, are employed to smoothly approximate the discrete points, generating a continuous, differentiable parameterized curve, i.e., the fitted trajectory sub-line. The fitting process effectively eliminates any minor noise or digitization errors that may exist in the original CAD data, resulting in a smooth geometric representation.

[0031] Then, based on the sampling frequency of the robotic arm control system, e.g., 100Hz, and the required trajectory speed, e.g., 10mm / s, the theoretical sampling interval is calculated: Theoretical sampling interval = Trajectory speed / Sampling frequency, which is 0.02mm in this example. Considering that factors such as elastic or flexible materials (specifically fabric, leather, etc.) and mechanical transmission errors may cause differences between the actual trajectory length and the geometric length, a compensation coefficient is introduced, e.g., a dynamic variable between 0.80 and 1.00, to correct the theoretical sampling interval, resulting in the actual sampling interval. Based on this actual sampling interval, equidistant or adaptive integral sampling is performed along the arc length of the fitted curve to generate dense sampling points.

[0032] Finally, for each trajectory sub-line, a coordinate system is constructed at its endpoints. The origin is the starting point, and the direction from the starting point to the next sampling point is defined as the negative Y-axis, representing the sewing forward direction. The positive X-axis is then determined using the right-hand rule. The coordinates (X, Y) of each sampling point in this coordinate system, along with the tangent angle and curvature value of the curve at that point, are calculated and output. These data (position, direction, curvature) constitute the complete pose command sequence that drives the robotic arm end effector (sewing machine head) to complete high-precision sewing movements.

[0033] In one embodiment of this application, the step of performing cusp detection on each trajectory line and breaking the trajectory lines with cusps to obtain multiple trajectory sub-lines generated after breaking them is further included.

[0034] Convert the coordinates of each point contained in each trajectory line within the design file to coordinates in the image coordinate system.

[0035] Specifically, design files, such as CAD files, typically use their own document coordinate system or world coordinate system, whose origin, orientation, and units may differ from the image coordinate system or physical coordinate system required for subsequent processing. For example, the coordinate units in a DXF file might be inches, while machine vision systems use coordinates in pixels. The conversion process includes: Obtain metadata such as the coordinate units used in the design file, possible insertion points, and scaling ratio.

[0036] Based on the target image coordinate system, such as a pixel coordinate system with the top left corner of the fabric as the origin, the X-axis pointing to the right and the Y-axis pointing downwards, or a physical coordinate system directly in millimeters, calculate the required translation vector, rotation matrix, and scaling factor.

[0037] For each vertex coordinate (P_x_doc, P_y_doc) in the trajectory line, apply the transformation matrix to calculate its new coordinates (P_x_img, P_y_img) in the target image coordinate system.

[0038] In this embodiment, the way coordinates are defined is completely different in the fields of CAD and machine vision, so mapping is required.

[0039] CAD coordinates are typically measured in physical length (mm or inch); their origin (0, 0) is a virtual geometric origin that can be located anywhere on the design drawing, such as the exact center of the pattern or a corner. The Y-axis direction is usually positive upwards (Y-Up). The top of the drawing is the positive Y-axis. The range can be negative, for example, (-100, -50).

[0040] The unit of image coordinates is pixels. Its origin (0, 0) is fixed at the top left corner of the image. The Y-axis direction is typically downwards (Y-Down). The bottom of the image is the positive Y-direction. The range can only be positive numbers, for example, (0, 0) to (2790, 1372).

[0041] Coordinate mapping accurately converts millimeter points in CAD, such as x=50mm, y=20mm, into pixel points in the image, such as u=500px, v=300px, so that the pattern is not distorted after conversion and can be displayed exactly in the center on the image canvas.

[0042] In one embodiment of this application, the step of identifying trajectory lines in the design file and separating the trajectory lines from the design file includes the following steps S101 to S102.

[0043] S101: Read the design file to obtain discrete lines, identify and mark the discrete lines, and perform geometric reconstruction on the marked discrete lines to generate multiple complete geometric paths.

[0044] S102 treats each complete geometric path as a trajectory line.

[0045] Specifically, this step is the entry point for the data processing pipeline. First, the design file is read using a CAD file parsing library, extracting all lines from the file. These lines are initially discrete and independent, such as thousands of individual "Line," "Arc," or "Polyline" lines, especially when the CAD file is exported from certain software or contains complex graphics. By traversing all lines, they are identified and labeled according to predefined rules. The main rules include: Layer-based: focusing only on layers whose names contain keywords such as "stitch" or "outline." Color-based: specifying that only discrete lines with a specific color index, such as red, and index number 1 are considered as trajectories. Linetype-based: excluding certain linetypes from auxiliary linetypes such as dashed lines and dotted lines. By applying these rules, each discrete line is labeled as either a candidate or a non-candidate.

[0046] In this embodiment, after reading a CAD (DXF) file of a garment sleeve, 1250 discrete lines were parsed out. After identification, it was found that only the discrete lines located on the "A-Seam" layer with index 1 (red) were the required trajectory elements. A total of 320 discrete lines were selected, including 280 short line segments and 40 arc segments. These discrete lines would normally be connected end-to-end in the CAD file to represent a complete sewing line, but due to drawing or exporting reasons, they are separated in the data structure.

[0047] Geometric reconstruction involves connecting these lines. From the filtered set of lines, a discrete line is selected as a seed. Other discrete lines that connect to the seed line within a certain tolerance range (e.g., 0.01mm) are then found and connected. This process continues to grow towards both ends until no more connectable discrete lines are found, thus forming a complete geometric path. This process is repeated until all candidate discrete lines are assigned to a path. Ultimately, these 320 discrete lines are reconstructed into 12 complete geometric paths, each representing an independent sewing trajectory line on the sleeve piece.

[0048] In one embodiment of this application, the step of reading the design file, obtaining discrete lines, and identifying and marking the discrete lines includes the following steps S101a to S101c.

[0049] S101a: Extract layer attributes for each discrete line, and perform a first round of filtering on all discrete lines based on the validity of the layer attributes.

[0050] Specifically, layer properties include information such as the layer's type, name, status, and location.

[0051] S101b, for discrete lines that have passed the first round of screening, a second round of screening is conducted based on the validity of the geometric type.

[0052] S101c extracts the color and corresponding geometric data of the discrete lines that have passed the second round of screening.

[0053] Specifically, this is achieved by traversing and extracting features from each discrete line in the DXF model space.

[0054] Read each discrete line in the DXF file in a loop.

[0055] For each discrete line read, its layer name, color, and geometry type are read.

[0056] Case A (Non-discrete lines): If the type of discrete lines is TEXT (text annotation) or DIMENSION (dimension annotation), they will be ignored directly and their geometric information will not be extracted.

[0057] Case B (Irrelevant Layer): If the layer of discrete lines is named "Auxiliary", it will be discarded.

[0058] Case C (Target Discrete Line): If the layer name of the discrete line is "Inner_Sewing" and the type is LWPOLYLINE, further extract its endpoint coordinates and proceed to the subsequent geometric reconstruction steps.

[0059] In the CAD (DXF) file standard, each discrete line is an independent data object, consisting of two main parts: The common attributes section contains information that is universal for all types of discrete lines.

[0060] Layer: The most crucial attribute. Used for semantic classification, for example: "Layer_Cut" for the outline, "Layer_Sew" for the sewing thread.

[0061] Color: is an index value (1=red, 2=yellow, etc.) used to assist in classification.

[0062] Line type: solid line (Continuous), dashed line (Dashed), etc., used to distinguish processes (for example, dashed lines represent creases).

[0063] Handle: A unique ID in the database, such as "4A1", used for tracking.

[0064] The geometry type section, which varies significantly depending on the type of discrete lines, defines its "shape".

[0065] LINE (straight line): includes StartPoint(x, y, z) and EndPoint(x, y, z).

[0066] CIRCLE (circle): contains Center(x, y, z) and Radius(r).

[0067] LWPOLYLINE: Contains a list of vertices Listof(x, y) and a closure indicator.

[0068] In one embodiment of this application, the geometric reconstruction of the identified discrete lines to generate multiple complete geometric paths includes the following steps S101d to S151e.

[0069] S101d creates different candidate pools based on different layer attributes and stores discrete lines into the corresponding candidate pools.

[0070] S101e performs geometric growth based on discrete lines in each candidate pool until each discrete line in each candidate pool becomes at least part of a complete geometric path.

[0071] The geometric growth is performed based on discrete lines in each candidate pool until each discrete line in each candidate pool becomes at least part of a complete geometric path, including the following S111e to S161e.

[0072] S111e selects a discrete line from a candidate pool.

[0073] S121e, the two endpoints of the discrete line are respectively recorded as the current starting point and the current ending point.

[0074] S131e, perform a forward search based on the current endpoint; the forward search includes: determining whether there is a discrete line in the current candidate pool whose endpoint is less than a set threshold; if there is a discrete line in the current candidate pool whose endpoint is less than the set threshold, then remove the discrete line from the candidate pool and add it to the current path, and continue to perform a forward search with the other end of the discrete line as the new current endpoint, until no discrete line that meets the conditions can be found.

[0075] S141e, Perform a reverse search based on the current starting point; the reverse search includes: determining whether there is an endpoint of a discrete line in the current candidate pool whose distance from the current starting point is less than a set threshold; if there is an endpoint of a discrete line in the current candidate pool whose distance from the current starting point is less than the set threshold, then remove the discrete line from the candidate pool and add it to the current path, and continue to perform the reverse search with the other end of the discrete line as the new current starting point until no discrete line that meets the conditions can be found.

[0076] S151e: When neither forward nor reverse search can continue, the currently formed path is saved as a complete geometric path.

[0077] Specifically, if the endpoints of newly added discrete lines coincide with the start and end points of the current path during forward or reverse search, the current path is marked as a closed loop.

[0078] The core idea of ​​geometric reconstruction is to piece together scattered discrete lines like a piecing together... Figure 1 The lines are connected to form a continuous geometric path. To improve efficiency and avoid incorrect connections between different layer trajectories, they are first grouped. Based on the layer attributes of the discrete lines, multiple independent candidate pools are created. For example, all lines with the layer name "SEW_TOP" are placed in candidate pool A, and all lines with the layer name "SEW_BOTTOM" are placed in candidate pool B. The lines in each pool are processed individually.

[0079] Select a candidate pool.

[0080] Randomly select a discrete line from the pool as the "seed" for the current path.

[0081] Using the current endpoint (the end point of the current path) as a reference, search for other discrete lines in the same candidate pool. The search criterion is that the distance between the start or end point of a line and the current endpoint is less than a distance threshold, such as 2mm. If found, remove the line from the pool and connect it to the end of the current path. Pay attention to the direction when connecting: if the start point of the found line is close to the current endpoint, directly append the line's geometric data in sequence; if the end points are close, reverse the vertex order of the line before appending. Then, update the "current endpoint" with the other end of the newly added line and continue the forward search.

[0082] Using the starting point of the current path (current starting point) as a reference, search for connectable discrete lines in the candidate pool, connect them to the beginning of the path, and update the "current starting point".

[0083] When no connectable lines can be found in either the forward or reverse direction, it means that the current path has been fully grown and is saved as a complete geometric path.

[0084] Check if the candidate pool is empty. If the candidate pool is not empty, repeat the above process, select a new seed, and start generating the next path.

[0085] In this embodiment, it is assumed that there are 50 discrete lines in the "SEW_TOP" pool. The distance threshold is set to 2mm. Algorithm begins: Select line segment L1 as the seed path, with starting point S1 and ending point E1.

[0086] Forward search: It is found that the starting point of line segment L2 is 0.5mm away from E1, which is less than the distance threshold. After removing L2 and connecting it to the path, the new endpoint becomes the endpoint E2 of L2.

[0087] Continuing the forward search: It is found that the distance from the end point of line segment L3 to E2 is 0.3mm < distance threshold. After reversing L3 and connecting it, the new end point becomes the starting point S3 of L3.

[0088] Reverse search: It is found that the distance from the end point of line segment L0 to S1 is 0.7mm < distance threshold. Connect L0 to the front end of the path, and the new starting point becomes the starting point S0 of L0.

[0089] After several rounds of growth, no more connectable discrete lines can be found. At this point, a complete path P1, formed by sequentially connecting L0, L1, L2, L3, etc., is generated and saved. The remaining discrete lines in the candidate pool continue this process, potentially generating three complete paths P1, P2, and P3, covering all 50 discrete lines in the pool. These three paths are the trajectory lines reconstructed from the "SEW_TOP" layer.

[0090] In one embodiment of this application, the step of performing cusp detection on each trajectory line and breaking the trajectory lines with cusps to obtain multiple trajectory sub-lines generated after breaking includes the following steps S201 to S205.

[0091] S201, Select a trajectory line.

[0092] S202, analyze the trajectory line to obtain the trajectory point sequence of the trajectory line.

[0093] S203, traverse the trajectory point sequence along the trajectory line in order, and determine whether each trajectory point is a candidate cusp based on the local geometric features of each trajectory point.

[0094] Specifically, starting from one end of the trajectory line, the trajectory points are traversed along the arrangement order, and one trajectory point is selected as the current calculation point.

[0095] Based on the Nth trajectory point before and the Nth trajectory point after the current calculation point, and according to the triangle formed by the current calculation point, the Nth trajectory point before and the Nth trajectory point after the current calculation point, calculate the vertex angle corresponding to the current calculation point as the vertex angle; N is a preset positive integer.

[0096] Determine whether the apex angle is less than a preset angle threshold.

[0097] If the vertex angle is less than a preset angle threshold, the currently calculated point is marked as a candidate cusp, and the vertex angle corresponding to the current calculated point is taken as the angle of the candidate cusp.

[0098] Starting from one end of the trajectory line, slide along the arrangement of the trajectory points to traverse each trajectory point, select a trajectory point as the current calculation point, until all trajectory points have been selected.

[0099] S204, based on preset cusp determination conditions, selects the final cusp from the candidate cusps.

[0100] Specifically, multiple consecutive candidate cusps are merged, and the candidate cusp with the smallest angle is selected from these multiple consecutive candidate cusps as the final cusp output.

[0101] S205, return to the step of selecting a trajectory line until all trajectory lines have been selected.

[0102] Specifically, due to the sliding window and dense sampling, multiple consecutive points near a true cusp may be marked as candidates. These consecutive candidate points need to be merged. By scanning the candidate point list, H consecutively indexed candidate points are grouped together, where H is an integer greater than or equal to 20. For each group of candidate points, the angle θ of each candidate point within the group is calculated, and the candidate point with the smallest angle θ is selected as the unique cusp in the final output of that group. This ensures that only one breakpoint is generated at the sharp inflection points of each trajectory line.

[0103] Set the sliding window radius N, for example, N=5, and the angle threshold, for example, 90 degrees. N determines the range of front and back considered when calculating local angles; too small and it becomes sensitive to noise, too large and it may miss sharp angles. The angle threshold defines the degree of sharpness; only points smaller than this value are considered sharp.

[0104] For each point p_i in the sequence (i ranges from N to mN), we avoid out-of-bounds errors. We calculate the forward vector V_forward = p_{i+N} - p_i, and the backward vector V_backward = p_i - p_{iN}. We use vectors spaced N points apart, rather than adjacent points, to obtain a more stable and macroscopic local direction, reducing the impact of local fluctuations in the point set.

[0105] Calculate the angle θ between vectors V_forward and V_backward. Use the vector dot product formula: θ=arccos((V_forward*V_backward) / (|V_forward|*|V_backward|)), the result is between 0 and 180 degrees.

[0106] If the calculated included angle θ is less than the angle threshold, then the current point p_i is marked as a candidate cusp.

[0107] In this embodiment, there is a trajectory line representing the collar tip, with a point sequence containing 200 points. N=5, and the angle threshold is 90 degrees. When traversing to point p_92, the angle θ between V_forward and V_backward is 85 degrees < 90 degrees, therefore p_92 is marked as a candidate tip. Nearby points p_90, p_91, p_93, ..., p_109 are also marked. These 20 points form a continuous candidate group. Their angles are calculated as follows: {90°, 89°, 80°, 88°, ..., 87°}. p_92 has the smallest angle of 85 degrees, therefore p_92 is ultimately determined as a tip of the trajectory line. After traversing all points, a total of 3 such tips may be detected.

[0108] In one embodiment of this application, the step of performing cusp detection on each trajectory line and breaking the trajectory lines with cusps to obtain multiple trajectory sub-lines generated after breaking them further includes the following steps S206 to S209.

[0109] S206, Select a trajectory line that finds the final cusp.

[0110] S207, parse the trajectory line of the found final cusp to obtain cusp data, the cusp data including the number of final cusps and the position of the final cusps in the trajectory line of the found final cusp.

[0111] S208, based on the position of each final apex, the trajectory line of the found final apex is broken to obtain multiple broken trajectory sub-lines.

[0112] S209, return to select one trajectory line that has found the final cusp, until all trajectory lines that have found the final cusp have been selected.

[0113] Specifically, after obtaining the list of cusp locations, the interruption operation is intuitive. Assume the point sequence of the original trajectory line is P={p0, p1, ..., p_m}, and the detected cusps are arranged in order on the line as {k0, k1, ..., k_n}, where each k_i is the index of a point in P.

[0114] Ensure that the cusp index k_i is strictly incremented along the trajectory direction, which represents the order in which they appear along the trajectory.

[0115] Using the cusp as the dividing point, the original sequence is divided into (n+1) subsequences.

[0116] The first trajectory sub-line: contains all points from the starting point p0 to the first cusp p_{k0}, but does not include the first cusp p_{k0}.

[0117] The i-th trajectory sub-line in the middle: contains all points from the previous cusp p_{k_{i-1}} (excluding) to the current cusp p_{k_i} (excluding).

[0118] The last trajectory sub-line: contains all points from the last cusp p_{k_n} (excluding) to the endpoint p_m.

[0119] Each sub-point sequence is encapsulated as a new trajectory sub-line. These trajectory sub-lines are broken at the cusps, so the geometric changes within each sub-line are relatively gentle, no longer containing the sharp corners of the original line.

[0120] In this embodiment, the original trajectory line has 500 points (p0 to p499). Three sharp points were detected, located at indices k0=120, k1=250, and k2=380 respectively.

[0121] After interruption, four trajectory sub-lines are generated: Sub-line 1: Point sequence p0, p1, ..., p119.

[0122] Sub-line 2: Point sequence p121, p122, ..., p249.

[0123] Sub-line 3: Point sequence p251, p252, ..., p379.

[0124] Sub-line 4: Point sequence p381, p382, ..., p499.

[0125] The dramatic directional changes that were originally at points 120, 250, and 380 have now become the endpoints of the trajectory sub-lines. Subsequent independent fitting and sampling of each trajectory sub-line will naturally connect at these endpoints, but motion commands will allow the robotic arm to smoothly transition or pause at these points, such as picking up a needle, thus physically achieving a sharp angle effect while ensuring the smoothness of the motion within each trajectory segment.

[0126] In one embodiment of this application, the step of calculating the sampling interval based on the sampling frequency and the trajectory walking speed, and introducing a compensation coefficient to correct the sampling interval, includes the following steps S401 to S404.

[0127] S401, set the sampling frequency, and set the corresponding actual routing speed according to the equipment parameters and operating requirements.

[0128] S402 calculates the theoretical sampling interval based on the actual trace speed and sampling frequency.

[0129] S403, based on the theoretical sampling interval, integral sampling of the trajectory arc length is performed to obtain the sampling point sequence.

[0130] S404 introduces a compensation coefficient, which is dynamically adjusted to correct the theoretical sampling interval and obtain the actual sampling interval, in order to compensate for the change in the actual sampling interval caused by deformation.

[0131] Specifically, for example, 100Hz (that is, sending a control command once every 10ms, Δt=0.01).

[0132] The actual sewing speed is set according to different fabric materials (feed speed under different voltages / pressures). For example, if the sewing machine motor is set to 500 rpm and the stitch length is 2 mm, the corresponding ideal fabric sewing speed Vsew = 16.67 mm / s.

[0133] The target arc length ΔL required per unit control time is calculated as Vsew*Δt.

[0134] On the fitted curve, arc length integral sampling is performed according to the calculated ΔL.

[0135] This addresses the issue of uneven stitch length caused by varying fabric stretch rates. For easily stretchable fabrics, a stitch length compensation coefficient is introduced, typically ranging from 0.8 to 1.0 for different fabrics. By adjusting this parameter, the sampling point density is automatically corrected to compensate for stitch length variations caused by fabric deformation, ultimately ensuring that the stitch length, such as 2mm, is accurate.

[0136] In this embodiment, for example, a fitted curve with a length of 50mm, v=10mm / s, f_s=500Hz, and ΔL=0.02mm. Without compensation, approximately 2500 points need to be sampled. Assuming the fabric shrinks by about 2% under these sewing conditions, K_comp=1.02 is set. Then ΔL=1.02*0.02=0.0204mm. Using this corrected interval for integral sampling, the number of sampling points obtained will be slightly less than 2500. When the robotic arm moves in this sequence, although the geometric interval for sending position commands increases, due to fabric shrinkage, the actual stitch length measured on the fabric will be closer to 0.02mm, thus ensuring the accuracy of the final sewing pattern size.

[0137] In one embodiment of this application, the output of sampling point data for each fitted trajectory sub-line includes the following steps S501 to S505.

[0138] S501, select a fitted trajectory sub-line.

[0139] S502, analyze the fitted trajectory sub-line to obtain all sampling points on the fitted trajectory sub-line.

[0140] S503 creates a coordinate system with any sampling point as the origin.

[0141] Specifically, any endpoint of the fitted trajectory sub-line is taken as the origin. The direction from the origin to the next trajectory point is defined as the negative y-axis of the coordinate system. Based on the negative y-axis direction, the positive x-axis direction of the coordinate system is determined using the right-hand rule.

[0142] S504. Based on the location information of the sampling point, obtain the coordinate information of other sampling points in the coordinate system.

[0143] S505, return to the step of selecting a fitted trajectory sub-line, until all fitted trajectory sub-lines have been selected.

[0144] Specifically, when the current endpoint of a trajectory sub-line can be either of the two endpoints of that trajectory sub-line, the origin of multiple trajectory sub-lines in the same sewing direction should usually be set along the sewing direction, thereby increasing the smoothness of sewing, avoiding the robotic arm from moving back and forth, and improving sewing efficiency.

[0145] In this embodiment, when multiple consecutive trajectory sub-lines 1, 2, ..., 10 are all in a sewing direction from left to right, then based on this sewing direction, the leftmost endpoint of each trajectory sub-line is selected as the origin of the local coordinate system.

[0146] The technical features of the above embodiments can be combined arbitrarily, and the execution order of the method steps is not restricted. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0147] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for generating a robotic arm control trajectory, characterized in that, The method for generating the control trajectory of the robotic arm includes: Identify trajectory lines in the design file and separate the trajectory lines from the design file; For each trajectory line, cusp detection is performed, and the trajectory lines with cusps are broken to obtain multiple trajectory sub-lines generated after the break. Each trajectory sub-line is analyzed to obtain the point set data of each trajectory sub-line, and the trajectory sub-line is fitted based on the point set data of each trajectory sub-line to generate the fitted trajectory sub-line. The sampling interval is calculated based on the sampling frequency and the trajectory speed, and a compensation coefficient is introduced to correct the sampling interval; the sampling interval is the distance between two adjacent sampling points on the fitted trajectory sub-line; Output the sampling point data for each fitted trajectory sub-line.

2. The method for generating a robotic arm control trajectory according to claim 1, characterized in that, The method for generating the control trajectory of the robotic arm also includes: Convert the coordinates of each point contained in each trajectory line within the design file to coordinates in the image coordinate system.

3. The method for generating a robotic arm control trajectory according to claim 1, characterized in that, The process of identifying trajectory lines in the design file and separating the trajectory lines from the design file includes: Read the design file to obtain discrete lines, identify and mark the discrete lines, and then perform geometric reconstruction on the marked discrete lines to generate multiple complete geometric paths; Treat each complete geometric path as a trajectory line.

4. The method for generating a robotic arm control trajectory according to claim 3, characterized in that, The process of reading the design file, obtaining discrete lines, and identifying and labeling the discrete lines includes: For each discrete line, layer attributes are extracted, and all discrete lines are filtered in the first round based on the validity of the layer attributes; For discrete lines that pass the first round of screening, a second round of screening is conducted based on the validity of their geometric type. For the discrete lines that pass the second round of screening, extract their color and corresponding geometric data.

5. The method for generating a robotic arm control trajectory according to claim 4, characterized in that, The geometric reconstruction of the marked discrete lines generates multiple complete geometric paths, including: Different candidate pools are created based on different layer properties, and discrete lines are stored in the corresponding candidate pools; Geometric growth is performed based on the discrete lines in each candidate pool until each discrete line in each candidate pool becomes at least part of a complete geometric path.

6. The method for generating a robotic arm control trajectory according to claim 5, characterized in that, The geometric growth based on discrete lines in each candidate pool, until each discrete line in each candidate pool becomes at least part of a complete geometric path, includes: Select a discrete line from a candidate pool; The two endpoints of the discrete line are designated as the current starting point and the current ending point, respectively. Perform a forward search based on the current endpoint; the forward search includes: determining whether there is a discrete line in the current candidate pool whose endpoint is less than a set threshold. If there is a discrete line in the current candidate pool whose endpoint is less than a set threshold, remove the discrete line from the candidate pool and add it to the current path, and continue to perform a forward search with the other end of the discrete line as the new current endpoint until no discrete line that meets the conditions can be found. Perform a reverse search based on the current starting point. The reverse search includes: determining whether there is a discrete line in the current candidate pool whose endpoint is less than a set threshold distance from the current starting point. If there is a discrete line in the current candidate pool whose endpoint is less than a set threshold distance from the current starting point, remove the discrete line from the candidate pool and add it to the current path. Then, use the other end of the discrete line as the new current starting point to continue the reverse search until no discrete line that meets the conditions can be found. When neither forward nor backward search can continue, the current path is saved as a complete geometric path.

7. The method for generating a robotic arm control trajectory according to claim 1, characterized in that, The process involves performing cusp detection on each trajectory line and breaking the trajectory lines containing cusps to obtain multiple sub-trajectory lines generated after the breaks, including: Select a trajectory line; Analyze the trajectory line to obtain the trajectory point sequence; Traverse each trajectory point in the trajectory point sequence along the trajectory direction, and determine whether each trajectory point is a candidate cusp based on its local geometric features. Based on the preset cusp determination criteria, the final cusp is selected from the candidate cusps. Return to the previous step and select a trajectory line until all trajectory lines have been selected.

8. The method for generating a robotic arm control trajectory according to claim 7, characterized in that, The process of performing cusp detection on each trajectory line and breaking the trajectory lines containing cusps to obtain multiple sub-trajectory lines after breaking them also includes: Select a trajectory line that finds the final apex; The trajectory line of the final cusp is analyzed to obtain cusp data, which includes the number of final cusps and the position of the final cusps in the trajectory line of the final cusp. Based on the position of each final cusp, the trajectory line that finds the final cusp is broken to obtain multiple broken trajectory sub-lines; Return to the selected trajectory line that has found its final cusp, and continue until all trajectory lines that have found their final cusps have been selected.

9. The method for generating a robotic arm control trajectory according to claim 1, characterized in that, The step of calculating the sampling interval based on the sampling frequency and trajectory speed, and then correcting the sampling interval by introducing a compensation coefficient, includes: Set the sampling frequency, and set the corresponding actual routing speed according to the equipment parameters and operating requirements; The theoretical sampling interval is calculated based on the actual routing speed and sampling frequency; Based on the theoretical sampling interval, the trajectory arc length is integrally sampled to obtain the sampling point sequence; A compensation coefficient is introduced, and the theoretical sampling interval is corrected by dynamically adjusting the compensation coefficient to obtain the actual sampling interval, so as to compensate for the change in the actual sampling interval caused by deformation.

10. The method for generating a robotic arm control trajectory according to claim 1, characterized in that, The output of the sampling point data for each fitted trajectory sub-line includes: Select a fitted trajectory sub-line; Analyze the fitted trajectory sub-line to obtain all sampling points on the fitted trajectory sub-line; Create a coordinate system with any sampling point as the origin; Based on the location information of this sampling point, the coordinate information of other sampling points in the coordinate system is obtained; Return to the previous step and select a fitted trajectory sub-line, until all fitted trajectory sub-lines have been selected.