A caterpillar beam weld seam track fitting method based on an improved RANSAC algorithm

By improving the RANSAC algorithm and combining 3D scanning point cloud processing and trajectory connection graph structure optimization, the misjudgment problem in track beam weld trajectory fitting was solved, achieving high-precision weld trajectory recognition and automatic welding path planning.

CN122115491APending Publication Date: 2026-05-29HANGZHOU SANTECH MACHINERY MFG CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HANGZHOU SANTECH MACHINERY MFG CO LTD
Filing Date
2026-04-29
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

During the manufacturing process of track beams for tracked engineering equipment, due to local shrinkage deformation, weld bead adhesion, and spatter accumulation in the weld area, the traditional RANSAC trajectory fitting method is prone to misjudging weld bead or spatter points as points within the model, resulting in local jumps or misfitting of the weld trajectory, which affects the accuracy of welding path planning and quality inspection.

Method used

By performing structural orientation alignment, local height gradient analysis, and normal change rate screening on the 3D scanned point cloud, a multi-scale point set structure combining global and local scale point sets is constructed. The RANSAC algorithm is used to fit the overall trend model of the weld on the global scale point set, and random consistency sampling is performed locally using this as a constraint to generate a local trajectory model. The trajectory connection graph structure and dynamic programming optimization method are used for screening and splicing to generate a continuous weld center trajectory curve.

Benefits of technology

To obtain high-precision weld trajectories stably in complex weld environments, improve the stability of weld feature recognition and the accuracy of trajectory fitting, and ensure the reliability of welding path planning and quality inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122115491A_ABST
    Figure CN122115491A_ABST
Patent Text Reader

Abstract

The application discloses a caterpillar beam weld seam track fitting method based on an improved RANSAC algorithm and particularly relates to the technical field of weld seam track identification and automatic welding path planning. Standardized point cloud data is acquired. Welding spatter points are removed by combining the normal change rate of points with the extraction of weld protruding feature points through local height gradient analysis, a multi-scale point set structure of an overall scale point set and a local scale point set is constructed, a random consistency sampling is performed on the overall scale point set to fit a weld overall trend model, and a local track model set is generated on the local scale point set with the inner point set as a constraint. A track connection graph structure is constructed according to the local curvature change value and the direction continuity score, the screening and splicing of the local track model are completed, and a weld compensation track model is obtained. The compensation track model is subjected to continuous curve fitting to generate a weld center track curve. The application can realize high-precision weld seam track fitting in the presence of welding spatter and local deformation interference.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of weld trajectory recognition and automatic welding path planning technology, specifically to a method for fitting the weld trajectory of a track beam based on an improved RANSAC algorithm. Background Technology

[0002] In the manufacturing process of track beams for tracked engineering equipment, long, continuous welds are typically formed between the side plates and reinforcing plates of the track beam. These welds serve as both the main load-bearing connection structure and an important reference trajectory for automated welding or post-weld inspection. In actual production, due to the large thickness of the track beam structure and the high heat input during welding, local shrinkage deformation, weld bead adhesion, and spatter accumulation often occur in the weld area, resulting in a small number of structural outliers in the weld point cloud obtained from 3D scanning. Especially in the reinforcing area at the end of the track beam, uneven release of welding thermal stress causes slight bending or local waveform shifts in the weld. Traditional RANSAC trajectory fitting methods are prone to misclassifying weld beads or spatter points as in-model points during random sampling, leading to local jumps or misfitting of the weld trajectory. This affects the accuracy of welding path planning and quality inspection. Therefore, a fitting method capable of stably extracting the weld trajectory under complex weld surface interference conditions is needed. Summary of the Invention

[0003] The purpose of this invention is to provide a method for fitting the weld seam trajectory of track beams based on an improved RANSAC algorithm, so as to overcome the shortcomings in the prior art.

[0004] To achieve the above objectives, the present invention provides the following technical solution: a method for fitting the weld seam trajectory of a track beam based on an improved RANSAC algorithm, comprising:

[0005] Acquire the three-dimensional scanning point cloud data P of the track beam weld area, and perform coordinate system alignment processing on P according to the track beam structural direction to obtain a standardized point cloud set P0;

[0006] Local height gradient analysis is performed on P0 to extract weld protrusion feature points, construct a set of weld candidate points, and eliminate welding spatter points according to the normal change rate of the points to obtain the weld feature point set F1.

[0007] Based on the characteristic that the track beam welds are continuously distributed along the length of the structure, F1 is serialized into segments to construct a multi-scale point set structure, including the global scale point set FL and the local scale point set FS.

[0008] Perform RANSAC random sampling on the global scale point set FL, fit the overall trend model ML of the weld, and select the set of interior points IL that meet the global residual threshold.

[0009] Using IL as a constraint, perform several local RANSAC fittings on the local scale point set FS to generate a local trajectory model set MS, and calculate the local curvature change value and directional continuity score.

[0010] MS are screened and spliced ​​based on local curvature change values ​​and directional continuity scores to form weld seam compensation trajectory model MC;

[0011] Perform continuous curve fitting on MC to generate the center trajectory curve of the track beam weld and output the weld trajectory fitting result.

[0012] Preferably, the step of screening and splicing MS based on local curvature change values ​​and directional continuity scores to form a weld compensation trajectory model MC includes the following steps:

[0013] The trajectory connection graph structure is constructed according to the sequence numbering order of the local trajectory model set MS in the global scale point set FL. Each local trajectory model is used as a graph node, and connection edges are established based on the local curvature change value and directional continuity score between adjacent models. At the same time, the corresponding trajectory connection cost is calculated.

[0014] Starting with the local trajectory model with the smallest sequence number and ending with the local trajectory model with the largest sequence number, the shortest path search algorithm is used to calculate the path with the minimum cumulative cost in the trajectory connection graph structure to obtain the candidate trajectory model sequence.

[0015] A dynamic programming optimization function is constructed based on the candidate trajectory model sequence to calculate the continuity constraint of the connection relationship between adjacent local trajectory models and update the cumulative cost value.

