Robot trajectory learning generation method and system based on improved k value selection algorithm
By optimizing the GMM parameters using an improved k-value selection algorithm and an expectation-maximization algorithm, the problems of difficult k-value selection and elbow point ambiguity in robot imitation learning are solved, thereby improving the accuracy and robustness of robot trajectory learning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHENGZHOU RES INST OF MECHANICAL ENG CO LTD
- Filing Date
- 2026-01-29
- Publication Date
- 2026-05-05
AI Technical Summary
In existing robot imitation learning techniques, it is difficult to select the k value during GMM initialization. The traditional elbow method suffers from ambiguity of the 'elbow point' in specific datasets, leading to selection bias and insufficient ability to balance model complexity and fit, thus affecting trajectory learning accuracy.
An improved k-value selection algorithm is introduced, which amplifies the weights of poorly clustered clusters through an exponential function. A penalty term and a scaling factor are introduced, and the GMM parameters are optimized by combining the expectation-maximization algorithm. A closed-loop learning architecture is constructed to determine the optimal number of Gaussian kernels and generate robot trajectories.
It improves the accuracy and robustness of robot trajectory learning, overcomes the difficulties in choosing the k-value and the ambiguity of the elbow point in traditional methods, and ensures accurate model initialization and efficient fitting.
Smart Images

