A robot welding trajectory automatic generation method
By cleaning, sampling, and enhancing the edge features of the welded workpiece image data, the weld contour and trajectory are optimized, solving the problem of inaccurate image processing in existing technologies. This achieves efficient and accurate welding trajectory generation, thereby improving welding quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-03-27
AI Technical Summary
Existing technologies struggle to effectively eliminate image noise interference, balance contrast, and correct geometric distortion in the automatic generation of robotic welding trajectories. This results in inaccurate weld feature extraction, low welding trajectory generation efficiency, insufficient precision, and negatively impacts welding quality.
By performing data cleaning, downsampling, and pyramid structure edge feature enhancement on the image data of the welded workpiece, a region mask is generated and the shape boundary is connected to optimize the weld contour data, remove redundant sampling points, calculate curvature to optimize sharp inflection points, and generate a smooth and high-precision welding trajectory.
It significantly improves the quality of the data foundation for welding trajectory generation, ensures the accuracy and integrity of weld contours, enhances the precision and practicality of welding trajectories, and guarantees the efficiency and quality of robotic welding operations.
Smart Images

Figure CN121235969B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method for automatically generating robot welding trajectories. Background Technology
[0002] In the field of automatic generation of robotic welding trajectories, the completeness and accuracy of image data preprocessing are fundamental to trajectory generation. Existing technologies struggle to efficiently eliminate noise interference in welded workpiece images, fail to adequately balance image contrast, and lack effective methods for correcting geometric distortions. This results in preprocessed images failing to accurately recreate the true shape of the weld area, directly impacting the reliability of subsequent weld feature extraction.
[0003] Existing technologies have significant limitations in weld feature enhancement and welding trajectory optimization. They typically rely on single-resolution images for edge detection, making it difficult to comprehensively capture the multi-scale features of the weld, resulting in incomplete weld contour extraction and blurred boundaries. Furthermore, during trajectory generation, the redundant screening of sampling points is not thorough enough, and there is a lack of scientific curvature optimization schemes for sharp inflection points in the trajectory. This leads to insufficient smoothness and low accuracy of the generated welding trajectory, thereby reducing the efficiency of welding operations and affecting the welding quality of the workpiece. Therefore, improving the efficiency of automatic generation of robotic welding trajectories has become an urgent problem to be solved. Summary of the Invention
[0004] This invention provides a method for automatically generating robot welding trajectories to solve the problems mentioned in the background art.
[0005] To achieve the above objectives, the present invention provides a method for automatically generating robot welding trajectories, comprising:
[0006] S1. Perform data cleaning on the image data of the welded workpiece to obtain the standard image data of the welded workpiece;
[0007] S2. Downsample the standard image data to obtain a differentiated resolution image of the welded workpiece, and perform edge feature enhancement on the differentiated resolution image according to the pyramid structure to obtain an enhanced feature map of the welded workpiece.
[0008] S3. Based on the grayscale distribution in the enhanced feature map, generate a region mask for the welded workpiece, and connect the region mask by shape boundaries to obtain the weld contour data of the welded workpiece.
[0009] S4. Obtain the welding trajectory sampling points of the contour geometric boundary in the weld contour data, and connect the welding trajectory sampling points according to the weld shape characteristics to obtain the initial welding trajectory of the welded workpiece.
[0010] S5. Optimize the curvature of the sharp inflection points in the initial welding trajectory to obtain the target welding trajectory of the welded workpiece;
[0011] S6. Encode and encapsulate the target welding trajectory and transmit it to the robot control terminal.
[0012] In a preferred embodiment, the step of data cleaning the image data of the welded workpiece to obtain standard image data of the welded workpiece includes:
[0013] Noise is removed from the image data to obtain the preprocessed image data of the welded workpiece;
[0014] Adjust the contrast of the preprocessed image data to obtain high-contrast image data of the welded workpiece;
[0015] The welding area in the high-contrast image data is cropped to obtain the equalized image data of the welded workpiece;
[0016] The equalized image data is corrected by affine transformation to obtain the standard image data of the welded workpiece.
[0017] In a preferred embodiment, downsampling the standard image data to obtain a differentiated resolution image of the welded workpiece, and then performing edge feature enhancement on the differentiated resolution image according to a pyramid structure to obtain an enhanced feature map of the welded workpiece, includes:
[0018] The standard image data is downsampled to obtain a differentiated resolution image of the welded workpiece;
[0019] Based on the pyramid structure, image edges at different resolution levels in the differential resolution image are detected to obtain a multi-scale edge map of the welded workpiece;
[0020] By enhancing the edge features of the multi-scale edge map, an edge-enhanced image of the welded workpiece is obtained.
[0021] The edge enhancement images are fused to obtain an enhanced feature map of the welded workpiece.
[0022] In a preferred embodiment, the step of generating a region mask of the welded workpiece based on the grayscale distribution in the enhanced feature map, and connecting the region mask by shape boundaries to obtain the weld contour data of the welded workpiece, includes:
[0023] The enhanced feature map is segmented by grayscale thresholding to obtain a binary image of the candidate weld seam of the welded workpiece;
[0024] Filter out connected candidate regions in the binary image of the candidate weld that conform to the geometric features of the workpiece to obtain the region mask of the welded workpiece;
[0025] Boundary pixel point tracking is performed on the region mask to obtain the initial boundary point set of the welded workpiece;
[0026] By sequentially connecting the boundary points in the initial boundary point set, the weld contour data of the welded workpiece is obtained.
[0027] In a preferred embodiment, the step of performing grayscale thresholding on the enhanced feature map to obtain a candidate weld binary image of the welded workpiece includes:
[0028] Extract the grayscale value set from the enhanced feature map;
[0029] The preset grayscale threshold of the enhanced feature map is determined based on the distribution characteristics of the grayscale value set;
[0030] Pixels in the enhanced feature map whose grayscale value is greater than the preset grayscale threshold are classified as foreground regions;
[0031] Pixels in the enhanced feature map whose grayscale value is less than or equal to the preset grayscale threshold are classified as background regions;
[0032] Based on the background difference between the foreground region and the background region, a binary image of the candidate weld seam of the welded workpiece is constructed.
[0033] In a preferred embodiment, the step of acquiring welding trajectory sampling points of the contour geometric boundary in the weld contour data, and connecting the welding trajectory sampling points according to the weld shape characteristics to obtain the initial welding trajectory of the welded workpiece includes:
[0034] Mark the contour boundary points in the weld contour data to obtain a candidate sampling point set for the weld contour data;
[0035] Remove redundant points from the candidate sampling point set to obtain the target sampling points of the candidate sampling point set;
[0036] Based on the geometric continuity of the weld contour data, the target sampling points are arranged in an orderly manner to obtain the sampling point sequence of the weld contour data;
[0037] The sampling points are connected sequentially according to the sampling point sequence and used as the initial welding path for the workpiece.
[0038] The initial welding path is smoothed by interpolation to obtain the initial welding trajectory of the workpiece.
[0039] In a preferred embodiment, the step of smoothing and interpolating the preliminary welding path to obtain the initial welding trajectory of the workpiece includes:
[0040] The initial welding path is divided into straight line segments;
[0041] Intermediate interpolation points are inserted between the start and end path segments of the straight path segment;
[0042] Adjust the spatial position of the intermediate interpolation points to obtain a smooth transition curve between adjacent straight segments of the path;
[0043] Connect all sampling points with the adjusted intermediate interpolation points to generate the initial welding trajectory of the welded workpiece.
[0044] In a preferred embodiment, the curvature optimization of sharp inflection points in the initial welding trajectory to obtain the target welding trajectory of the workpiece includes:
[0045] Calculate the curvature values of the trajectory points in the initial welding trajectory, and select the trajectory points with significant curvature changes as the sharp inflection points of the initial welding trajectory;
[0046] Select the set of optimized control points from the trajectory segments before and after the sharp inflection point;
[0047] Connect the optimized control points in the optimized control point set to obtain the optimized trajectory segment of the initial welding trajectory;
[0048] The target welding trajectory of the welded workpiece is obtained by replacing the original trajectory segment containing the sharp inflection point with the optimized trajectory segment.
[0049] In a preferred embodiment, the curvature value is calculated using the following formula: ;
[0050] In the formula, For the first welding trajectory in the initial welding trajectory The curvature value of each trajectory point For the first welding trajectory in the initial welding trajectory The trajectory points are at The amount of gray-level gradient change in the direction. For the first welding trajectory in the initial welding trajectory The trajectory points are at The amount of gray-level gradient change in the direction. and For the first welding trajectory in the initial welding trajectory Two-dimensional coordinates of a trajectory point and For the first welding trajectory in the initial welding trajectory Two-dimensional coordinates of a trajectory point and For the first welding trajectory in the initial welding trajectory Two-dimensional coordinates of a trajectory point To prevent tiny positive numbers with a denominator of zero.
[0051] In a preferred embodiment, selecting the optimized control point set from the trajectory segments before and after the sharp inflection point includes:
[0052] A front-end control point is set on the trajectory segment at a preset distance in front of the sharp inflection point;
[0053] A rear control point is set on the trajectory segment at a preset distance behind the sharp inflection point;
[0054] Based on the curvature change trend at the sharp inflection point, an intermediate control point is set between the front control point and the rear control point;
[0055] By connecting the intermediate control points to form a polyline path and verifying the curvature continuity of the polyline path, an optimized control point set for the initial welding trajectory is obtained.
[0056] Compared with the prior art, the present invention has the following beneficial effects:
[0057] 1. This invention significantly improves the quality of the initial data foundation for welding trajectory generation through multi-step precise image data processing. It sequentially performs noise removal, contrast adjustment, welding area cropping, and affine transformation correction on the welded workpiece image data, effectively obtaining standard image data. Furthermore, by combining a pyramid structure to enhance edge features of images with varying resolutions, it comprehensively captures the multi-scale features of the weld. Then, by generating a region mask through grayscale distribution and connecting shape boundaries, it ensures the accuracy and completeness of the weld contour data, providing a reliable basis for subsequent welding trajectory generation.
[0058] 2. This invention has significant advantages in the welding trajectory generation and optimization process, effectively improving trajectory accuracy and practicality. It removes redundant points from the candidate sampling point set and arranges the sampling points according to geometric continuity, then performs smooth interpolation to obtain the initial welding trajectory. Simultaneously, it filters sharp inflection points based on curvature calculations, generates optimized trajectory segments by setting an optimized control point set to replace the original trajectory segments, ultimately obtaining a target welding trajectory with high smoothness and accuracy. After encoding and encapsulation, this trajectory is transmitted to the robot control terminal, directly ensuring the efficiency of robot welding operations and guaranteeing stable welding quality. Attached Figure Description
[0059] Figure 1 This is a flowchart illustrating an automatic robot welding trajectory generation method according to an embodiment of the present invention.
[0060] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0061] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0062] This application provides a method for automatically generating robot welding trajectories. The execution subject of this method includes, but is not limited to, at least one of the following electronic devices that can be configured to execute the method provided in this application: a server, a terminal, etc. In other words, the method for automatically generating robot welding trajectories can be executed by software or hardware installed on a terminal device or a server device. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cloud server cluster. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0063] Reference Figure 1 The diagram shown is a flowchart illustrating an automatic robot welding trajectory generation method according to an embodiment of the present invention. In this embodiment, the automatic robot welding trajectory generation method includes:
[0064] S1. Perform data cleaning on the image data of the welded workpiece to obtain the standard image data of the welded workpiece;
[0065] In this embodiment of the invention, the step of data cleaning the image data of the welded workpiece to obtain standard image data of the welded workpiece includes:
[0066] Noise is removed from the image data to obtain the preprocessed image data of the welded workpiece;
[0067] Adjust the contrast of the preprocessed image data to obtain high-contrast image data of the welded workpiece;
[0068] The welding area in the high-contrast image data is cropped to obtain the equalized image data of the welded workpiece;
[0069] The equalized image data is corrected by affine transformation to obtain the standard image data of the welded workpiece.
[0070] When removing noise, median filtering is used to process the image data. Specifically, each pixel in the image is selected sequentially, and a fixed-size region is defined centered on that pixel. The brightness values of all pixels within this region are sorted by size, and the brightness value at the middle position after sorting is used to replace the original pixel's brightness value. This method eliminates isolated bright or dark spots and other noise in the image, resulting in preprocessed image data of the welded workpiece.
[0071] When adjusting the contrast of the preprocessed image data, a linear contrast stretching method is used. First, the brightness values of all pixels in the preprocessed image data are identified, and the minimum and maximum values are determined. Then, the brightness values of all pixels are remapped so that the original minimum value corresponds to the minimum brightness value, and the original maximum value corresponds to the maximum brightness value. The brightness values of the remaining pixels are calculated according to the proportion of the difference between the minimum and maximum values and assigned new brightness values. In this way, the brightness difference between different areas is increased, resulting in high-contrast image data of the welded workpiece.
[0072] When cropping the welding area in high-contrast image data, the boundary of the welding area in the high-contrast image is first determined by observation. The boundary is composed of edges in four directions: top, bottom, left, and right. Each edge corresponds to a straight line. The position of the straight line is determined based on the obvious difference between the welding area and the non-welding area under high contrast. Then, all the image parts outside these four boundaries are removed, and only the welding area enclosed by the four boundaries is retained to obtain the equalized image data of the welded workpiece.
[0073] When performing affine transformation correction on equalized image data, three non-collinear feature points are first identified in the equalized image data. These feature points are fixed marks or structural vertices on the welded workpiece. Then, the target positions corresponding to these three feature points in the standard image are determined. The image is then moved so that the first feature point coincides with the target position, rotated so that the second feature point aligns with the corresponding target position after the movement, and scaled so that the third feature point matches the corresponding target position after the movement and rotation. Through this series of operations, the pose of the equalized image data is made consistent with the standard pose, thus obtaining the standard image data of the welded workpiece.
[0074] The beneficial effects are that noise removal can reduce interference in the image and obtain clear preprocessed image data; contrast adjustment can increase the brightness difference between different areas and obtain high-contrast image data that is easy to distinguish; cropping operation can focus on the welding area, remove irrelevant parts, and obtain equalized image data containing only the welding area; affine transformation correction can unify the image posture, make the image conform to the standard shape, and finally obtain accurate standard image data, providing a reliable basis for subsequent processing of welded workpieces.
[0075] S2. Downsample the standard image data to obtain a differentiated resolution image of the welded workpiece, and perform edge feature enhancement on the differentiated resolution image according to the pyramid structure to obtain an enhanced feature map of the welded workpiece.
[0076] In this embodiment of the invention, the step of downsampling the standard image data to obtain a differentiated resolution image of the welded workpiece, and then performing edge feature enhancement on the differentiated resolution image according to a pyramid structure to obtain an enhanced feature map of the welded workpiece, includes:
[0077] The standard image data is downsampled to obtain a differentiated resolution image of the welded workpiece;
[0078] Based on the pyramid structure, image edges at different resolution levels in the differential resolution image are detected to obtain a multi-scale edge map of the welded workpiece;
[0079] By enhancing the edge features of the multi-scale edge map, an edge-enhanced image of the welded workpiece is obtained.
[0080] The edge enhancement images are fused to obtain an enhanced feature map of the welded workpiece.
[0081] When downsampling standard image data, the standard image data is used as the initial image. Starting from the first pixel in the top left corner, pixels are selected one pixel at a time, both horizontally and vertically. These selected pixels are then arranged in their original positions to form a new image. This new image has one-quarter the number of pixels and half the resolution of the initial image. This new image is then used as the object for the next sampling, and the same method of selecting pixels every other pixel is used to generate a new image, with the resolution further reduced to half that of the previous image. This process is repeated multiple times, with each generated image having half the resolution of the previous one. Ultimately, a series of images with progressively decreasing resolution are obtained, which together constitute the differentiated resolution images of the welded workpiece.
[0082] When detecting image edges at different resolution levels in differentially resolved images using a pyramid structure, the differentially resolved images are stacked in descending order of resolution, forming a pyramid structure with the highest resolution image at the bottom and the lowest resolution image at the top. Each layer corresponds to one resolution level. For each layer of the pyramid structure, the pixels in the image are scanned row by row. For each pixel in each row, its brightness value is compared with its right-hand neighbor and its bottom neighbor. When the difference in brightness value between two adjacent pixels is significant enough to distinguish them, a line segment is marked as an edge at the boundary between these two pixels. After performing this row-by-row, pixel-by-pixel comparison and edge marking for all layers of the image, the edge marking results for each layer are collected to obtain a multi-scale edge map of the welded workpiece.
[0083] When enhancing the edge features of a multi-scale edge map, for each marked edge segment in the multi-scale edge map, the brightness values of all pixels on the segment are adjusted to the highest possible brightness in the image, while the brightness values of pixels within one pixel range on either side of the edge segment are adjusted to the lowest possible brightness in the image, significantly enhancing the brightness contrast between the edge segment and the surrounding area. For discontinuities in the edge segments—that is, two edge segments in the same direction with close endpoints—they are connected by adding pixels at the discontinuity to form a continuous segment, ensuring the integrity of the edge segments. After this brightness adjustment and discontinuity connection process, the edge-enhanced image of the welded workpiece is obtained.
[0084] When fusing edge enhancement images, the highest-resolution edge enhancement image in the pyramid structure is used as the base image for fusion, as this image retains the richest detail information. Then, the next adjacent layer of edge enhancement images in the pyramid structure is taken, and its edge features are mapped to the corresponding positions in the base image according to the resolution ratio of the two layers. During the mapping process, only those clear edge features not present in the base image are retained. Next, lower-resolution edge enhancement images are processed sequentially, similarly mapped to the base image according to the resolution ratio, continuously retaining new clear edge features while removing parts that are duplicated or blurred with existing features. After all layers of edge enhancement images have been mapped and integrated, an enhanced feature map of the welded workpiece containing clear edge features at multiple scales is obtained.
[0085] The beneficial effects are that the differential resolution images obtained by downsampling provide an image foundation at different resolution levels, meeting the needs of multi-scale analysis; the multi-scale edge maps obtained based on pyramid structure detection can comprehensively capture image edges at all resolution levels, ensuring the integrity of edge information; the edge enhancement images obtained by strengthening edge features make the contrast between the edge and the surrounding area more significant, and the edge lines more complete and clear; the enhanced feature maps obtained by fusing edge enhancement images integrate clear edge information at multiple scales, providing a rich and reliable feature foundation for subsequent accurate detection and analysis of welded workpieces.
[0086] S3. Based on the grayscale distribution in the enhanced feature map, generate a region mask for the welded workpiece, and connect the region mask by shape boundaries to obtain the weld contour data of the welded workpiece.
[0087] In this embodiment of the invention, the step of generating a region mask of the welded workpiece based on the grayscale distribution in the enhanced feature map, and connecting the region mask by shape boundaries to obtain the weld contour data of the welded workpiece, includes:
[0088] The enhanced feature map is segmented by grayscale thresholding to obtain a binary image of the candidate weld seam of the welded workpiece;
[0089] Filter out connected candidate regions in the binary image of the candidate weld that conform to the geometric features of the workpiece to obtain the region mask of the welded workpiece;
[0090] Boundary pixel point tracking is performed on the region mask to obtain the initial boundary point set of the welded workpiece;
[0091] By sequentially connecting the boundary points in the initial boundary point set, the weld contour data of the welded workpiece is obtained.
[0092] The step of performing grayscale thresholding on the enhanced feature map to obtain a candidate weld binary image of the welded workpiece includes:
[0093] Extract the grayscale value set from the enhanced feature map;
[0094] The preset grayscale threshold of the enhanced feature map is determined based on the distribution characteristics of the grayscale value set;
[0095] Pixels in the enhanced feature map whose grayscale value is greater than the preset grayscale threshold are classified as foreground regions;
[0096] Pixels in the enhanced feature map whose grayscale value is less than or equal to the preset grayscale threshold are classified as background regions;
[0097] Based on the background difference between the foreground region and the background region, a binary image of the candidate weld seam of the welded workpiece is constructed.
[0098] When performing grayscale thresholding on the enhanced feature map, the difference in grayscale performance between the weld area and the non-weld area is carefully observed to determine a fixed grayscale segmentation threshold. This threshold clearly distinguishes the bright edge areas related to the weld from other background areas with lower grayscale. Then, each pixel in the enhanced feature map is scanned row by row and column by column, and the grayscale value of each pixel is compared with the set segmentation threshold. If the grayscale value of a pixel is greater than the threshold, it indicates that the pixel belongs to the weld-related area, and its grayscale value is adjusted to the highest allowed brightness value of the image. If the grayscale value of a pixel is less than or equal to the threshold, it indicates that the pixel belongs to the background area, and its grayscale value is adjusted to the lowest allowed brightness value of the image. After completing the judgment and adjustment of all pixels, only black and white pixels are retained in the image, where white areas correspond to possible weld areas and black areas are the background, thus obtaining a binary image of the candidate weld of the welded workpiece.
[0099] When screening connected candidate regions in the binary image of candidate welds that conform to the geometric features of the workpiece, the geometric features of the weld of the workpiece are first identified as elongated, uniform in width, and with a fixed orientation. Screening criteria are established based on these features. First, all white connected candidate regions are identified in the binary image of the candidate welds. A connected candidate region refers to an independent region composed of multiple adjacent white pixels, with the adjacency criterion being that the pixels are directly connected in the horizontal, vertical, or diagonal direction. For each identified connected candidate region, the boundary range of the region is determined by pixel-by-pixel statistics. The length and width of the region are calculated, and it is determined whether its shape conforms to the elongated shape. Simultaneously, the uniformity of the region width and whether its orientation is consistent with the preset weld orientation of the workpiece are checked. Connected regions with irregular shapes, abrupt width changes, or orientations deviating from the preset range are eliminated. Only connected regions that meet all geometric feature requirements are retained. These retained connected regions together constitute the region mask of the welded workpiece.
[0100] When tracking boundary pixels on a region mask, the first pixel located at the edge of a white connected region is identified as the starting point. This starting pixel must be white, and at least one of its eight neighboring pixels must be a black background pixel. Using the starting pixel as a reference, the color states of the pixels surrounding the current pixel are checked sequentially in a clockwise direction. The next pixel adjacent to the current pixel and belonging to the edge of a white region is prioritized as the next target for tracking. The criteria for edge pixels are the same as for the starting pixel: it must be white and have a black neighboring pixel. For each pixel that meets the requirements, its coordinates in the image are recorded. This pixel is then used as the new current pixel, and the process of checking and selecting neighboring pixels is repeated until the coordinates of the tracked pixel coincide with the coordinates of the initial starting pixel. At this point, tracking stops, and the set of all recorded pixel coordinates constitutes the initial boundary point set of the welding workpiece.
[0101] When connecting the boundary points in the initial boundary point set in an orderly manner, the order in which the pixels were recorded during the boundary point tracking process is used as the connection order. This order itself follows a clockwise direction around the weld area, ensuring the orderliness of the boundary points. Starting from the first point in the initial boundary point set, a straight line segment connects this point to the next adjacent point. Then, starting from the second point, it connects to the third point, and so on, connecting subsequent boundary points in this way, so that each point forms a continuous line segment with the preceding and following points. When connecting to the last point in the initial boundary point set, this point is connected to the first point with a straight line segment, forming a complete closed contour. Integrating all the connected line segments and their corresponding pixel coordinate information yields the weld contour data of the welded workpiece that fully reflects the shape of the weld.
[0102] To extract the grayscale value set from the enhanced feature map, it is necessary to traverse every pixel in the enhanced feature map, read the grayscale value corresponding to each pixel one by one, and collect all the read grayscale values to form a set containing the grayscale information of all pixels in the enhanced feature map. This set is the grayscale value set of the enhanced feature map.
[0103] To determine the preset grayscale threshold of the enhanced feature map based on the distribution characteristics of the grayscale value set, it is necessary to first observe the distribution of all grayscale values in the grayscale value set and count the number of times each grayscale value appears in the set. These counts can reveal the concentration trend of the grayscale values, such as which grayscale values appear more frequently and which appear less frequently. Then, combined with the general difference in grayscale between the weld seam and the background of the welded workpiece, a grayscale value that can clearly distinguish the possible weld seam area and the background area is selected from the grayscale value set. This selected grayscale value is the preset grayscale threshold.
[0104] Pixels in the enhanced feature map whose grayscale value is greater than the preset grayscale threshold are classified as foreground regions. Each pixel in the enhanced feature map is checked one by one, and the grayscale value of the pixel is obtained and compared with the preset grayscale threshold. When the grayscale value of the pixel is greater than the preset grayscale threshold, the pixel is marked as belonging to the foreground region. After checking and marking all pixels, all pixels marked as foreground regions together constitute the foreground region of the enhanced feature map.
[0105] Pixels in the enhanced feature map whose grayscale value is less than or equal to the preset grayscale threshold are classified as background regions. Each pixel in the enhanced feature map needs to be examined one by one, and the grayscale value of the pixel is obtained and compared with the preset grayscale threshold. When the grayscale value of the pixel is less than or equal to the preset grayscale threshold, the pixel is marked as belonging to the background region. After all pixels have been checked and marked, all pixels marked as background regions together form the background region of the enhanced feature map.
[0106] Based on the background difference between the foreground region and the background region, a binary image of the candidate weld seam of the welded workpiece is constructed. Since the foreground region and the background region have been clearly distinguished by comparing the grayscale value with the preset grayscale threshold, the difference in grayscale between the two is reflected in the different regions to which the pixels belong. At this time, when constructing the binary image, all pixels in the foreground region are uniformly set to one color, and all pixels in the background region are uniformly set to another color. The resulting image containing only two colors is the binary image of the candidate weld seam of the welded workpiece, where the white part is the candidate weld seam region.
[0107] The beneficial effects are as follows: the binary image of the candidate weld obtained by grayscale thresholding of the enhanced feature map can clearly distinguish the weld-related area from the background, providing a clear basis for subsequent screening; the region mask obtained by screening connected candidate regions that conform to the geometric features of the workpiece can eliminate invalid areas and retain real and valid weld-related areas; the initial boundary point set obtained by tracking the boundary pixels of the region mask can accurately capture the edge pixels of the weld area, providing accurate point information for contour construction; the weld contour data obtained by orderly connecting the initial boundary points can form a complete closed weld shape, accurately reflecting the actual contour of the weld, and providing a reliable contour basis for subsequent work such as quality inspection of welded workpieces.
[0108] By extracting all gray values from the enhanced feature map to form a gray value set, a comprehensive understanding of the image's gray-level information can be obtained, providing a complete data foundation for subsequent processing. Determining a preset gray-level threshold based on the distribution characteristics of the gray value set ensures that the threshold selection closely matches the actual gray-level distribution of the image, effectively distinguishing potential weld seams from the background. Pixels with gray values greater than the preset gray-level threshold are classified as foreground regions, accurately locating potential weld-related areas. Pixels with gray values less than or equal to the preset gray-level threshold are classified as background regions, clearly defining non-weld seam areas and establishing a clear boundary between foreground and background. Constructing a binary image of candidate weld seams based on the differences between the foreground and background regions visually presents the morphology of the candidate weld seams, providing clear and reliable image evidence for further identification and analysis of weld seams in the welded workpiece.
[0109] S4. Obtain the welding trajectory sampling points of the contour geometric boundary in the weld contour data, and connect the welding trajectory sampling points according to the weld shape characteristics to obtain the initial welding trajectory of the welded workpiece.
[0110] In this embodiment of the invention, obtaining the welding trajectory sampling points of the contour geometric boundary in the weld contour data, and connecting the welding trajectory sampling points according to the weld shape characteristics to obtain the initial welding trajectory of the welded workpiece includes:
[0111] Mark the contour boundary points in the weld contour data to obtain a candidate sampling point set for the weld contour data;
[0112] Remove redundant points from the candidate sampling point set to obtain the target sampling points of the candidate sampling point set;
[0113] Based on the geometric continuity of the weld contour data, the target sampling points are arranged in an orderly manner to obtain the sampling point sequence of the weld contour data;
[0114] The sampling points are connected sequentially according to the sampling point sequence and used as the initial welding path for the workpiece.
[0115] The initial welding path is smoothed by interpolation to obtain the initial welding trajectory of the workpiece.
[0116] The step of smoothing and interpolating the preliminary welding path to obtain the initial welding trajectory of the workpiece includes:
[0117] The initial welding path is divided into straight line segments;
[0118] Intermediate interpolation points are inserted between the start and end path segments of the straight path segment;
[0119] Adjust the spatial position of the intermediate interpolation points to obtain a smooth transition curve between adjacent straight segments of the path;
[0120] Connect all sampling points with the adjusted intermediate interpolation points to generate the initial welding trajectory of the welded workpiece.
[0121] To obtain the candidate sampling point set of the weld contour data, the boundary points of the weld contour data are marked. This requires traversing all points contained in the weld contour data and determining whether each point is located at the boundary of the contour. During the determination, the connection relationship between the point and other surrounding points is observed. If the point is a component of the contour edge, that is, one side is inside the contour and the other side is outside the contour, then the point is marked as a contour boundary point. All points marked as contour boundary points are collected, and the resulting set is the candidate sampling point set of the weld contour data.
[0122] Redundant points in the candidate sampling point set are removed to obtain the target sampling points of the candidate sampling point set. Each adjacent point in the candidate sampling point set is checked one by one to observe the actual distance between the two points. If the distance between two adjacent points is extremely small, only a negligible gap in the contour details, and these two points do not contribute to the complete description of the contour shape, that is, keeping one of the points can accurately reflect the contour features of the position, then one of the points is removed from the candidate sampling point set. After completing such checks and removal operations on all adjacent points, the remaining points are the target sampling points of the candidate sampling point set.
[0123] Based on the geometric continuity of the weld contour data, the target sampling points are arranged in an orderly manner to obtain the sampling point sequence of the weld contour data. It should be clear that the geometric continuity of the weld contour data is manifested as the contour being a continuous and uninterrupted line, with each part smoothly connected without breaks. Therefore, starting from one endpoint of the contour, which can be determined by observing the starting position of the contour, the next target sampling point that is directly connected to the endpoint along the extension direction of the contour is found and placed after the endpoint. Then, using this point as a reference, the next target sampling point along the extension direction of the contour is found. All target sampling points are arranged in this way, and the resulting ordered queue is the sampling point sequence of the weld contour data.
[0124] The sampling points are connected sequentially according to the sampling point sequence to form the initial welding path of the workpiece. The order of the sampling point sequence must be followed. Starting from the first point of the sequence, a straight line is used to connect it to the second point of the sequence. Then, starting from the second point, a straight line is used to connect it to the third point. This connection method continues until a straight line is used to connect it to the last point of the sequence. The broken line formed by these continuous straight line segments is the initial welding path of the workpiece.
[0125] The initial welding path is smoothed by interpolation to obtain the initial welding trajectory of the workpiece. For each straight line in the initial welding path, several transition points are added between two adjacent sampling points based on the contour of the two points. The positions of these transition points are set to make the original straight line segment gradually bend. For example, at the corner formed by the straight line segment, the position of the transition point will be shifted to the inside of the corner to make the corner rounded and eliminate the abrupt transition caused by the straight line connection. After such processing, the initial welding path originally composed of straight line segments is transformed into a continuous and smooth curve. This curve is the initial welding trajectory of the workpiece.
[0126] The preliminary welding path is divided into straight line segments. It should be clear that the preliminary welding path is a broken line formed by connecting adjacent sampling points in the sampling point sequence. The line connecting each pair of adjacent sampling points is an independent straight line segment. Therefore, each sampling point in the sampling point sequence is directly used as the dividing point to decompose the preliminary welding path into multiple continuous straight line parts. The two ends of each straight line part correspond to two adjacent sampling points in the sampling point sequence. These decomposed straight line parts together constitute the straight line segments of the path.
[0127] To insert intermediate interpolation points between the start and end path segments of the straight path, it is necessary to first determine that the start and end path segments refer to two adjacent straight path segments, that is, the end point of the previous straight path segment and the start point of the next straight path segment are the same sampling point. These two straight path segments form a corner at this sampling point. Near this corner, along the inside of the angle formed by the two straight path segments, select several position points. These position points are neither located on the previous straight path segment nor on the next straight path segment, but are located in the transition area between the two straight path segments. These selected position points are used as intermediate interpolation points and inserted between the two straight path segments.
[0128] Adjusting the spatial position of the intermediate interpolation points to obtain a smooth transition curve between adjacent path straight segments requires observing the direction of the two adjacent path straight segments and the angle of the corners they form. For each inserted intermediate interpolation point, if its position causes a significant break in the line connecting the end point of the previous path straight segment, the intermediate interpolation point, and the starting point of the next path straight segment, then move the position of the intermediate interpolation point closer to the inside of the corner. Ensure that the line connecting the end point of the previous path straight segment to the intermediate interpolation point and the line connecting the intermediate interpolation point to the starting point of the next path straight segment forms a continuous curve trend. After multiple fine adjustments, continue until the two adjacent path straight segments can be naturally connected through the intermediate interpolation points, forming a smooth transition curve without significant bends.
[0129] Connect all sampling points with the adjusted intermediate interpolation points to generate the initial welding trajectory of the workpiece. The sampling points should be connected in the order of their sequence, starting from the first sampling point. First, connect the sampling point to the adjusted intermediate interpolation point between the straight line segment of the path containing the sampling point and the next straight line segment. Then, connect the intermediate interpolation point to the next sampling point. Next, connect the next sampling point to the adjusted intermediate interpolation point between the sampling point and the next straight line segment, and so on, until the last sampling point is connected. Through this continuous connection, the initial welding path, which was originally composed of straight line segments, is transformed into a continuous curve containing a smooth transition section. This curve is the initial welding trajectory of the workpiece.
[0130] The beneficial effects are as follows: Firstly, the candidate sampling point set is obtained by annotating the contour boundary points in the weld contour data, accurately acquiring all key points constituting the contour boundary and providing comprehensive basic data for subsequent trajectory generation. Secondly, redundant points in the candidate sampling point set are removed to obtain target sampling points, simplifying the data volume and eliminating redundant or overly close points that are meaningless for contour description, thus avoiding interference from redundant information in subsequent processing. Thirdly, the sampling point sequence is obtained by arranging the target sampling points in an orderly manner according to geometric continuity, ensuring that the sampling points are distributed in an orderly manner according to the natural extension direction of the contour, and ensuring that the subsequent path connection conforms to the actual shape of the contour. Fourthly, the preliminary welding path is obtained by connecting adjacent points according to the sampling point sequence, which can initially construct a path framework that fits the weld contour and intuitively present the general direction of the weld. Fifthly, the initial welding trajectory is obtained by smoothing the preliminary welding path through interpolation, eliminating abrupt turns in the path, making the trajectory continuous and smooth, which better meets the requirements of actual welding operation for path smoothness, and provides accurate and reliable trajectory basis for the welding process.
[0131] Dividing the initial welding path into straight line segments breaks down the path composed of broken lines into independent straight line parts, providing clear operational units for subsequent smoothing and facilitating targeted adjustments to each segment. Inserting intermediate interpolation points between the start and end points of the straight line segments introduces transition points at the corners formed by adjacent straight line segments, providing a basis for eliminating abrupt transitions between straight lines and making smooth transitions possible. Adjusting the spatial position of the intermediate interpolation points yields smooth transition curves between adjacent straight line segments, allowing straight line segments that originally formed corners to connect naturally through intermediate interpolation points, completely eliminating abrupt transitions caused by broken lines and ensuring a continuous and smooth path. Connecting all sampling points with the adjusted intermediate interpolation points generates the initial welding trajectory, which integrates each straight line segment and smooth transition portion into a complete curve, forming a continuous trajectory that meets the requirements of welding operations, providing precise and smooth path guidance for the welding process.
[0132] S5. Optimize the curvature of the sharp inflection points in the initial welding trajectory to obtain the target welding trajectory of the welded workpiece;
[0133] In this embodiment of the invention, the step of optimizing the curvature of sharp inflection points in the initial welding trajectory to obtain the target welding trajectory of the welded workpiece includes:
[0134] Calculate the curvature values of the trajectory points in the initial welding trajectory, and select the trajectory points with significant curvature changes as the sharp inflection points of the initial welding trajectory;
[0135] Select the set of optimized control points from the trajectory segments before and after the sharp inflection point;
[0136] Connect the optimized control points in the optimized control point set to obtain the optimized trajectory segment of the initial welding trajectory;
[0137] The target welding trajectory of the welded workpiece is obtained by replacing the original trajectory segment containing the sharp inflection point with the optimized trajectory segment.
[0138] The formula for calculating the curvature value is as follows: ;
[0139] In the formula, For the first welding trajectory in the initial welding trajectory The curvature value of each trajectory point For the first welding trajectory in the initial welding trajectory The trajectory points are at The amount of gray-level gradient change in the direction. For the first welding trajectory in the initial welding trajectory The trajectory points are at The amount of gray-level gradient change in the direction. and For the first welding trajectory in the initial welding trajectory Two-dimensional coordinates of a trajectory point and For the first welding trajectory in the initial welding trajectory Two-dimensional coordinates of a trajectory point and For the first welding trajectory in the initial welding trajectory Two-dimensional coordinates of a trajectory point To prevent tiny positive numbers with a denominator of zero.
[0140] The step of selecting the optimized control point set from the trajectory segments before and after the sharp inflection point includes:
[0141] A front-end control point is set on the trajectory segment at a preset distance in front of the sharp inflection point;
[0142] A rear control point is set on the trajectory segment at a preset distance behind the sharp inflection point;
[0143] Based on the curvature change trend at the sharp inflection point, an intermediate control point is set between the front control point and the rear control point;
[0144] By connecting the intermediate control points to form a polyline path and verifying the curvature continuity of the polyline path, an optimized control point set for the initial welding trajectory is obtained.
[0145] Calculate the curvature values of the trajectory points in the initial welding trajectory, and select trajectory points with significant curvature changes as sharp inflection points of the initial welding trajectory. It is necessary to examine each trajectory point on the initial welding trajectory one by one and observe the degree of curvature of the trajectory at each trajectory point. Specifically, this can be done by comparing the directions of the trajectory points before and after the trajectory point. If the degree of curvature at the trajectory point is significantly greater than that of the trajectory points before and after it, that is, the trajectory direction changes suddenly and significantly from the point before the trajectory point to the point after the trajectory point, then the curvature value of the trajectory point is considered to have a significant change in the degree of curvature, and such trajectory points are marked as sharp inflection points of the initial welding trajectory.
[0146] To select the optimal control point set from the trajectory segments before and after the sharp inflection point, it is necessary to first determine that the trajectory segment before the sharp inflection point is a continuous trajectory segment before the inflection point, and the trajectory segment after the inflection point is a continuous trajectory segment after the inflection point. The length of the two trajectory segments can be determined according to the complexity of the trajectory at the inflection point. For example, the trajectory segments containing five consecutive trajectory points before and after the inflection point can be selected. Then, from these trajectory segments before and after the inflection point, trajectory points that can reflect the overall direction of the trajectory are selected. When selecting, priority is given to points in the trajectory segments with relatively gentle curvature that can represent the extension trend of the trajectory segment. By grouping these selected points together, the optimal control point set is formed.
[0147] Connecting the optimized control points in the optimized control point set yields the optimized trajectory segment of the initial welding trajectory. Following the order of the optimized control points in the original trajectory segments, starting from the first point in the optimized control point set, each point is connected to the next in sequence. During connection, ensure a smooth transition between adjacent points, avoiding any new or obvious turning points. That is, ensure the direction of the previous connecting line segment naturally connects with the direction of the next connecting line segment. The continuous curve formed by this connection method is the optimized trajectory segment of the initial welding trajectory.
[0148] The target welding trajectory of the workpiece is obtained by replacing the original trajectory segment containing the sharp inflection point with the optimized trajectory segment. First, the original trajectory segment containing the sharp inflection point needs to be determined. This original trajectory segment includes the sharp inflection point and the trajectory segments adjacent to it, that is, the trajectory segment between the original trajectory point corresponding to the first point in the optimized control point set and the original trajectory point corresponding to the last point in the optimized control point set. Then, this part of the original trajectory segment is removed, and the optimized trajectory segment is placed in the same position, so that the starting point of the optimized trajectory segment is smoothly connected to the trajectory point at the starting point of the original trajectory segment, and the ending point of the optimized trajectory segment is smoothly connected to the trajectory point at the ending point of the original trajectory segment. After such replacement, the abrupt turning point caused by the sharp inflection point in the initial welding trajectory is eliminated, and the resulting continuous and smooth trajectory is the target welding trajectory of the workpiece.
[0149] The sources of the parameters in the formula are as follows, the first... The two-dimensional coordinates of the trajectory point, the first The two-dimensional coordinates of the trajectory point, the first The two-dimensional coordinates of each trajectory point are all derived from the position records of the corresponding trajectory points on the initial welding trajectory. These positions were determined and saved when the initial welding trajectory was generated. The trajectory points are at The change in grayscale gradient in the direction is determined by observing the image containing the initial welding trajectory. At each trajectory point along It is obtained by comparing the grayscale value difference between adjacent pixels in the direction, specifically by comparing the grayscale value changes of the pixels to the left and right of that point; the first The trajectory points are at The amount of gray-level gradient change in a direction is determined by observing the gray-level gradient change at that point along the same direction in the same image. It is obtained by comparing the grayscale value difference between adjacent pixels in the direction, that is, by comparing the grayscale value changes of the pixels above and below the point. The tiny positive number to prevent the denominator from being zero is an artificially set extremely small value, which is large enough to avoid the denominator being zero, and will not have a significant impact on the overall calculation result.
[0150] The meaning of the formula is to calculate the first... The curvature value of each trajectory point is used to quantify the degree of curvature of the trajectory at that point. Specifically, the formula combines the curvature value of the trajectory point at each point with the curvature value of the trajectory at that point. , The gray-scale gradient change in the direction, and the coordinate relationship between the trajectory point and two adjacent trajectory points, are calculated to obtain a value. The magnitude of this value reflects the curvature of the trajectory at the trajectory point. The larger the value, the more obvious the curvature of the trajectory at the trajectory point, thus enabling the determination of whether the point is a sharp inflection point.
[0151] A front-end control point is set on the trajectory segment at a preset distance in front of the sharp inflection point. The preset distance needs to be determined in combination with the requirements of the welding process for trajectory smoothness and the overall accuracy of the initial welding trajectory. For example, it can be set to 5 mm. Then, starting from the sharp inflection point, the trajectory length is measured segment by segment in the opposite direction of the extension of the initial welding trajectory using a trajectory length measuring tool. When the measured length reaches the preset distance, the measurement is stopped and the trajectory point corresponding to that position is marked. This marked trajectory point is the front-end control point. Throughout the process, it is necessary to ensure that the measurement direction strictly follows the trajectory direction to avoid deviation of the front-end control point position due to deviation from the trajectory.
[0152] A rear control point is set on the trajectory segment at a preset distance behind the sharp inflection point. The preset distance of the rear control point is consistent with that of the front control point to ensure the symmetry of the subsequent optimized trajectory. During operation, the sharp inflection point is used as the starting point, and the length is measured along the positive extension direction of the initial welding trajectory using the same trajectory length measuring tool as the one used to set the front control point. When the measured length reaches the preset distance, the trajectory point at that position is marked. This marked point is the rear control point. After marking, the distance between the rear control point and the sharp inflection point needs to be checked to ensure that it is completely consistent with the preset distance.
[0153] Based on the curvature change trend at the sharp inflection point, an intermediate control point is set between the front control point and the rear control point. First, observe the curvature change characteristics at the sharp inflection point to clarify the bending direction and degree of the trajectory before the inflection point, as well as the bending direction and degree of the trajectory after the inflection point, and determine the required transition trend between the two trajectories. Then, within the area formed by the line connecting the front control point and the rear control point, select a position located inside the curvature of the initial welding trajectory that can support the direction of the front and rear trajectories. This position must satisfy the requirement that the line connecting the front control point to this position and then to the rear control point can present a smooth transition shape. Mark this position as the intermediate control point.
[0154] Connect the intermediate control points to form a polyline path, and verify the curvature continuity of the polyline path to obtain the optimized control point set of the initial welding trajectory. Connect the three control points sequentially with straight lines to form a polyline path, following the order of front-end control point, intermediate control point, and rear-end control point. Then, starting from the front-end control point, observe the connection of adjacent line segments in the polyline path, and check whether there are abrupt turns in the direction of the line segment from the front-end control point to the intermediate control point and the line segment from the intermediate control point to the rear-end control point. If the directions of the two line segments can be connected naturally without obvious angle changes, it indicates that the curvature of the polyline path is continuous. At this time, the front-end control point, intermediate control point, and rear-end control point together form the optimized control point set of the initial welding trajectory.
[0155] The beneficial effects include: calculating the curvature values of trajectory points in the initial welding trajectory and screening out sharp inflection points, which can accurately locate the positions of abrupt bending changes in the trajectory, clarifying the target for subsequent optimization and ensuring the optimization is targeted; selecting the set of optimization control points for trajectory segments before and after sharp inflection points can obtain key points that reflect the natural direction of the trajectory, providing a reliable foundation for generating smooth optimized trajectory segments and ensuring that the optimization direction follows the trend of the original trajectory; connecting the optimization control points to obtain optimized trajectory segments can form continuous and abrupt transition curves, providing a suitable alternative path for replacing the original trajectory segments; replacing the original trajectory segment where the sharp inflection point is located with the optimized trajectory segment can completely eliminate the abrupt turns in the trajectory, making the final target welding trajectory smoother and more continuous, meeting the requirements of welding operation for trajectory smoothness, and improving welding accuracy and stability.
[0156] Setting a front control point at a predetermined distance before the sharp inflection point clearly defines the starting boundary of the optimization range, ensuring that the selected control point is located in a stable segment of the trajectory before the inflection point, providing a reliable starting point for subsequent optimization. Setting a rear control point at a predetermined distance after the sharp inflection point determines the ending boundary of the optimization range, and maintaining the same distance as the front control point ensures the symmetry of the optimization area, making the connection between the front and rear trajectories more balanced. Setting intermediate control points between the front and rear control points according to the curvature change trend at the sharp inflection point can accurately follow the direction of the front and rear trajectories, allowing the intermediate transition part to conform to the natural curvature trend of the trajectory and avoiding new turning points after optimization. Connecting the intermediate control points to form a polyline path and verifying its curvature continuity can ensure that the path formed by the set of optimized control points can achieve a smooth transition, providing a reliable control point foundation for generating continuous and smooth optimized trajectory segments, and improving the accuracy and effectiveness of trajectory optimization.
[0157] In this embodiment of the invention, S6, the target welding trajectory is encoded and encapsulated, and then transmitted to the robot control terminal.
[0158] All information about the target welding trajectory is extracted, including the two-dimensional coordinates of each trajectory point and the continuous path information formed by their sequential arrangement, recording them one by one to ensure no omissions. Next, according to the instruction format recognizable by the robot control terminal, the coordinates of each trajectory point are converted into a readable sequence of characters or symbols, and combined sequentially into continuous encoded information, enabling the terminal to reconstruct the path and sequence. The encoded information is then encapsulated, with a fixed start identifier added at the beginning to inform the terminal that it is receiving welding trajectory data, and verification information generated by integrating the characters or symbols in the encoding according to specific rules added at the end. Finally, the start identifier, encoded information, and verification information are combined to form a complete data packet.
[0159] To establish a communication connection with the robot control terminal, first check the physical lines, such as the Ethernet cable, to ensure a secure connection at both ends to the corresponding interfaces. Then, initiate communication between both ends, confirming the line is clear and the devices can exchange information normally by sending and receiving test signals. Once the test signals are successfully exchanged, the connection is established. Next, transmit the encapsulated data packet through the established link. Retrieve the data packet from the processing device and trigger a send command to propagate the data packet along the communication line, while simultaneously monitoring the transmission status in real time to ensure integrity and no loss. Finally, receive the reception confirmation information from the control terminal. This information includes a verification result. If the data is complete and error-free, the transmission is confirmed as successful; if not received or the result is incorrect, retransmit until successful.
[0160] The beneficial effects include: extracting all information of the target welding trajectory, ensuring the acquisition of complete trajectory point coordinates and their arrangement order, providing comprehensive and accurate raw data for subsequent encoding, and avoiding encoding errors due to missing information; encoding according to a format recognizable by the robot control terminal, converting trajectory information into instructions that the control terminal can interpret, ensuring that the control terminal can accurately understand the trajectory path and sequence; encapsulating the encoded information by adding start identifiers and verification information, clarifying the data type and verifying data integrity, preventing information confusion or loss during transmission; establishing a communication connection with the robot control terminal, ensuring smooth communication by checking lines and testing signals, providing a stable and reliable channel for trajectory data transmission; transmitting the encapsulated data packet to the control terminal, ensuring complete data transmission through real-time monitoring, enabling the control terminal to obtain trajectory information in a timely manner; and receiving the reception confirmation information from the control terminal, verifying the success and integrity of data transmission, ensuring that the control terminal can accurately use the target welding trajectory data, and providing a reliable basis for the robot to perform welding operations.
[0161] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0162] This application embodiment can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0163] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for automatically generating robot welding trajectories, characterized in that, The method includes: S1. Perform data cleaning on the image data of the welded workpiece to obtain the standard image data of the welded workpiece; S2. Downsample the standard image data to obtain a differentiated resolution image of the welded workpiece, and perform edge feature enhancement on the differentiated resolution image according to a pyramid structure to obtain an enhanced feature map of the welded workpiece, including: The standard image data is downsampled to obtain a differentiated resolution image of the welded workpiece; Based on the pyramid structure, image edges at different resolution levels in the differential resolution image are detected to obtain a multi-scale edge map of the welded workpiece; By enhancing the edge features of the multi-scale edge map, an edge-enhanced image of the welded workpiece is obtained. The edge enhancement images are fused to obtain an enhanced feature map of the welded workpiece; S3. Based on the grayscale distribution in the enhanced feature map, generate a region mask for the welded workpiece, and connect the region mask by shape boundaries to obtain the weld contour data of the welded workpiece, including: The enhanced feature map is segmented by grayscale thresholding to obtain a binary image of the candidate weld seam of the welded workpiece; Filter out connected candidate regions in the binary image of the candidate weld that conform to the geometric features of the workpiece to obtain the region mask of the welded workpiece; Boundary pixel point tracking is performed on the region mask to obtain the initial boundary point set of the welded workpiece; By sequentially connecting the boundary points in the initial boundary point set, the weld contour data of the welded workpiece is obtained; The step of performing grayscale thresholding on the enhanced feature map to obtain a candidate weld binary image of the welded workpiece includes: Extract the grayscale value set from the enhanced feature map; The preset grayscale threshold of the enhanced feature map is determined based on the distribution characteristics of the grayscale value set; Pixels in the enhanced feature map whose grayscale value is greater than the preset grayscale threshold are classified as foreground regions; Pixels in the enhanced feature map whose grayscale value is less than or equal to the preset grayscale threshold are classified as background regions; Based on the background difference between the foreground region and the background region, a binary image of the candidate weld of the welded workpiece is constructed; S4. Obtain the welding trajectory sampling points of the contour geometric boundary in the weld contour data, and connect the welding trajectory sampling points according to the weld shape characteristics to obtain the initial welding trajectory of the welded workpiece. S5. Optimize the curvature of sharp inflection points in the initial welding trajectory to obtain the target welding trajectory of the workpiece, including: Calculate the curvature values of the trajectory points in the initial welding trajectory, and select the trajectory points with significant curvature changes as the sharp inflection points of the initial welding trajectory; Select the set of optimized control points from the trajectory segments before and after the sharp inflection point; Connect the optimized control points in the optimized control point set to obtain the optimized trajectory segment of the initial welding trajectory; The original trajectory segment containing the sharp inflection point is replaced with the optimized trajectory segment to obtain the target welding trajectory of the welded workpiece. S6. Encode and encapsulate the target welding trajectory and transmit it to the robot control terminal.
2. The automatic generation method for robot welding trajectory as described in claim 1, characterized in that, The process of cleaning the image data of the welded workpiece to obtain standard image data of the welded workpiece includes: Noise is removed from the image data to obtain the preprocessed image data of the welded workpiece; Adjust the contrast of the preprocessed image data to obtain high-contrast image data of the welded workpiece; The welding area in the high-contrast image data is cropped to obtain the equalized image data of the welded workpiece; The equalized image data is corrected by affine transformation to obtain the standard image data of the welded workpiece.
3. The automatic generation method for robot welding trajectory as described in claim 1, characterized in that, The step of obtaining welding trajectory sampling points of the geometric boundary of the weld contour data, and connecting the welding trajectory sampling points according to the weld shape characteristics to obtain the initial welding trajectory of the welded workpiece includes: Mark the contour boundary points in the weld contour data to obtain a candidate sampling point set for the weld contour data; Remove redundant points from the candidate sampling point set to obtain the target sampling points of the candidate sampling point set; Based on the geometric continuity of the weld contour data, the target sampling points are arranged in an orderly manner to obtain the sampling point sequence of the weld contour data; The sampling points are connected sequentially according to the sampling point sequence and used as the initial welding path for the workpiece. The initial welding path is smoothed by interpolation to obtain the initial welding trajectory of the workpiece.
4. The method for automatically generating robot welding trajectories as described in claim 3, characterized in that, The step of smoothing and interpolating the preliminary welding path to obtain the initial welding trajectory of the workpiece includes: The initial welding path is divided into straight line segments; Intermediate interpolation points are inserted between the start and end path segments of the straight path segment; Adjust the spatial position of the intermediate interpolation points to obtain a smooth transition curve between adjacent straight segments of the path; Connect all sampling points with the adjusted intermediate interpolation points to generate the initial welding trajectory of the welded workpiece.
5. The method for automatically generating robot welding trajectories as described in claim 1, characterized in that, The formula for calculating the curvature value is as follows: ; In the formula, For the first welding trajectory in the initial welding trajectory The curvature value of each trajectory point For the first welding trajectory in the initial welding trajectory The trajectory points are at The amount of gray-level gradient change in the direction. For the first welding trajectory in the initial welding trajectory The trajectory points are at The amount of gray-level gradient change in the direction. and For the first welding trajectory in the initial welding trajectory Two-dimensional coordinates of a trajectory point and For the first welding trajectory in the initial welding trajectory Two-dimensional coordinates of a trajectory point and For the first welding trajectory in the initial welding trajectory Two-dimensional coordinates of a trajectory point To prevent tiny positive numbers with a denominator of zero.
6. The method for automatically generating robot welding trajectories as described in claim 1, characterized in that, The step of selecting the optimized control point set from the trajectory segments before and after the sharp inflection point includes: A front-end control point is set on the trajectory segment at a preset distance in front of the sharp inflection point; A rear control point is set on the trajectory segment at a preset distance behind the sharp inflection point; Based on the curvature change trend at the sharp inflection point, an intermediate control point is set between the front control point and the rear control point; By connecting the intermediate control points to form a polyline path and verifying the curvature continuity of the polyline path, an optimized control point set for the initial welding trajectory is obtained.