[0016] Based on the dynamic programming optimization results, the sequence of local trajectory models with the best continuity is selected, and the local trajectory models are sequentially spliced ​​together to form the weld compensation trajectory model MC.

[0017] Preferably, obtaining the standardized point cloud set P0 includes the following steps: performing voxel mesh downsampling processing on the three-dimensional scanned point cloud data P to remove redundant points and maintain the geometric features of the weld area, resulting in a preprocessed point cloud set P1; performing principal direction analysis on the preprocessed point cloud set P1, determining the principal axis direction vector V of the track beam structure by calculating the point cloud covariance matrix and extracting the eigenvector corresponding to the largest eigenvalue; constructing a structural reference coordinate system based on the principal axis direction vector V, and calculating the rotation transformation matrix between the preprocessed point cloud set P1 and the structural reference coordinate system; and performing coordinate transformation on the preprocessed point cloud set P1 according to the rotation transformation matrix to obtain the standardized point cloud set P0.

[0018] Preferably, local height gradient analysis is performed on P0 to extract weld protrusion feature points and construct a set of weld candidate points, including the following steps:

[0019] Establish a neighborhood with a fixed radius centered on each point in the standardized point cloud set P0, calculate the height difference of each point in the neighborhood in the vertical direction, and construct the local height gradient value based on the height difference to obtain the height gradient point set G;

[0020] A gradient threshold is set based on the gradient magnitude in the set of height gradient points G. Points with gradient values ​​greater than the gradient threshold are filtered to extract candidate points for the weld protrusion region, forming a set of weld candidate points F.

[0021] Preferably, the weld feature point set F1 is obtained by eliminating welding spatter points based on the normal change rate of the points, which includes: establishing a neighborhood plane for each point in the weld candidate point set F, calculating the normal direction of each point by least squares plane fitting, and obtaining the corresponding normal change rate; setting a normal change rate threshold based on the normal change rate of each point, and identifying points with a normal change rate greater than the normal change rate threshold as welding spatter points and eliminating them, thereby obtaining the weld feature point set F1.

[0022] Preferably, the step of serializing and segmenting F1 to construct a multi-scale point set structure includes the following steps:

[0023] Based on the main axis direction of the track beam structure in the standardized point cloud set P0, each point in the weld feature point set F1 is projected along the main axis direction, and the weld feature point set F1 is sorted according to the projected coordinate values ​​to form an ordered point sequence arranged in the direction of structural length.

[0024] The ordered point sequence is divided into sliding segments according to fixed-length windows. Each window contains a preset number of weld feature points. A continuous set of segmented points is constructed by the overlapping relationship between adjacent windows.

[0025] The entire ordered point sequence is taken as the global scale point set, and the continuous segmented point sets corresponding to each sliding window are taken as local scale point sets, thus forming a multi-scale point set structure that includes the global scale point set and multiple local scale point sets.

[0026] Preferably, the step of performing RANSAC random sampling on the global scale point set FL and fitting the overall trend model ML of the weld seam includes the following steps:

[0027] In the overall scale point set FL, equally spaced sampling intervals are established according to the sequence number. A preset number of weld feature points are randomly selected as initial sampling points in different sampling intervals. The overall trend model ML of the weld is calculated using the least squares linear fitting method based on the initial sampling points, and the direction parameters and spatial position parameters of the overall trend model ML are obtained. The spatial distance residual from each point in the overall scale point set FL to the overall trend model ML of the weld is calculated, and each point is judged according to the preset global residual threshold. Weld feature points whose spatial distance residual is less than or equal to the global residual threshold are included in the inner point set IL, and the sequence position of the inner point set IL in the overall scale point set FL is recorded.

[0028] Preferably, the step of performing several local RANSAC fittings on the local scale point set FS with IL as a constraint includes the following steps:

[0029] Based on the sequence number range of the interior point set IL in the global scale point set FL, the local scale point set FS within the corresponding number interval is extracted as the effective local point set;

[0030] Random consistency sampling is performed on the effective local point set. An initial local model is constructed by randomly selecting a preset number of weld feature points, and the local trajectory model parameters are calculated using the least squares method.

[0031] Calculate the spatial distance residuals from each point in the effective local point set to the local trajectory model, and filter the local inliers that meet the conditions based on the preset local residual threshold.

[0032] The random consistency sampling process is repeated a preset number of times, and the local trajectory model that meets the local residual threshold and has the largest number of local inliers is recorded to form a local trajectory model set MS.

[0033] Preferably, the calculation of local curvature change value and directional continuity score includes the following steps: sorting the local trajectory model set MS according to the sequence number order of the local trajectory models in the global scale point set FL, and extracting the direction vectors of two adjacent local trajectory models; calculating the included angle value based on the direction vectors of two adjacent local trajectory models, and using the included angle value as the local curvature change value; constructing a directional continuity evaluation function based on the local curvature change value, and scoring the continuity of each local trajectory model, wherein the continuity score is calculated by the included angle of direction of adjacent local trajectory models and the number of corresponding local inliers.

[0034] Preferably, the step of performing continuous curve fitting on MC to generate the center trajectory curve of the track beam weld includes the following steps:

[0035] The coordinates of each trajectory node are extracted according to the sequence number of the weld compensation trajectory model MC in the global scale point set FL, and the spatial distance between adjacent trajectory nodes is uniformly resampled to obtain an equally spaced trajectory point sequence.

[0036] A cubic spline curve fitting model is constructed based on the equidistant trajectory point sequence. The control coefficients of the spline function are calculated by the least squares solution method to obtain the initial continuous curve model.

[0037] The curvature distribution of the initial continuous curve model is calculated, and the local curvature abrupt change segments are iteratively smoothed and adjusted according to the preset curvature smoothing threshold to obtain the optimized continuous curve model.

[0038] The optimized continuous curve model is used as the center trajectory curve of the track beam weld, and the spatial coordinate sequence of the center trajectory curve of the track beam weld is output as the weld trajectory fitting result.

[0039] The technical effects and advantages provided by the present invention in the above technical solution are as follows:

[0040] 1. This invention achieves stable extraction of weld protrusion feature points by aligning the structural orientation, analyzing local height gradients, and filtering the normal change rate on a 3D scanned point cloud. Based on this, a multi-scale point set structure combining global and local scale point sets is constructed, enabling the simultaneous and effective representation of both the overall weld trend and local geometric features. By establishing a global trend model of the weld on the global scale point set and using the set of interior points obtained from this trend model as constraints to perform local random consistency sampling fitting, the generation process of the local trajectory model is constrained by the global trend. This effectively avoids interference from welding spatter, weld beads, and local noise points on trajectory fitting, improving the stability of weld feature recognition and the accuracy of trajectory fitting.

[0041] 2. This invention constructs a trajectory connection graph structure, unifying local curvature change values ​​and directional continuity scores into trajectory connection costs. It then combines a shortest path search algorithm and dynamic programming optimization methods to filter and stitch together the local trajectory model set, ensuring optimal continuity of the weld trajectory at the overall scale. Subsequently, cubic spline curve fitting and curvature smoothing are used to generate a continuous weld center trajectory curve. This ensures that the obtained trajectory not only maintains spatial continuity but also compensates for local bending caused by welding thermal deformation. Therefore, this invention can stably obtain high-precision weld trajectories in complex weld environments with welding spatter, local deformation, and point cloud noise, providing a reliable trajectory data foundation for automatic welding path planning and weld quality inspection of track beams. Attached Figure Description

[0042] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.

[0043] Figure 1 This is a flowchart of a method for fitting the weld seam trajectory of a track beam based on an improved RANSAC algorithm according to the present invention.

[0044] Figure 2 This is a flowchart of the method for forming the weld seam compensation trajectory model of the present invention. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0046] For examples, please refer to Figure 1 , 2 As shown in this embodiment, a method for fitting the weld seam trajectory of a track beam based on an improved RANSAC algorithm includes:

[0047] The three-dimensional scanning point cloud data P of the track beam weld area is obtained, and P is aligned with the coordinate system according to the track beam structure direction to obtain a standardized point cloud set P0.

[0048] In this embodiment, three-dimensional scanning point cloud data P of the track beam weld area is first acquired. The three-dimensional scanning point cloud data P is a set of spatial points obtained by scanning the track beam weld area using a structured light scanning device or a laser scanning device. Each point contains three-dimensional coordinate information (x, y, z). To reduce the redundancy of the point cloud data and maintain the geometric contour of the weld area, voxel mesh downsampling processing is performed on the three-dimensional scanning point cloud data P. Specifically, a cubic voxel mesh with a side length of d is constructed in three-dimensional space, where the voxel side length d is a preset value between 1 mm and 3 mm; each point in the three-dimensional scanning point cloud data P is assigned to its corresponding voxel according to its spatial coordinates; the average three-dimensional coordinates of all points within the same voxel are calculated, and this average value is used as a new representative point; all voxel representative points constitute a preprocessed point cloud set P1, thereby reducing the point cloud density while maintaining the weld shape characteristics.

[0049] Principal direction analysis is performed on the preprocessed point cloud set P1 to determine the principal axis direction vector V of the track beam structure. The specific method is as follows: First, the geometric center point C of all points in the preprocessed point cloud set P1 is calculated, and its coordinates are the average of all point coordinates. Then, a point cloud covariance matrix is ​​constructed, which is calculated from the coordinate deviation of each point relative to the geometric center point C. Eigenvalue decomposition is performed on the covariance matrix to obtain three eigenvalues ​​and their corresponding eigenvectors. The eigenvector corresponding to the largest eigenvalue is determined as the principal axis direction vector V of the track beam structure.

[0050] It should be noted that since the track beam welds are continuously distributed along the length of the track beam, the direction corresponding to the maximum characteristic value can reflect the overall extension direction of the track beam structure.

[0051] A structural reference coordinate system is constructed based on the principal axis direction vector V, and the rotation transformation matrix between the preprocessed point cloud set P1 and the structural reference coordinate system is calculated. Specifically, the principal axis direction vector V is first set as the first coordinate axis direction of the structural reference coordinate system; then, the second coordinate axis direction, perpendicular to the principal axis direction vector V, is calculated using vector orthogonality; subsequently, the third coordinate axis direction is determined through cross product, making the three coordinate axes pairwise orthogonal and forming a right-handed coordinate system; these three coordinate axis direction vectors are combined to form a direction matrix; and the rotation transformation matrix R is calculated based on the relationship between this direction matrix and the original coordinate system. The rotation transformation matrix R describes the rotation relationship between the preprocessed point cloud set P1 and the original coordinate system and the structural reference coordinate system.

[0052] The coordinate transformation is performed on each point in the preprocessed point cloud set P1 according to the rotation transformation matrix R. Specifically, the 3D coordinates of each point in the preprocessed point cloud set P1 are represented as column vectors and multiplied with the rotation transformation matrix R to obtain new 3D coordinates. In the transformed point cloud, the principal axis direction of the track beam structure is consistent with the preset coordinate axis direction, thus completing the spatial orientation unification processing of the 3D scanned point cloud data. All transformed points constitute a standardized point cloud set P0. Through the above processing, the subsequent weld feature extraction and trajectory fitting processes can be performed under a unified spatial reference direction, improving the stability and computational efficiency of trajectory fitting.

[0053] Local height gradient analysis is performed on P0 to extract weld protrusion feature points, construct a set of weld candidate points, and eliminate welding spatter points according to the normal change rate of the points to obtain the weld feature point set F1.