Figure CN121973204A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of robot control and trajectory planning technology, and in particular to a robot trajectory learning and generation method and system based on an improved k-value selection algorithm. Background Technology
[0002] With the development of robotics technology, robots have been widely used in industries such as manufacturing, healthcare, and services. To enable robots to adapt to complex working environments and possess greater flexibility, trajectory imitation learning has become a key technology. Through imitation learning, robots can learn complex motion patterns from expert-taught motion trajectories and adjust and optimize them according to specific task requirements.
[0003] Among existing trajectory learning methods, Gaussian Mixture Regression (GMM) is widely used due to its powerful trajectory encoding capabilities. GMM can effectively handle multimodal data and capture complex trajectory features, and is usually combined with Gaussian Mixture Regression (GMR) to generate the final learned trajectory. When applying GMM for modeling, it is usually necessary to first use the k-means clustering method to perform preliminary clustering on the original expert data to determine the initialization parameters of GMM.
[0004] However, existing imitation learning methods have the following obvious drawbacks when learning trajectories:
[0005] 1. The Blindness of Determining the k-Value: The k-means clustering algorithm requires a pre-defined number of Gaussian kernels, i.e., the k-value. Existing methods rely on random assignment or empirical estimation for the selection of the k-value. An inappropriate k-value may lead to inaccurate initialization parameters of the model, thus affecting the accuracy of the final learned trajectory.
[0006] 2. Failure of the Traditional Elbow Method: To determine the optimal value of k, existing algorithms often employ the "elbow method," based on the sum of squared errors (SSE). This method plots the relationship between k and SSE, searching for the "elbow" point where the rate of descent of the curve sharply slows down, which is then used as the k value. However, when processing certain trajectory data, the relationship between k and SSE may not reveal a clear "elbow" point.
[0007] 3. Limitations of the evaluation metric: The traditional "elbow method" only calculates the sum of squared errors within clusters (Total SSE). This algorithm cannot distinguish certain extreme cases, such as: in a certain clustering method, there may be a cluster with a very large SSE, while the SSEs of other clusters are very small. The sum of these errors may be very close to that of another clustering method with uniform SSEs among the clusters, but the clustering method with uniform SSEs is generally considered superior. Therefore, this will cause the traditional "elbow method" to fail in such cases, ultimately affecting the quality of GMM initialization.
[0008] In summary, existing technologies lack a method for accurately and robustly selecting the k-value automatically for complex trajectory data, which limits further improvements in the accuracy of robotic arm trajectory learning. Therefore, an improved k-value selection strategy is urgently needed to optimize the initialization process of the GMM, thereby enhancing the accuracy of robot trajectory generation. Summary of the Invention
[0009] This invention provides a robot trajectory learning and generation method and system based on an improved k-value selection algorithm, in order to solve the technical problems in existing robot imitation learning techniques, such as the difficulty in selecting the k-value during GMM initialization, the selection bias caused by the ambiguity of the "elbow point" in the traditional elbow method under specific datasets, and the insufficient ability to balance model complexity and fit.
[0010] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0011] This invention provides a robot trajectory learning and generation method based on an improved k-value selection algorithm, comprising:
[0012] S1: Obtain the original trajectory data during the robot teaching process, wherein the original trajectory data includes: robot end pose, velocity, acceleration and time information corresponding to each point on the robot trajectory;
[0013] S2: An improved k-value selection algorithm is used to determine the optimal number of Gaussian kernels. The algorithm introduces the properties of an exponential function to amplify the weights of clusters with poor clustering performance, introduces a penalty term to amplify the weights of clusters with poor compactness, and introduces a scaling factor to prevent exponential explosion, ultimately forming... Algorithms are used to calculate clustering evaluation metrics for different k values;
[0014] S3: Perform k-means clustering using the optimal k value determined in S2 to obtain the initial mean vector, covariance matrix, and weight parameters of the Gaussian mixture model;
[0015] S4: The Gaussian mixture model is iteratively calculated using the expectation-maximization algorithm. The iterative calculation is based on the E-step to obtain the posterior probability of each data point based on the Gaussian distribution, and the parameters of the Gaussian mixture model are re-estimated based on the M-step using the posterior probability.
[0016] S5: Based on the specific task requirements, the desired planned trajectory of the robot is generated by Gaussian mixture model parameters through Gaussian mixture regression.
[0017] Furthermore, in S2, the specific process of determining the optimal value of k includes:
[0018] A preliminary range of k values has been selected;
[0019] Calculate the optimization evaluation corresponding to each k value ;
[0020] Plot the k value and The corresponding relationship curve is calculated, and the slope between different k values is calculated.
[0021] The optimal number of Gaussian kernels is selected by choosing the k value with the largest difference between adjacent slopes. .
[0022] Furthermore, in S4, the training process of the expectation-maximization algorithm specifically includes:
[0023] The E-step: using the model parameter weights and mean kernel covariance matrix of the current iteration step, calculate the posterior probability of each sampling point in the teaching trajectory dataset generated by the k-th Gaussian kernel;
[0024] The M-step involves re-estimating and updating the parameters of the Gaussian mixture model based on the posterior probability calculated in the E-step using the maximum likelihood estimation method, in order to maximize the likelihood function of the observed data.
[0025] After each iteration, the log-likelihood function value of the complete dataset under the Gaussian mixture model is calculated, and it is determined whether the change in log-likelihood value between two adjacent iterations has reached the convergence condition.
[0026] Furthermore, in S5, the process of Gaussian mixture regression specifically includes: variable decomposition, calculation of activation weights, conditional expectation solution, and smooth trajectory synthesis.
[0027] Furthermore, S5 specifically includes:
[0028] Using time t as the query input, the GMR algorithm is used to obtain the joint probability distribution. Solving probability distributions ;
[0029] GMR predicts the expected mean and corresponding covariance of the robot's end-effector pose at a given time t by weighting and combining various Gaussian kernels.
[0030] Based on specific task requirements, such as setting a new starting position or target point, GMR calculates in real time a smooth, continuous desired trajectory that highly overlaps with the taught trajectory in terms of motion morphology.
[0031] This invention also provides a robot trajectory learning and generation system based on an improved k-value selection algorithm, comprising:
[0032] The expert teaching data acquisition module is used to acquire the raw trajectory data during the robot teaching process and perform preprocessing. The raw trajectory data includes: robot end pose, velocity, acceleration, and time information corresponding to each point on the robot trajectory.
[0033] An improved k-value selection module is used to determine the optimal number of Gaussian kernels using an improved k-value selection algorithm. The algorithm introduces the properties of an exponential function to amplify the weights of clusters with poor clustering performance, introduces a penalty term to amplify the weights of clusters with poor compactness, and introduces a scaling factor to prevent exponential explosion, ultimately forming... Algorithms are used to calculate clustering evaluation metrics for different k values;
[0034] The Gaussian mixture model parameter initialization module is used to perform k-means clustering using the optimal k value determined by S2 to obtain the initial mean vector, covariance matrix, and weight parameters of the Gaussian mixture model.
[0035] Gaussian Mixture Model Training Module: Used to perform iterative calculations on the Gaussian Mixture Model using the expectation-maximization algorithm. The iterative calculations are based on the E-step to obtain the posterior probability of each data point based on the Gaussian distribution, and the parameters of the Gaussian Mixture Model are re-estimated based on the M-step using the posterior probability.
[0036] Trajectory generation module: Used to generate the robot's desired planned trajectory through Gaussian mixture regression using trained Gaussian mixture model parameters according to specific task requirements.
[0037] Compared with the prior art, the technical solution disclosed in this invention has the following beneficial effects:
[0038] This invention provides a robot trajectory imitation learning generation method and system based on an improved k-value selection algorithm. By introducing exponential function adjustment, penalty term, and weight term to optimize k-value selection, the accuracy and robustness of learning expert-taught trajectories are ensured. A closed-loop learning architecture is constructed, which includes expert trajectory teaching data acquisition, intelligent selection of optimal k-value, GMM parameter training, and GMR trajectory generation. This overcomes the shortcomings of existing robot imitation learning technologies, such as the difficulty in selecting k-value during GMM initialization, the selection bias caused by the ambiguity of the "elbow point" in the traditional elbow method under specific datasets, and the insufficient ability to balance model complexity and fit. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is a schematic diagram of the robot trajectory learning and generation method based on an improved k-value selection algorithm provided in an embodiment of the present invention; Detailed Implementation
[0041] 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, and 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.
[0042] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0043] This invention provides a robot trajectory learning and generation method and system based on an improved k-value selection algorithm, which can solve the technical problems in the prior art.
[0044] This invention provides a robot trajectory learning and generation method based on an improved k-value selection algorithm, comprising:
[0045] S1: Obtain the raw trajectory data during the robot teaching process. The raw trajectory data includes: robot end-effector pose, velocity, acceleration, and time information corresponding to each point on the robot trajectory.
[0046] In the embodiments of this specification, S1 specifically includes:
[0047] The system acquires raw motion trajectory data during robot tasks through expert-led dragging or sensor recording, such as the robot's end effector speed, acceleration, and timestamps. Expert instructors guide the robot's end effector to complete preset tasks by controlling it into zero-force control or gravity compensation mode and using dragging to teach the robot. The system extracts the robot's motion data in real time, such as the end effector's pose p in Cartesian space and its corresponding timestamp t. This ultimately forms a sequence of raw trajectory points.
[0048] Preprocessing includes extracting key feature points from the acquired raw motion trajectory data and performing standardization to form the raw dataset for model learning. Since human operation inevitably introduces jitter or uneven speed, the acquired data undergoes time warping (e.g., Dynamic Time Warping (DTW)) to eliminate alignment errors on the time axis. High-frequency noise is eliminated using a low-pass filtering algorithm, and the processed pose data is spatially mapped and standardized to construct the raw feature dataset for subsequent model learning.
[0049] S2: An improved k-value selection algorithm is used to determine the optimal number of Gaussian kernels. The algorithm introduces the properties of the exponential function to amplify the weights of clusters with poor clustering performance, introduces a penalty term to amplify the weights of clusters with poor compactness, and introduces a scaling factor to prevent exponential explosion, ultimately forming... Algorithms are used to calculate clustering evaluation metrics for different k values;
[0050] S2 includes: cyclically trying different k values within a preset range, and performing k-means clustering for each k value to obtain its clustering result.
[0051] Introducing the exponential function Optimize traditional SSE calculation. By performing an exponential mapping on the SSE within each cluster, the influence weight of poorly compact clusters on the overall metric is amplified.
[0052] To improve the algorithm's sensitivity to local worst-case clustering, an exponential term representing the largest SSE among all current clusters is added to the evaluation metrics. Simultaneously, a crucial scaling weight is introduced. The new evaluation index is defined as follows: (This is used to adjust the exponential term and prevent the "exponential explosion" phenomenon when processing large-scale data, ensuring the robustness and stability of numerical computation.) .
[0053] Calculate the improvement evaluation index corresponding to different k values An evaluation curve is plotted. By analyzing the rate of change of the curve's slope, the inflection point where the slope interpolation between adjacent line segments is maximized is defined as the optimal "elbow point," thereby determining the optimal number of Gaussian kernel functions. .
[0054] This is the core step of the invention, used to determine the optimal number of Gaussian kernels in the GMM. The process is as follows:
[0055] A preliminary range of k values has been selected;
[0056] Calculate the optimization evaluation corresponding to each k value ;
[0057] Plot the k value and The corresponding relationship curve is calculated, and the slope between different k values is calculated.
[0058] The optimal number of Gaussian kernels is selected by choosing the k value with the largest difference between adjacent slopes. .
[0059] Specifically, different values of k are tried within a preset range (k=1 to k=m). For each value of k, the k-means clustering algorithm is used to perform preliminary classification of the original feature dataset, and the centroid of each cluster and the SSE within the cluster are calculated.
[0060] An evaluation metric is introduced for the classification results of each cluster. This evaluation metric leverages the exponential function's high sensitivity to positive changes to amplify the proportion of poorly performing clusters in the overall evaluation. Simultaneously, to prevent exponential explosion and ensure numerical computation stability, scaling weights are introduced to adjust the exponent's two levels. Finally, the SSE (Sum of Squares Error) of the cluster with the largest sum of squares error is added as a penalty term, as shown in the following formula:
[0061]
[0062] in: To scale the weights; For sample objects in a cluster; It is the centroid of the cluster;
[0063] Plot the k value and The relationship curve is obtained by calculating the slope change between adjacent line segments, and the k value with the largest slope decrease interpolation is locked as the optimal Gaussian kernel function. This is to ensure the accuracy of the subsequent GMM.
[0064] S3: Use the optimal k value determined in S2 to perform k-means clustering to obtain the initial mean vector, covariance matrix and weight parameters of the Gaussian mixture model;
[0065] S3 specifically includes: the optimal solution determined by S2. The number of cluster centers is used as the clustering feature calculated based on the k value at this point, which is then used as the initial mean vector for the GMM algorithm. Assisted variance matrix and mixed weighting coefficient
[0066] S4: The Gaussian Mixture Model (GMM) is iteratively calculated using the Expectation-Maximization (EM) algorithm. The iterative calculation begins with the E-step, which yields the posterior probability of each data point based on a Gaussian distribution. Then, in the M-step, the parameters of the GMM are re-estimated using these posterior probabilities. This process is repeated until the log-likelihood function of the model converges to obtain the optimal GMM parameters. Specifically, the EM algorithm is used to iteratively refine the initial GMM parameters. In the E-step, based on the current model parameters, the posterior probability of each data point belonging to the k-th Gaussian distribution is calculated using the Bayesian criterion. In the M-step, based on the posterior probability obtained in the E-step, the weights, mean, and covariance matrix are recalculated and updated to maximize the log-likelihood probability of the observed data. This process is continuously iterated until the variable representing the model parameter falls below a set minimum threshold or the maximum number of iterations is reached, ultimately completing the learning of the probability density distribution of the complex features of the trajectory.
[0067] S5: Based on the specific task requirements, use the trained Gaussian mixture model parameters to generate the robot's desired planned trajectory through Gaussian mixture regression.
[0068] S5 includes: performing regression analysis using trained GMM parameters according to specific task requirements.
[0069] Regression analysis is used to predict the mean and covariance distributions of output variables under given input conditions, thereby synthesizing a desired motion trajectory that highly preserves the characteristics of the original expert teaching, driving the robot to complete the actual task. Specifically, time t is used as the query input, and the GMR algorithm is used to obtain the mean and covariance distribution from the joint probability distribution. Solving probability distributions GMR predicts the expected mean and corresponding covariance of the robot's end-effector pose at a given time t by weighting and combining various Gaussian kernels. Combined with specific task requirements, such as setting a new starting position or target point, GMR can calculate in real time a smooth, continuous desired trajectory that highly overlaps with the taught trajectory in terms of motion.
[0070] Furthermore, in S4, the training process of the Expectation-Maximization algorithm specifically includes:
[0071] E-step: Using the model parameter weights, mean kernel covariance matrix of the current iteration step, calculate the posterior probability of each sampling point in the teaching trajectory dataset generated by the k-th Gaussian kernel;
[0072] M-step: Based on the posterior probability calculated in the E-step, the parameters of the Gaussian mixture model are re-estimated and the kernel is updated using the maximum likelihood estimation method to maximize the likelihood function of the observed data;
[0073] After each iteration, the log-likelihood function value of the complete dataset under the Gaussian mixture model is calculated, and it is determined whether the change in the log-likelihood value between two adjacent iterations has reached the convergence condition.
[0074] Furthermore, in S5, the process of Gaussian mixture regression specifically includes: variable decomposition, calculation of activation weights, conditional expectation solution, and kernel smoothing trajectory synthesis.
[0075] Furthermore, key feature points include time series, Cartesian spatial pose of the robot's end effector, velocity information, acceleration, and other information.
[0076] Furthermore, k-means clustering is an unsupervised learning algorithm that randomly selects k points from the points traversed by the teaching trajectory as initial centroids, assigns each remaining data point to the nearest centroid to form k clusters, recalculates the mean coordinates of all points in each cluster as the new centroid, and reassigns the remaining points to the nearest new centroid, repeating this iterative process until convergence.
[0077] Furthermore, scaling weights The selection of the exponent is based on the size and distribution characteristics of the original dataset and has dynamic adaptability. It aims to control the input value of the exponent term within a preset safe value range, avoid the overflow risk caused by "exponential explosion", and ensure the stability of the algorithm in the controller.
[0078] Furthermore, the convergence threshold of the EM algorithm is set to be the increment of the log-likelihood function being less than a preset minimum value.
[0079] This invention also provides a robot trajectory learning and generation system based on an improved k-value selection algorithm, comprising:
[0080] The expert teaching data acquisition module is used to acquire the raw trajectory data during the robot teaching process. The raw trajectory data includes: robot end-effector pose, velocity, acceleration, and time information corresponding to each point on the robot trajectory.
[0081] This module is used for:
[0082] Establish a teaching dataset: Obtain the raw motion data of the robot's end effector in the task space through teaching methods (such as drag-and-drop teaching and teleoperation teaching). This dataset records the pose characteristics of the end effector over time, and its general vector form is as follows:
[0083]
[0084] in, It is a multidimensional vector. Represents a timestamp or query index. This represents the n-dimensional position and orientation information of the robot's end effector in the task space.
[0085] The robot acquires complete status information in real time and synchronously through multiple sensors installed on its body. Specifically, this includes:
[0086] Joint information acquisition: The angles of each joint are measured in real time using an optical encoder or rotary transformer installed at each joint. and angular velocity .
[0087] End-effector pose calculation: Joint information obtained using joint information and By combining known robot kinematics models, the pose of the end effector in the task space is obtained in real time through forward kinematics calculations. and speed The details are as follows:
[0088]
[0089] An improved k-value selection module is used to determine the optimal number of Gaussian kernels using an improved k-value selection algorithm. The algorithm introduces the properties of the exponential function to amplify the weights of clusters with poor clustering performance, introduces a penalty term to amplify the weights of clusters with poor compactness, and introduces a scaling factor to prevent exponential explosion, ultimately forming... An algorithm is used to calculate clustering evaluation metrics for different k values.
[0090] This module is used for:
[0091] To address the problem that traditional methods often fail to identify inflection points in complex trajectories, this invention designs an improved clustering evaluation index. This index amplifies the error weights of poorly clustered groups by introducing an exponential function, amplifies the weights of poorly compact clusters by introducing a penalty term, and prevents exponential explosion by introducing a scaling factor. The designed evaluation index formula is as follows:
[0092]
[0093] in:
[0094] K: Represents the number of Gaussian kernels currently assumed;
[0095] : Represents the sum of squared errors within the i-th cluster group;
[0096] : Represents the weight, i.e., the total number of samples;
[0097] The system is within the preset range Inner traversal calculation The value of k- is used to construct k- Relationship curve. Calculate the slope difference between adjacent k values. Select to make The maximum value of k is the optimal number of Gaussian kernels. .
[0098] The Gaussian mixture model parameter initialization module is used to perform k-means clustering using the optimal k value determined by S2, and obtain the initial mean vector, covariance matrix and weight parameters of the Gaussian mixture model.
[0099] This module is used for:
[0100] Based on the optimal number of Gaussian kernels determined in step S2 The k-means algorithm is called to cluster the teaching data.
[0101] Extract and initialize the three core parameters of the GMM from the clustering results:
[0102] Prior probability : Represents the weight of the k-th Gaussian distribution in the model.
[0103] Mean vector : Represents the center of the k-th Gaussian distribution.
[0104] covariance matrix : Determines the probability distribution of the k-th Gaussian distribution, the shape and orientation of the cluster.
[0105] Gaussian Mixture Model Training Module: This module is used to perform iterative calculations on the Gaussian mixture model using the expectation-maximization algorithm. The iterative calculations are based on the E-step to obtain the posterior probability of each data point based on the Gaussian distribution, and then based on the M-step, the parameters of the Gaussian mixture model are re-estimated using the posterior probability.
[0106] This module is used for:
[0107] The system utilizes the Gaussian mixture model parameters within the current iteration period to preprocess each sampling observation point. Perform an evaluation. Calculate the posterior probability that the observation point belongs to the k-th Gaussian distribution. The formula is as follows:
[0108]
[0109] in:
[0110] t: represents the number of iterations; : Represents the posterior probability that the j-th point x belongs to the k-th Gaussian distribution after t iterations; : Represents the prior probability of the k-th Gaussian distribution after t iterations; : Represents the sample size after t iterations. The probability density under the k-th Gaussian distribution reflects the explanatory power of the k-th Gaussian kernel for the trajectory features at that location after t iterations. Its calculation formula reflects the proportion of the probability density of each Gaussian distribution at the current point to the global probability density. This step achieves "fuzzy clustering" of complex teaching trajectory data in a probabilistic sense.
[0111] Based on the posterior probability distribution calculated above, the GMM parameters are re-estimated and updated according to the following formula:
[0112]
[0113]
[0114]
[0115] in:
[0116] N: Represents the total number of samples.
[0117] Update weights The method involves calculating the sum of the posterior probabilities of all sample points belonging to the k-th Gaussian distribution, divided by the total number of samples. Then, the mean vector is updated. The method involves calculating a weighted average of the trajectory points using the posterior probability of each data point as the weight. This updates the covariance matrix. The method is to calculate the weighted deviation of the sampling points relative to the new mean.
[0118] The system iteratively executes E-steps and M-steps, causing the model parameters to continuously approach the optimal value in the direction of increasing likelihood function. If the likelihood increment between two adjacent iterations is less than a preset convergence threshold, the model can be considered to have converged.
[0119] Trajectory generation module: Used to generate the robot's desired planned trajectory through Gaussian mixture model parameters by using Gaussian mixture regression according to specific task requirements.
[0120] This module is used for:
[0121] To transform the probabilistic model into a deterministic trajectory, the system first decomposes the parameters of the trained K Gaussian distributions into a spatiotemporal dimension. The D-dimensional mean vector is then... Divided into time components Spatial pose components Simultaneously, the covariance matrix... Divided into time items Spatial items and the cross-covariance term representing the time mapping relationship and .
[0122] Given a time series t for the execution of a target, the system calculates the activation weight of each Gaussian distribution at that moment. This dynamic weight allocation mechanism ensures the temporal logic of trajectory generation.
[0123] For each Gaussian distribution, calculate its expected position at a given time t using the conditional probability formula. This is achieved through the cross-covariance matrix. With time error The product of these terms is used to correct the spatial mean online.
[0124] Finally, the system performs a weighted summation of the local regression results of all Gaussian distributions to obtain a unique global smooth coordinate. Because GMR uses a probabilistic weighted synthesis mechanism, different Gaussian distributions will produce a smooth superposition effect in the transition region, thereby automatically filtering out noise and jitter in the teaching data.
[0125] Furthermore, improve clustering evaluation metrics. In this paper, a nonlinear amplification mechanism is constructed by introducing an exponential term and a maximum error term. Compared with the linearly changing SSE index in the traditional elbow method, this invention can more sensitively capture the structural change of the number of clusters K as it transitions from underfitting to just-fitting, effectively solving the technical pain point of unclear "elbow inflection point" in complex robot motion trajectory data, and ensuring the structural optimization of subsequent GMM modeling.
[0126] Furthermore, in the S4 process, the posterior probability The introduction of this not only enables probabilistic representation of nonlinear trajectories but also endows the system with tolerance to teaching noise. Due to the mean vector... Covariance Matrix The updates are all based on probability weighting, and the model can automatically weaken the influence of outliers on the main trajectory during the training phase, thus achieving preliminary data smoothing at the parameter level.
[0127] Furthermore, during the GMR trajectory generation process, The spatiotemporal decomposition of the mean and covariance matrices is key to achieving dynamic programming. This is achieved through the cross-covariance term. Online correction of the spatial mean ensures that the generated trajectory is not a mechanical reproduction of the taught trajectory, but rather based on a probabilistic model of the current time progress. The optimal estimate ensures that the robot can maintain the consistency of its motion pattern under different sampling rates or execution speeds.
[0128] Furthermore, by activating the dynamic weight allocation mechanism, the final coordinates are determined by multiple local regression results in the transition region of adjacent Gaussian distributions during trajectory generation. This "soft switching" characteristic is the fundamental reason for generating smooth motion trajectories and effectively avoids the acceleration abrupt change phenomenon that may occur at the connection point in traditional piecewise fitting methods.
[0129] Furthermore, the joint information acquisition and end-effector pose calculation module in the system can dynamically replace the kinematic model according to different robot configurations (such as six-DOF industrial robots, collaborative robots, or mobile robotic arms), which has strong versatility; and the system is not limited to processing Cartesian space coordinates, but is also applicable to trajectory learning and generation of joint space angle sequences.
[0130] Furthermore, in practical engineering deployments, the convergence threshold and the optimal Gaussian kernel search range can be preset according to the complexity of the task. For high-precision tasks such as fine assembly, the threshold can be appropriately increased. The upper limit is increased and the convergence threshold is reduced in exchange for a more refined trajectory representation capability.
[0131] Furthermore, the method and system can be applied to various scenarios requiring complex trajectory planning, including but not limited to precision assembly, grinding and polishing, medical surgery, and human-machine collaboration.
[0132] Furthermore, the smooth coordinates output by the trajectory generation module can be directly input into the robot's underlying servo driver as the robot's desired position command, thereby constructing a complete closed-loop control chain from "expert teaching" to "model learning" and then to "physical execution".
[0133] This specification's embodiments creatively propose an imitation learning method that deeply integrates the probabilistic encoding capability of the Gaussian Mixture Model (GMM) with the intelligent decision-making capability of the improved k-value selection algorithm (KVS). This method enables precise control of robot motion trajectories even with limited expert teaching data and complex and variable trajectory features. The method introduces an improved evaluation index based on an exponential function. This effectively amplifies the weights of poorly compact clusters through exponential mapping, and combines penalty terms with scaling weights. This significantly enhances the algorithm's sensitivity to local clustering bias and the stability of numerical computation. Through This invention precisely and autonomously locks the optimal number of Gaussian kernel functions, theoretically solving the problem of unclear elbows that may occur when traditional SSE (Survey-Survey-Survey) searches for the optimal k value. Compared with existing technologies, this invention completely avoids the possible bias in k value selection, significantly improving the accuracy of trajectory learning without significantly increasing computational complexity. It provides a stable, reliable, and high-performance technical solution for trajectory planning of robots in complex and uncertain environments.
[0134] The basic principles of the present invention have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in the present invention are merely examples and not limitations, and should not be considered as essential features of each embodiment of the present invention. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the present invention to the necessity of employing the aforementioned specific details.
[0135] The block diagrams of devices, apparatuses, devices, and systems involved in this invention are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.
[0136] It should also be noted that in the apparatus, device, and method of the present invention, the components or steps can be disassembled and / or recombined. These disassemblies and / or recombinations should be considered as equivalent solutions of the present invention.
[0137] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the invention. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein can be applied to other aspects without departing from the scope of the invention. Therefore, the invention is not intended to be limited to the aspects shown herein, but rather to be carried out within the widest scope consistent with the principles and novel features disclosed herein.
[0138] It should be understood that the qualifying terms "first", "second", "third", "fourth", "fifth" and "sixth" used in the description of the embodiments of the present invention are only used to more clearly illustrate the technical solutions and are not intended to limit the scope of protection of the present invention.
[0139] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of the invention to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations therein.
Claims
1. A robot trajectory learning and generation method based on an improved k-value selection algorithm, characterized in that, include: S1: Obtain the original trajectory data during the robot teaching process, wherein the original trajectory data includes: robot end pose, velocity, acceleration and time information corresponding to each point on the robot trajectory; S2: An improved k-value selection algorithm is used to determine the optimal number of Gaussian kernels. The algorithm introduces the properties of an exponential function to amplify the weights of clusters with poor clustering performance, introduces a penalty term to amplify the weights of clusters with poor compactness, and introduces a scaling factor to prevent exponential explosion, ultimately forming... Algorithms are used to calculate clustering evaluation metrics for different k values; S3: Perform k-means clustering using the optimal k value determined in S2 to obtain the initial mean vector, covariance matrix, and weight parameters of the Gaussian mixture model; S4: The Gaussian mixture model is iteratively calculated using the expectation-maximization algorithm. The iterative calculation is based on the E-step to obtain the posterior probability of each data point based on the Gaussian distribution, and the parameters of the Gaussian mixture model are re-estimated based on the M-step using the posterior probability. S5: Based on the specific task requirements, the desired planned trajectory of the robot is generated by Gaussian mixture model parameters through Gaussian mixture regression.
2. The robot trajectory learning and generation method based on the improved k-value selection algorithm according to claim 1, characterized in that, In S2, the specific process of determining the optimal k value includes: A preliminary range of k values has been selected; Calculate the optimization evaluation corresponding to each k value ; Plot the k value and The corresponding relationship curve is calculated, and the slope between different k values is calculated. The optimal number of Gaussian kernels is selected by choosing the k value with the largest difference between adjacent slopes. .
3. The robot trajectory learning and generation method based on the improved k-value selection algorithm according to claim 1, characterized in that, In S4, the training process of the expectation-maximization algorithm specifically includes: The E-step: using the model parameter weights and mean kernel covariance matrix of the current iteration step, calculate the posterior probability of each sampling point in the teaching trajectory dataset generated by the k-th Gaussian kernel; The M-step involves re-estimating and updating the parameters of the Gaussian mixture model based on the posterior probability calculated in the E-step, using maximum likelihood estimation to maximize the likelihood function of the observed data. After each iteration, the log-likelihood function value of the complete dataset under the Gaussian mixture model is calculated, and it is determined whether the change in log-likelihood value between two adjacent iterations has reached the convergence condition.
4. The robot trajectory learning and generation method based on the improved k-value selection algorithm according to claim 1, characterized in that, In S5, the process of Gaussian mixture regression specifically includes: variable decomposition, calculation of activation weights, conditional expectation solution, and smooth trajectory synthesis.
5. The robot trajectory learning and generation method based on the improved k-value selection algorithm according to claim 3, characterized in that, S5 specifically includes: Using time t as the query input, the GMR algorithm is used to obtain the joint probability distribution. Solving probability distributions ; GMR predicts the expected mean and corresponding covariance of the robot's end-effector pose at a given time t by weighting and combining various Gaussian kernels. Based on specific task requirements, such as setting a new starting position or target point, GMR calculates in real time a smooth, continuous desired trajectory that highly overlaps with the taught trajectory in terms of motion morphology.
6. A robot trajectory learning and generation system based on an improved k-value selection algorithm, characterized in that, include: The expert teaching data acquisition module is used to acquire the raw trajectory data during the robot teaching process and perform preprocessing. The raw trajectory data includes: robot end pose, velocity, acceleration, and time information corresponding to each point on the robot trajectory. An improved k-value selection module is used to determine the optimal number of Gaussian kernels using an improved k-value selection algorithm. The algorithm introduces the properties of an exponential function to amplify the weights of clusters with poor clustering performance, introduces a penalty term to amplify the weights of clusters with poor compactness, and introduces a scaling factor to prevent exponential explosion, ultimately forming... Algorithms are used to calculate clustering evaluation metrics for different k values; The Gaussian mixture model parameter initialization module is used to perform k-means clustering using the optimal k value determined by S2 to obtain the initial mean vector, covariance matrix, and weight parameters of the Gaussian mixture model. Gaussian Mixture Model Training Module: Used to perform iterative calculations on the Gaussian Mixture Model using the expectation-maximization algorithm. The iterative calculations are based on the E-step to obtain the posterior probability of each data point based on the Gaussian distribution, and the parameters of the Gaussian Mixture Model are re-estimated based on the M-step using the posterior probability. Trajectory generation module: Used to generate the robot's desired planned trajectory through Gaussian mixture regression using trained Gaussian mixture model parameters according to specific task requirements.