[0054] In this embodiment, local height gradient calculation is performed on the standardized point cloud set P0. Each point in the standardized point cloud set P0 contains three-dimensional coordinates (x, y, z), where the z-direction is the height direction that is basically consistent with the normal direction of the track beam surface. A neighborhood search region is constructed using each point in the standardized point cloud set P0 as the center point, and the neighborhood search radius is set to r, which is a fixed value between 2 mm and 5 mm. All neighborhood points whose distance to the center point is less than the neighborhood search radius r are determined by spatial distance calculation method. For each center point, the maximum height value zmax and the minimum height value zmin of the neighborhood points are calculated, and the height difference Δz = zmax - zmin is calculated. The height difference Δz is used as the local height gradient value of the center point, and the local height gradient values ​​corresponding to all points are combined to form the height gradient point set G. Since the weld area has a significant protrusion relative to the surface of the track beam base material, the local height gradient value of the weld area is significantly greater than that of the surrounding planar area.

[0055] Weld protrusion region points are selected based on the gradient values ​​in the height gradient point set G. First, a statistical analysis is performed on all local height gradient values ​​in the height gradient point set G, calculating the average value μg and standard deviation σg. The height gradient threshold Tg is defined as Tg = μg + 1.5 × σg. For each point in the standardized point cloud set P0, if its corresponding local height gradient value is greater than the height gradient threshold Tg, the point is identified as a weld protrusion region point; if its local height gradient value is less than or equal to the height gradient threshold Tg, the point is considered to belong to the planar region of the track beam base material and is discarded. All points satisfying the condition that their local height gradient value is greater than the height gradient threshold Tg constitute the weld candidate point set F. Through the above selection process, the main weld region can be retained while most planar region points are eliminated.

[0056] Calculate the normal direction and rate of change of normal for each point in the weld candidate point set F. For each point in the weld candidate point set F, re-establish the neighborhood search region, using the same neighborhood search radius r. For all points within the neighborhood, use the least squares plane fitting method to obtain the local fitting plane. Specifically, first, calculate the geometric center point of the neighborhood points; then, construct the covariance matrix of the neighborhood points relative to the geometric center point; perform eigenvalue decomposition on the covariance matrix, and select the eigenvector corresponding to the smallest eigenvalue as the local normal direction vector of that point. After calculating the normal direction for all weld candidate points, calculate the angle between the normal direction vector of each weld candidate point and the normal direction vectors of other points in the neighborhood, and calculate the average angle. The average angle is defined as the rate of change of normal for that point, reflecting the stability of the surface geometry at that point.

[0057] Weld spatter points are eliminated based on the rate of change of the normal direction. First, the rate of change of the normal direction of all points in the candidate weld point set F is statistically calculated to obtain the average rate of change of the normal direction μn and the standard deviation of the rate of change of the normal direction σn. The threshold of the rate of change of the normal direction Tn is defined as Tn = μn + 2 × σn.

[0058] For each point in the weld candidate point set F, if its normal change rate is greater than the normal change rate threshold Tn, then the point is considered to have an abrupt geometric structure. Such points usually originate from welding spatter particles or weld bead attachment points, and are therefore identified as welding spatter points and removed from the weld candidate point set F. If its normal change rate is less than or equal to the normal change rate threshold Tn, then the point is retained. All the remaining points after the above screening process constitute the weld feature point set F1.

[0059] It should be noted that this process can effectively eliminate welding spatter while preserving the main structural features of the weld, providing a stable feature point basis for subsequent weld trajectory fitting.

[0060] Based on the characteristic that the weld seams of the track beam are continuously distributed along the length of the structure, F1 is serialized into segments to construct a multi-scale point set structure, including the global scale point set FL and the local scale point set FS.

[0061] In this embodiment, the weld feature point set F1 is projected and sorted according to the principal axis direction of the track beam structure determined in the standardized point cloud set P0. The principal axis direction of the track beam structure is the direction vector obtained by eigenvalue decomposition of the covariance matrix in the aforementioned steps. This direction vector is denoted as V, and its direction components are (Vx, Vy, Vz). For each point Pi in the weld feature point set F1, its spatial coordinates are represented as (xi, yi, zi). First, the projected coordinates si of point Pi on the principal axis direction vector V are calculated. The projected coordinates are obtained by vector dot product: si = xi·Vx + yi·Vy + zi·Vz.

[0062] After completing the projection calculations for all weld feature points, a one-to-one correspondence is established between all projected coordinates si and their corresponding points Pi. Then, the weld feature point set F1 is sorted according to the projected coordinates si in ascending order, resulting in an ordered sequence of points arranged along the length of the track beam structure. This ordered sequence maintains the spatial continuity of the weld feature points along the structural length, providing a foundation for subsequent segmentation processing.

[0063] A sliding window segmentation process is performed on the ordered point sequence to construct a continuous set of segmented points. First, a window length parameter Lw is set, representing the number of weld feature points contained in each window. Lw is a fixed integer value between 20 and 40. Then, a window movement step size parameter Ls is set, which is half the window length parameter Lw. Starting from the first point in the ordered point sequence, Lw consecutive weld feature points are selected to form the first segmented point set. Subsequently, the window is moved backward according to the window movement step size Ls, and another Lw consecutive weld feature points are selected to form the second segmented point set. This process continues until the entire ordered point sequence has been traversed. Because the window movement step size Ls is less than the window length parameter Lw, there are overlapping points between adjacent segmented point sets, thus maintaining continuous coverage of weld feature points along the structural length.

[0064] A multi-scale point set structure is constructed based on the sliding window segmentation results. First, the complete ordered point sequence is defined as the global scale point set FL, which contains all points from the weld feature point set F1 and describes the overall geometric trend of the weld along the track beam length. Then, each continuous segmented point set is defined as a local scale point set FS. Each local scale point set FS contains a fixed number of weld feature points and corresponds to a local segment along the weld length. By combining the global scale point set FL with multiple local scale point sets FS, a multi-scale point set structure is formed, where the global scale point set FL describes the overall weld morphology, and the local scale point sets FS describe the local geometric changes of the weld.

[0065] To ensure that the subsequent trajectory fitting process can establish correspondences between different scales, it is necessary to record the position index of the local scale point set FS in the global scale point set FL. Specifically, when constructing the ordered point sequence, a unique sequence number k is assigned to each weld feature point in the sequence, with the sequence number k incrementing from 1 according to the sorted order. When a local scale point set FS is formed, the sequence number range (kstart, kend) corresponding to all points in the local scale point set FS is recorded, where kstart represents the sequence number of the first point in the local scale point set FS in the global scale point set FL, and kend represents the sequence number of the last point in the local scale point set FS in the global scale point set FL. By recording the sequence number range (kstart, kend), the specific position of the local scale point set FS in the global scale point set FL can be clearly defined, thereby realizing the scale correlation constraint between the global scale point set FL and the local scale point set FS in the subsequent trajectory model fitting process.

[0066] Perform RANSAC random sampling on the global scale point set FL, fit the overall trend model ML of the weld, and select the set of interior points IL that meet the global residual threshold.

[0067] In this embodiment, a partitioned random sampling basis is established on the overall scale point set FL. Each weld feature point in the overall scale point set FL has a unique sequence number k, which is arranged in ascending order along the weld length. First, the number of sampling intervals Ns is set, taking an integer value between 5 and 10. Based on the total number of points N in the overall scale point set FL, the sequence number interval [1, N] is divided into Ns consecutive intervals according to the number of sampling intervals Ns, with each interval containing approximately N / Ns weld feature points. Then, a weld feature point is selected as a sampling point in each sampling interval through uniform random selection, thereby obtaining a set of initial sampling points. By restricting the sampling points to different sampling intervals, it can be ensured that the initial sampling points are evenly distributed along the weld length of the track beam, avoiding the concentration of random sampling points in local areas and causing a deviation in the overall trend fitting.

[0068] The overall trend model ML of the weld seam is calculated based on the initial set of sampling points. The overall trend model ML is described using a three-dimensional linear model. Let the initial set of sampling points contain m points, each with spatial coordinates represented as (xi, yi, zi). First, the geometric center point C of the initial set of sampling points is calculated, its coordinates being the average of the coordinates of all sampling points. Then, the covariance matrix of the sampling points relative to the geometric center point C is constructed. Eigenvalue decomposition is performed on the covariance matrix, and the eigenvector corresponding to the largest eigenvalue is selected as the direction vector D of the overall trend model ML. Using the geometric center point C as the point through which the line passes, and the direction vector D as the direction of the line, the overall trend model ML is constructed. This model can reflect the spatial extension trend of the track beam weld seam on an overall scale.

[0069] Calculate the spatial distance residuals from each point in the global scale point set FL to the overall weld trend model ML. Let any point in the global scale point set FL be Pi, with spatial coordinates (xi, yi, zi). The overall weld trend model ML is determined by point C and direction vector D. First, calculate vector CPi, which is the vector between point Pi and the geometric center point C. Then, calculate the cross product of vector CPi and direction vector D, and obtain the magnitude of this cross product vector. Dividing this magnitude by the magnitude of direction vector D yields the shortest spatial distance di from point Pi to the overall weld trend model ML. This distance di is defined as the spatial distance residual, used to measure the degree to which point Pi deviates from the overall weld trend model ML.

[0070] The set of weld in-points IL is selected based on spatial distance residuals. First, the spatial distance residuals of all points in the global-scale point set FL are statistically calculated to obtain the average residual μd and the standard deviation σd. The global residual threshold Td is defined as Td = μd + 1.2 × σd. For each point in the global-scale point set FL, if its spatial distance residual di is less than or equal to the global residual threshold Td, the point is considered to conform to the overall weld trend model ML and is included in the in-point set IL; if its spatial distance residual di is greater than the global residual threshold Td, the point is considered to deviate from the overall weld trend model ML and is excluded. After determining all points, all weld feature points that meet the conditions are combined into the in-point set IL. This in-point set IL represents the main weld points consistent with the overall weld trend model ML and provides stable basic data for subsequent local-scale trajectory fitting.

[0071] Using IL as a constraint, perform several local RANSAC fittings on the local scale point set FS to generate a local trajectory model set MS, and calculate the local curvature change value and directional continuity score.

[0072] The effective local point set is determined by using the interior point set IL as a constraint. Each point in the interior point set IL corresponds to a unique sequence number k in the global scale point set FL. First, the minimum sequence number kmin and the maximum sequence number kma in the interior point set IL are counted. Then, all weld feature points with sequence numbers within the interval [kmin, kma] are retrieved in the local scale point set FS, and these points are combined to form the effective local point set. This processing method ensures that local trajectory fitting is performed only within the region consistent with the overall trend model, thereby avoiding interference from local outliers. Random consistency sampling is performed on the effective local point set to construct the local trajectory model. First, the number of sampling points parameter m is set, and m is set to 3. Each random consistency sampling randomly selects m weld feature points from the effective local point set as the sampling point set. Let the coordinates of the sampling points be (x1, y1, z1), (x2, y2, z2), and (x3, y3, z3). First, the geometric center point Clocal of the three sampling points is calculated. Subsequently, the covariance matrix of the sampling points relative to the geometric center point Clocal is constructed, and eigenvalue decomposition is performed on this covariance matrix. The eigenvector corresponding to the largest eigenvalue is determined as the direction vector Dlocal of the local trajectory model. Using the geometric center point Clocal as the point through which the line passes and the direction vector Dlocal as the direction, a local trajectory model is constructed.

[0073] Calculate the spatial distance residuals from each point in the effective local point set to the local trajectory model. Let Pi be any point in the effective local point set, with coordinates (xi, yi, zi). The local trajectory model is determined by the point Clocal and the direction vector Dlocal. First, calculate the vector ClocalPi. Then, calculate the cross product of ClocalPi and the direction vector Dlocal, and obtain the magnitude of the cross product. Divide this magnitude by the magnitude of the direction vector Dlocal to obtain the shortest spatial distance ri from point Pi to the local trajectory model. Use the spatial distance residual ri as the local residual. Then, calculate the average value μr and standard deviation σr of all residual values, and define the local residual threshold Tr as Tr = μr + 1.3 × σr. If the spatial distance residual ri of a point is less than or equal to the local residual threshold Tr, then the point is determined to be a local inlier.

[0074] The random consistency sampling process is repeatedly executed to generate a set of local trajectory models. First, a random consistency sampling number parameter Nr is set, which is an integer between 50 and 100. For each sampling, a local trajectory model and its number of local inliers are calculated. The number of local inliers obtained in each sampling is recorded. The local trajectory model with the largest number of local inliers is saved as the valid local trajectory model. All valid local trajectory models are recorded according to their corresponding sequence number ranges, thus forming the local trajectory model set MS.

[0075] Sort the local trajectory model set MS and extract its direction vectors. Each local trajectory model in MS corresponds to a sequence number interval (kstart, kend) in the global scale point set FL. First, sort the local trajectory model set MS in ascending order according to the starting number kstart of the sequence number interval. After sorting, read the direction vector Dlocal of each local trajectory model in turn. Let the direction vectors of two adjacent local trajectory models be Di and D{i+1}, respectively.

[0076] Calculate the local curvature change value. Let two adjacent direction vectors be Di=(dxi,dyi,dzi) and D{i+1}=(dx{i+1},dy{i+1},dz{i+1}). First, calculate the dot product of the two direction vectors: Di·D{i+1}=dxi·dx{i+1}+dyi·dy{i+1}+dzi·dz{i+1}; then calculate the magnitudes of the two direction vectors and use the inverse cosine function to calculate the included angle θi: θi=arccos((Di·D{i+1}) / (|Di|×|D{i+1}|)); the included angle θi is defined as the local curvature change value. The larger the included angle, the greater the curvature of the weld trajectory in that section.

[0077] A directional continuity evaluation function is constructed to calculate the continuity score. Let Ni be the number of local inliers corresponding to the i-th local trajectory model. First, calculate the maximum number of inliers Nmax for all local trajectory models. Then, construct the directional continuity score function Si: Si = (1 - θi / π) × (Ni / Nmax); where θi is the local curvature change value. The score function Si ranges from 0 to 1. When the included angle θi is small and the number of local inliers Ni is large, the score value Si is close to 1, indicating good trajectory continuity.

[0078] Local trajectory models are selected based on directional continuity scores. First, the average continuity score μs is calculated. The continuity score threshold Ts is defined as Ts = 0.8 × μs. For each model in the local trajectory model set MS, if its continuity score Si is greater than or equal to the continuity score threshold Ts, the local trajectory model is retained, and its corresponding sequence number interval (kstart, kend) is recorded. If the continuity score Si is less than the continuity score threshold Ts, the local trajectory model is removed from the set. After selection, a set of local trajectory models satisfying directional continuity is obtained, which is used for subsequent weld trajectory splicing and continuous curve fitting.

[0079] MS are selected and spliced ​​based on the local curvature change value and directional continuity score to form the weld compensation trajectory model MC.

[0080] The trajectory connection graph structure is constructed based on the sequence numbering order of the local trajectory model set MS in the global scale point set FL. First, each local trajectory model in the local trajectory model set MS is treated as a graph node and arranged in ascending order according to the starting number of its sequence number interval. For any two local trajectory models with adjacent sequence numbers, a directed connection edge is established. Then, the trajectory connection cost corresponding to this connection edge is calculated. The trajectory connection cost is denoted as Ci, and its calculation method is Ci = α × θi + β × (1 - Si); where θi represents the local curvature change value between two adjacent local trajectory models, Si represents the corresponding directional continuity score, and α and β are weighting coefficients, with α taking a value of 0.6 and β taking a value of 0.4. This calculation method unifies curvature change and directional continuity into trajectory connection cost. After completing the cost calculation for all connection edges, the complete trajectory connection graph structure is obtained.

[0081] Shortest path search is performed in the trajectory connection graph structure to obtain a sequence of candidate trajectory models. First, the local trajectory model with the smallest sequence number is determined as the starting node, and the local trajectory model with the largest sequence number is determined as the ending node. Then, the shortest path search algorithm is used to calculate the minimum cumulative cost path from the starting node to the ending node. The shortest path search algorithm adopts a node-by-node expansion calculation method: first, the cumulative cost value of the starting node is recorded as 0; then, the next node connected to the current node is visited sequentially, and the cumulative cost value of the current node is added to the cost value of the corresponding connecting edge to obtain a new cumulative cost value; if this cumulative cost value is less than the existing recorded value of the node, the cumulative cost value of the node is updated and its predecessor node is recorded. By continuously expanding nodes and updating the cumulative cost value, the process continues until the ending node is visited. Finally, the candidate trajectory model sequence is obtained by backtracking based on the predecessor node records.

[0082] Dynamic programming optimization is performed based on the candidate trajectory model sequence. First, assume the candidate trajectory model sequence contains n local trajectory models. For the i-th local trajectory model in the sequence, the cumulative optimization cost is defined as Fi. Initialize F1 equal to the cost of connecting the first trajectory segment. For each subsequent model in the sequence, the cumulative optimization cost is calculated according to the following recursive formula: Fi = min(Fi-1 + Ci); where Ci represents the cost of connecting the i-th trajectory segment. By accumulating the trajectory connection costs segment by segment and continuously comparing the cumulative costs, the local connection error can be re-evaluated. This dynamic programming process can further reduce local splicing errors while maintaining the overall path continuity.

[0083] Based on the dynamic programming optimization results, the sequence of local trajectory models with optimal continuity is selected to generate the weld compensation trajectory model MC. First, the path with the minimum cumulative cost is determined based on the cumulative optimization cost. Then, the direction vector and coordinates of the passing points of each local trajectory model are extracted sequentially according to the path. For two adjacent local trajectory models, a connection transition point is calculated within the overlapping area of ​​their corresponding sequence number intervals. The connection transition point is determined by the midpoint of the shortest distance between the two local trajectory model lines. All local trajectory models are sequentially spliced ​​together through the connection transition points to form a continuous spatial curve. This continuous spatial curve is the weld compensation trajectory model MC, used to describe the final trajectory shape of the track beam weld along its overall length.

[0084] Perform continuous curve fitting on MC to generate the center trajectory curve of the track beam weld and output the weld trajectory fitting result.

[0085] The coordinates of the trajectory nodes are extracted according to the sequence number of the weld compensation trajectory model MC in the global scale point set FL. The weld compensation trajectory model MC consists of several trajectory nodes, each containing three-dimensional coordinates (xi, yi, zi). First, the trajectory nodes are arranged in ascending order according to their corresponding sequence numbers to form an ordered sequence of trajectory nodes. Then, the Euclidean distance between two adjacent trajectory nodes is calculated, denoted as di. Next, a resampling interval parameter Lr is set, which is 3 mm. The Euclidean distance is accumulated segment by segment along the trajectory node sequence. When the accumulated distance reaches the resampling interval parameter Lr, the coordinates of a new trajectory point are calculated at the corresponding position through linear interpolation. All interpolated points are combined with the original trajectory nodes to form an equally spaced sequence of trajectory points, thereby ensuring uniform sampling density in the subsequent curve fitting process.

[0086] A cubic spline curve fitting model is constructed based on an equally spaced trajectory point sequence. Let the equally spaced trajectory point sequence contain n trajectory points, and let the three-dimensional coordinates of each trajectory point be represented as (xi, yi, zi), where the value of i ranges from 1 to n. First, the trajectory point sequence is parameterized according to the parameter variable t, which is defined as the cumulative arc length ratio of the trajectory point sequence. Then, cubic spline functions are constructed for the x, y, and z coordinates respectively. Taking the x-coordinate as an example, a cubic polynomial is constructed on the interval [ti, ti+1]: x(t) = ai + bi(t-ti) + ci(t-ti). 2 +di(t-ti) 3 Where ai, bi, ci, and di are the coefficients to be determined. By establishing constraint equations for the continuity of function values, first derivatives, and second derivatives in adjacent segments, and by calculating all coefficients using the least squares method, a three-dimensional continuous curve model is obtained. This continuous curve model serves as the initial continuous curve model.

[0087] The curvature of the initial continuous curve model is calculated and smoothed. First, curve points are sampled on the continuous curve with a fixed step size Δt. Then, the first and second derivative vectors of the curve at each sampling point are calculated, and the curvature value κ is calculated using the following formula: κ = |r'(t) × r"(t)| / |r'(t)| 3 Where r'(t) represents the first derivative vector and r"(t) represents the second derivative vector. Then, the average value μκ and the standard deviation σκ of all curvature values ​​are calculated, and the curvature smoothing threshold Tκ is defined as: Tκ = μκ + 1.5 × σκ. When the curvature value at a certain sampling point is greater than the curvature smoothing threshold Tκ, the spline control coefficient of that segment is adjusted to allow the curvature of adjacent segments to gradually transition, thereby eliminating local curvature abrupt changes.

[0088] The center trajectory curve of the track beam weld is generated based on the continuous curve model after curvature smoothing. First, samples are uniformly taken on the optimized continuous curve according to a fixed parameter step size Δt to obtain a set of three-dimensional spatial trajectory points. Then, all sampled trajectory points are arranged in trajectory order to form a spatial coordinate sequence. This spatial coordinate sequence is the discrete expression of the track beam weld center trajectory curve. Finally, the spatial coordinate sequence is output as the weld trajectory fitting result, which is used as a trajectory reference in subsequent automatic welding path planning or weld inspection processes for track beams.

[0089] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A method for fitting the weld seam trajectory of a tracked beam based on an improved RANSAC algorithm, characterized in that: include: Acquire the three-dimensional scanning point cloud data P of the track beam weld area, and perform coordinate system alignment processing on P according to the track beam structural direction to obtain a standardized point cloud set P0; Local height gradient analysis is performed on P0 to extract weld protrusion feature points, construct a set of weld candidate points, and eliminate welding spatter points according to the normal change rate of the points to obtain the weld feature point set F1. Based on the characteristic that the track beam welds are continuously distributed along the length of the structure, F1 is serialized into segments to construct a multi-scale point set structure, including the global scale point set FL and the local scale point set FS. Perform RANSAC random sampling on the global scale point set FL, fit the overall trend model ML of the weld, and select the set of interior points IL that meet the global residual threshold. Using IL as a constraint, perform several local RANSAC fittings on the local scale point set FS to generate a local trajectory model set MS, and calculate the local curvature change value and directional continuity score. MS are screened and spliced ​​based on local curvature change values ​​and directional continuity scores to form weld seam compensation trajectory model MC; Perform continuous curve fitting on MC to generate the center trajectory curve of the track beam weld and output the weld trajectory fitting result.

2. The method for fitting the weld seam trajectory of a track beam based on an improved RANSAC algorithm according to claim 1, characterized in that: The process of filtering and stitching MS based on local curvature change values ​​and directional continuity scores to form weld seam compensation trajectory model MC includes the following steps: The trajectory connection graph structure is constructed according to the sequence numbering order of the local trajectory model set MS in the global scale point set FL. Each local trajectory model is used as a graph node, and connection edges are established based on the local curvature change value and directional continuity score between adjacent models. At the same time, the corresponding trajectory connection cost is calculated. Starting with the local trajectory model with the smallest sequence number and ending with the local trajectory model with the largest sequence number, the shortest path search algorithm is used to calculate the path with the minimum cumulative cost in the trajectory connection graph structure to obtain the candidate trajectory model sequence. A dynamic programming optimization function is constructed based on the candidate trajectory model sequence to calculate the continuity constraint of the connection relationship between adjacent local trajectory models and update the cumulative cost value. Based on the dynamic programming optimization results, the sequence of local trajectory models with the best continuity is selected, and the local trajectory models are sequentially spliced ​​together to form the weld compensation trajectory model MC.

3. The method for fitting the weld seam trajectory of a track beam based on the improved RANSAC algorithm according to claim 1, characterized in that: The process of obtaining the standardized point cloud set P0 includes the following steps: performing voxel mesh downsampling on the 3D scanned point cloud data P to remove redundant points and preserve the geometric features of the weld area, resulting in a preprocessed point cloud set P1; performing principal direction analysis on the preprocessed point cloud set P1, calculating the point cloud covariance matrix and extracting the eigenvector corresponding to the largest eigenvalue to determine the principal axis direction vector V of the track beam structure; constructing a structural reference coordinate system based on the principal axis direction vector V, and calculating the rotation transformation matrix between the preprocessed point cloud set P1 and the structural reference coordinate system; and performing coordinate transformation on the preprocessed point cloud set P1 according to the rotation transformation matrix to obtain the standardized point cloud set P0.

4. The method for fitting the weld seam trajectory of a track beam based on the improved RANSAC algorithm according to claim 1, characterized in that: Perform local height gradient analysis on P0 to extract weld protrusion feature points and construct a set of weld candidate points, including the following steps: Establish a neighborhood with a fixed radius centered on each point in the standardized point cloud set P0, calculate the height difference of each point in the neighborhood in the vertical direction, and construct the local height gradient value based on the height difference to obtain the height gradient point set G; A gradient threshold is set based on the gradient magnitude in the set of height gradient points G. Points with gradient values ​​greater than the gradient threshold are filtered to extract candidate points for the weld protrusion region, forming a set of weld candidate points F.

5. The method for fitting the weld seam trajectory of a track beam based on the improved RANSAC algorithm according to claim 4, characterized in that: The weld feature point set F1 is obtained by eliminating welding spatter points based on the normal change rate of the points. This includes: establishing a neighborhood plane for each point in the weld candidate point set F, calculating the normal direction of each point through least squares plane fitting, and obtaining the corresponding normal change rate; setting a normal change rate threshold based on the normal change rate of each point, and identifying points with a normal change rate greater than the normal change rate threshold as welding spatter points and eliminating them, thereby obtaining the weld feature point set F1.

6. The method for fitting the weld seam trajectory of a track beam based on the improved RANSAC algorithm according to claim 1, characterized in that: The step of serializing and segmenting F1 to construct a multi-scale point set structure includes the following steps: Based on the main axis direction of the track beam structure in the standardized point cloud set P0, each point in the weld feature point set F1 is projected along the main axis direction, and the weld feature point set F1 is sorted according to the projected coordinate values ​​to form an ordered point sequence arranged in the direction of structural length. The ordered point sequence is divided into sliding segments according to fixed-length windows. Each window contains a preset number of weld feature points. A continuous set of segmented points is constructed by the overlapping relationship between adjacent windows. The entire ordered point sequence is taken as the global scale point set, and the continuous segmented point sets corresponding to each sliding window are taken as local scale point sets, thus forming a multi-scale point set structure that includes the global scale point set and multiple local scale point sets.

7. The method for fitting the weld seam trajectory of a track beam based on the improved RANSAC algorithm according to claim 1, characterized in that: The step of performing RANSAC random sampling on the overall scale point set FL and fitting the overall trend model ML of the weld seam includes the following steps: In the overall scale point set FL, equally spaced sampling intervals are established according to the sequence number. A preset number of weld feature points are randomly selected as initial sampling points in different sampling intervals. The overall trend model ML of the weld is calculated using the least squares linear fitting method based on the initial sampling points, and the direction parameters and spatial position parameters of the overall trend model ML are obtained. The spatial distance residual from each point in the overall scale point set FL to the overall trend model ML of the weld is calculated, and each point is judged according to the preset global residual threshold. Weld feature points whose spatial distance residual is less than or equal to the global residual threshold are included in the inner point set IL, and the sequence position of the inner point set IL in the overall scale point set FL is recorded.

8. The method for fitting the weld seam trajectory of a track beam based on the improved RANSAC algorithm according to claim 1, characterized in that: The process of performing several local RANSAC fitting operations on the local scale point set FS with IL as a constraint includes the following steps: Based on the sequence number range of the interior point set IL in the global scale point set FL, the local scale point set FS within the corresponding number interval is extracted as the effective local point set; Random consistency sampling is performed on the effective local point set. An initial local model is constructed by randomly selecting a preset number of weld feature points, and the local trajectory model parameters are calculated using the least squares method. Calculate the spatial distance residuals from each point in the effective local point set to the local trajectory model, and filter the local inliers that meet the conditions based on the preset local residual threshold. The random consistency sampling process is repeated a preset number of times, and the local trajectory model that meets the local residual threshold and has the largest number of local inliers is recorded to form a local trajectory model set MS.

9. A method for fitting the weld seam trajectory of a track beam based on an improved RANSAC algorithm according to claim 8, characterized in that: The calculation of local curvature change values ​​and directional continuity scores, The process includes the following steps: sorting the local trajectory model set MS according to the sequence number of the local trajectory models in the global scale point set FL, and extracting the direction vectors of two adjacent local trajectory models; calculating the included angle value based on the direction vectors of two adjacent local trajectory models, and using the included angle value as the local curvature change value; constructing a direction continuity evaluation function based on the local curvature change value, and scoring the continuity of each local trajectory model, wherein the continuity score is calculated by combining the included angle of the directions of adjacent local trajectory models and the number of corresponding local inliers.

10. A method for fitting the weld seam trajectory of a track beam based on an improved RANSAC algorithm according to claim 1, characterized in that: The process of continuously fitting MC to generate the center trajectory curve of the track beam weld includes the following steps: The coordinates of each trajectory node are extracted according to the sequence number of the weld compensation trajectory model MC in the global scale point set FL, and the spatial distance between adjacent trajectory nodes is uniformly resampled to obtain an equally spaced trajectory point sequence. A cubic spline curve fitting model is constructed based on the equidistant trajectory point sequence. The control coefficients of the spline function are calculated by the least squares solution method to obtain the initial continuous curve model. The curvature distribution of the initial continuous curve model is calculated, and the local curvature abrupt change segments are iteratively smoothed and adjusted according to the preset curvature smoothing threshold to obtain the optimized continuous curve model. The optimized continuous curve model is used as the center trajectory curve of the track beam weld, and the spatial coordinate sequence of the center trajectory curve of the track beam weld is output as the weld trajectory fitting result.