Path generation method and device
By using polynomial curves and loss function optimization methods in autonomous driving technology, smooth paths through reference points are generated, and the problems of high-order derivative discontinuity and low generation efficiency in the prior art are solved, thereby improving driving comfort and safety.
Patent Information
- Application Number
- CN202411822759.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-03-28
AI Technical Summary
In the existing autonomous driving technology, the high-order derivatives of the path generated by path planning are discontinuous, resulting in insufficient path smoothness, affecting driving comfort and safety, and at the same time, the path generation efficiency is low.
By determining multiple reference points in the work scenario, building multiple polynomial curves, and building a loss function based on these curves, adjusting the coefficients of the polynomial curve by optimizing the loss function, generating a smooth target path through the reference point.
The high-order smoothness of the path is improved, which reduces vibration and stress during equipment movement, improves the comfort and safety of movement, and significantly improves the efficiency of path generation.
Smart Images

Figure CN119714324A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of autonomous driving technology, and in particular to a method and device for generating a path. Background Art
[0002] Currently, in the autonomous driving industry, path planning usually relies on sampling or searching to generate one or more front-end paths, and then uses these paths as references to smooth them using optimization or curve fitting techniques, or manually draws them when generating the center line of the road or the guide line of the working area for the driverless vehicle. However, the path generated in this way may not be continuous enough in high-order derivatives, resulting in insufficient smoothness of the path, affecting driving comfort and safety, and as the path length increases, the computing resources and time required to obtain the ideal path will also increase sharply.
[0003] Currently, no effective solution has been proposed for the above-mentioned problems of poor high-order path smoothness and low path generation efficiency. Summary of the invention
[0004] The embodiments of the present invention provide a method and device for generating a path, so as to at least solve the technical problems of poor high-order smoothness of the path and low efficiency of path generation.
[0005] According to one aspect of an embodiment of the present invention, a path generation method is provided, comprising: determining a plurality of reference points in a work scene, wherein the plurality of reference points are used to represent key positions of path planning; constructing a plurality of polynomial curves based on the plurality of reference points, wherein the constraint conditions of each polynomial curve include at least the position and / or speed of the curve endpoints, and the plurality of polynomial curves are connected end to end; constructing a loss function based on the plurality of polynomial curves, wherein the loss function is used to evaluate the smoothness of an initial path formed by the plurality of polynomial curves, and the degree of proximity between the initial path and the plurality of reference points; determining a target coefficient set of the plurality of polynomial curves based on the loss function, wherein the target coefficient set includes coefficients that minimize the function value of the loss function; adjusting the initial path based on the target coefficient set and the plurality of polynomial curves to obtain a target path, wherein the target path is a smooth path passing through a plurality of reference points.
[0006] Optionally, based on multiple reference points, multiple polynomial curves are constructed, including: starting from the starting position of the multiple reference points, dividing at least two consecutive reference points into a reference point set to obtain multiple reference point sets; generating a polynomial curve based on the reference points in each reference point set to obtain multiple polynomial curves.
[0007] Optionally, a loss function is constructed based on multiple polynomial curves, including: obtaining derivatives of each order corresponding to the multiple polynomial curves respectively; constructing a smoothness matrix based on the integration of the square of each order derivative with respect to the independent variable, wherein the smoothness matrix is used to quantify the smoothness of an initial path formed by the multiple polynomial curves; constructing a similarity matrix based on the distance error between the initial path formed by the multiple polynomial curves and multiple reference points, wherein the similarity matrix is used to quantify the proximity between the initial path and the multiple reference points; and constructing a loss function based on the smoothness matrix and the similarity matrix.
[0008] Optionally, a loss function is constructed based on a smoothness matrix and a similarity matrix, including: determining the smoothness of an initial path composed of multiple polynomial curves at multiple reference points based on the smoothness matrix; determining the distance between the initial path composed of multiple polynomial curves and multiple reference points based on the similarity matrix; and summing the smoothness of the initial path composed of multiple polynomial curves at multiple reference points and the distance between the initial path composed of multiple polynomial curves and multiple reference points to obtain a loss function.
[0009] Optionally, based on the loss function, a target coefficient set of multiple polynomial curves is determined, including: differentiating the coefficients of the loss function with respect to the polynomial curves to determine a coefficient combination that minimizes the function value of the loss function; and determining the coefficient combination as the target coefficient set.
[0010] Optionally, based on the target coefficient set and multiple polynomial curves, the initial path is adjusted to obtain the target path, including: adjusting the multiple polynomial curves based on the coefficients included in the target coefficient set; adjusting the initial path based on the adjusted multiple polynomial curves to obtain the target path.
[0011] Optionally, in two adjacent adjusted polynomial curves, the speed at the end point of the first polynomial curve is the same as the speed at the starting point of the second polynomial curve.
[0012] Optionally, the path generation method also includes: in response to two adjacent polynomial curves representing a reversing section and a non-reversing section respectively, taking the speed at the connection point of the reversing section and the non-reversing section as a minimum value, wherein the polynomial curve corresponding to the reversing section is in the opposite direction to the polynomial curve corresponding to the non-reversing section.
[0013] Optionally, the starting position of the polynomial curve corresponding to the reversing section is the same as the ending position of the polynomial curve corresponding to the non-reversing section, and the speed and acceleration at the starting position of the polynomial curve corresponding to the reversing section are zero.
[0014] According to another aspect of an embodiment of the present invention, a path generation device is also provided. The device includes: a determination unit, which is used to determine multiple reference points in a work scene, wherein the multiple reference points are used to represent key positions for path planning; a first construction unit, which is used to construct multiple polynomial curves based on the multiple reference points, wherein the constraint conditions of each polynomial curve at least include the position and / or speed of the curve endpoint, and the multiple polynomial curves are connected end to end; a second construction unit, which is used to construct a loss function based on the multiple polynomial curves, wherein the loss function is used to evaluate the smoothness of the initial path composed of the multiple polynomial curves, and the degree of proximity between the initial path and the multiple reference points; a second determination unit, which is used to determine the target coefficient set of the multiple polynomial curves based on the loss function, wherein the target coefficient set includes the coefficients that minimize the function value of the loss function; an adjustment unit, which is used to adjust the initial path based on the target coefficient set and the multiple polynomial curves to obtain a target path, wherein the target path is a smooth path passing through multiple reference points.
[0015] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, comprising: a memory storing an executable program; and a processor for running the program, wherein the method in each embodiment of the present invention is executed when the program is running.
[0016] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium includes a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the methods in various embodiments of the present invention.
[0017] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the method in each embodiment of the present invention is implemented.
[0018] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method in each embodiment of the present invention is implemented.
[0019] According to another aspect of the embodiments of the present invention, a computer program is further provided. When the computer program is executed by a processor, the methods in the embodiments of the present invention are implemented.
[0020] In an embodiment of the present invention, a plurality of reference points are determined in an operation scene, wherein the plurality of reference points are used to represent key positions of path planning; based on the plurality of reference points, a plurality of polynomial curves are constructed, wherein the constraint conditions of each polynomial curve include at least the position and / or speed of the curve endpoints, and the plurality of polynomial curves are connected end to end; based on the plurality of polynomial curves, a loss function is constructed, wherein the loss function is used to evaluate the smoothness of an initial path formed by the plurality of polynomial curves, and the degree of proximity between the initial path and the plurality of reference points; based on the loss function, a target coefficient set of the plurality of polynomial curves is determined, wherein the target coefficient set includes coefficients that minimize the function value of the loss function; based on the target coefficient set and the plurality of polynomial curves, the initial path is adjusted to obtain a target path, wherein the target path is a smooth path passing through a plurality of reference points. That is to say, in an embodiment of the present invention, after determining multiple reference points, a high-order polynomial curve can be constructed based on the reference points, and then a loss function can be constructed through the polynomial curve. By solving the minimum value of the loss function, the optimal solution of the polynomial curve is determined, so that the path composed of multiple polynomial curves is not only smooth, but also can reduce the vibration and stress during the movement of the equipment and improve the comfort and safety of the movement. It can also accurately pass through or approach the pre-set reference points to ensure that the key operation points of the task are executed. By solving the loss function to determine the optimal solution of the high-order polynomial coefficients, the path planning problem is converted into a mathematical problem, which significantly improves the path generation efficiency, thereby solving the technical problems of poor high-order smoothness and low generation efficiency of the path. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0022] Figure 1 is a flow chart of a method for generating a path according to an embodiment of the present invention;
[0023] Figure 2 is a schematic diagram of a polynomial curve according to an embodiment of the present invention;
[0024] Figure 3 is a schematic diagram of a reversing section and a non-reversing section according to an embodiment of the present invention;
[0025] Figure 4 is a schematic diagram of an optional path generation device according to an embodiment of the present invention; DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] Example 1
[0029] According to an embodiment of the present invention, a method embodiment for generating a path is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0030] Figure 1 is a method for generating a path according to an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:
[0031] Step S101, determining a plurality of reference points in a work scene.
[0032] In the technical solution provided in the above step S101 of the present application, multiple reference points are used to represent key positions of path planning, such as the starting point, the end point, and the intermediate points that the path must pass through, and the multiple reference points define the basic direction of the path.
[0033] In this embodiment, in path planning, multiple reference points are usually determined in the work scene based on the characteristics of the work scene and the task requirements. The reference points are often selected at key turning points on the path, near obstacles, at the target point or the starting point.
[0034] Optionally, reference points on the path can also be obtained by random or systematic sampling, and these reference points are used to guide the generation of the path, which is particularly common in search or sampling algorithms.
[0035] In this step, the purpose of selecting reference points is to guide the path planning algorithm so that the generated path can meet specific constraints while ensuring the smoothness and feasibility of the path.
[0036] Step S102: construct multiple polynomial curves based on multiple reference points.
[0037] In the technical solution provided in the above step S102 of the present application, the constraint conditions of the multiple polynomial curves at least include the position and / or speed of the curve endpoints, and the multiple polynomial curves are connected end to end.
[0038] In this embodiment, after selecting a plurality of reference points, a plurality of first-order connected polynomial curves are constructed according to the plurality of reference points, wherein the plurality of polynomial curves are respectively represented by a plurality of high-order functions.
[0039] For example, multiple reference points are divided into multiple reference point sets, where the path corresponding to the reference points in each reference point set can be represented by a polynomial curve. For example, a curve is formed from P_1 to P_2, and the next curve is formed from P_2 to P_3, and so on, until P_{n-1} to P_n. The length of each curve can be adjusted according to the distance between the reference points and the expected path details.
[0040] Optionally, for each polynomial curve, define constraints on the position, velocity, acceleration, etc. of its endpoints. The positions of the endpoints must match the coordinates of the corresponding reference points, while velocity and acceleration constraints ensure the continuity and dynamic feasibility of the path.
[0041] Optionally, as a high-order curve, the advantage of the quintic polynomial curve over a low-order curve, such as a cubic polynomial curve, is the continuity of its curvature and curvature change. At the same time, the quintic polynomial has a higher degree of freedom. Further increasing the order of the curve will increase the complexity of the solution on the one hand, and the benefit is not significant on the other hand, and the curve may be over-fitted. Based on this, the quintic polynomial is used to construct multiple polynomial curves.
[0042] Optionally, in order to ensure that the constructed multiple polynomial curves can maintain continuity at the connection point, the end position of each polynomial curve in the multiple polynomial curves completely overlaps with the starting position of the next polynomial curve, and the speed is kept continuous, so that the multiple polynomial curves are connected end to end to form a complete path (initial path). This end-to-end connection feature not only ensures the coherence and integrity of the path, but also makes the entire path consistent and continuous, so that it is smoother and more natural in physical implementation.
[0043] Optionally, the polynomial coefficients may be adjusted so that the curve fits the reference point as closely as possible while maintaining the smoothness and dynamic characteristics of the curve.
[0044] Through this step, multiple polynomial curves connected end to end can be constructed based on multiple reference points. These curves together constitute a continuous and smooth path, which not only meets the geometric requirements of the planned path, but also takes into account the dynamic constraints, providing a mathematical model basis for subsequent path optimization and solution.
[0045] Step S103, constructing a loss function based on multiple polynomial curves.
[0046] In the technical solution provided in the above step S103 of the present application, the loss function is used to evaluate the smoothness of the initial path composed of multiple polynomial curves, and the proximity between the initial path and multiple reference points. The purpose of constructing the loss function based on multiple polynomial curves is to quantify the smoothness of the path and the proximity between the smooth path and the reference point, so as to find the set of polynomial curves that are closest to the reference point while maintaining the smoothness of the path.
[0047] In this embodiment, the smoothness of the path is usually evaluated by calculating the sum of squares of derivatives of each order of the polynomial curve. For example, the smoothness of the curve is measured by calculating the integral of the square of the first-order derivative of the quintic polynomial curve with respect to time, and generalizing to the square integral of the n-order derivative. The calculation result of this integral reflects the drastic degree of change of the curve in a given time interval. The smaller the integral value, the smoother the path.
[0048] Optionally, the closeness of the path to the reference point can be measured by the distance from the initial path formed by the polynomial curve to the reference point. This involves constructing a similarity matrix, the elements of which reflect the distance between the initial path formed by multiple polynomial curves and each reference point. The goal of constructing the similarity matrix is to make the initial path as close to the reference point as possible.
[0049] Optionally, the loss function combines the smoothness and the proximity of the initial path to the reference point in the form of a weighted sum, wherein the weights of the smoothness and the proximity of the initial path to the reference point can be controlled by adjusting the correlation coefficient in the loss function to achieve a comprehensive optimal path.
[0050] For example, the loss function can be expressed by the following formula:
[0051]
[0052] Among them, f is used to represent the loss function, Smooth i Used to indicate the smoothness of the initial path at the i-th reference point, ReferenceDiatance i It is used to represent the distance between the initial path and the i-th reference point, and i is used to represent the i-th reference point.
[0053] Optionally, the optimal path can be determined by solving the minimum value of the loss function. For example, by using a calculation method of taking the derivative of the loss function with respect to the polynomial coefficients and setting the derivative to zero, a set of polynomial coefficients can be found so that the loss function reaches the minimum value, thereby obtaining a path curve that is both smooth and passes through the reference point as much as possible.
[0054] Optionally, the construction and solution of the loss function involves matrix operations, including the construction of a similarity matrix and a smoothness matrix, and determining the polynomial coefficients of the optimal path by solving matrix equations. Through matrix expression, complex path optimization problems can be transformed into mathematically tractable linear algebra problems, thereby simplifying the calculation process and improving the solution efficiency.
[0055] Through this step, the loss function construction and optimization process based on multiple polynomial curves can ensure that the generated path is both smooth and accurately reflects the requirements of the reference points.
[0056] Step S104: determining a target coefficient set of multiple polynomial curves based on the loss function.
[0057] In the technical solution provided in the above step S104 of the present application, the target coefficient set includes coefficients that minimize the function value of the loss function.
[0058] In this embodiment, the goal of determining a target set of coefficients for multiple polynomial curves based on the loss function is to find a set of coefficients that minimizes the loss function, thereby generating a path that is both smooth and fits the reference point as closely as possible.
[0059] Optionally, a loss function is a mathematical expression that measures the difference between a path and a desired standard. The loss function contains two important components: the smoothness of the path and the similarity of the path to the reference points. Smoothness is represented by the integral of the squares of the higher-order derivatives of multiple polynomial curves, which aims to minimize the curvature of the path to ensure the smoothness of the path. Similarity quantifies the distance error between the path and the reference points to ensure that the path is close to these key locations and meets the task requirements.
[0060] Optionally, since each polynomial curve corresponds to a polynomial function, the coefficients in the polynomial function determine the shape and position of the curve. By constructing a loss function, the problem of finding the optimal path can be transformed into the problem of finding a set of optimal coefficients.
[0061] Optionally, in order to find the optimal set of coefficients, the loss function needs to be differentiated. The goal of the derivation is to find the gradient of the loss function, that is, the rate of change of the loss function for each coefficient, which involves differentiating the loss function and setting it equal to zero.
[0062] Optionally, the target coefficient set includes the optimal coefficients of all polynomial curves. Taking the quintic polynomial as an example, each quintic polynomial includes 6 coefficients, and the target coefficient set will include the optimal solutions of all these coefficients to ensure that the final generated path is optimal, that is, the generated path satisfies both high smoothness and proximity to the reference point.
[0063] Optionally, when solving the optimal coefficients, it is necessary to iterate the solution until a set of coefficients is found that prevents the loss function value from further decreasing. This set of coefficients will be used to determine the shape of each polynomial curve, thereby generating the final path.
[0064] Through this step, a set of target coefficients can be efficiently determined to generate a path that is both smooth and complies with the reference point constraints.
[0065] Step S105: Based on the target coefficient set and multiple polynomial curves, the initial path is adjusted to obtain the target path.
[0066] In the technical solution provided in the above step S105 of the present application, it can be seen from the above step S104 that the target coefficient set includes a set of coefficients that minimize the function value of the loss function. This set of coefficients contains detailed parameters of each polynomial curve. According to the coefficients included in the target coefficient set, the initial multiple polynomial curves are adjusted to achieve the purpose of adjusting the initial path composed of the multiple polynomial curves, and then the adjusted path is used as the target path, which can make the target path meet the approximation requirements of the reference point and maintain the high-order smoothness of the path.
[0067] Optionally, as can be seen from the above introduction, the initial path is composed of multiple quintic polynomial curves connected end to end, and each curve is constrained by the position and speed of its endpoints. After the target coefficient set is determined, the shape and position of each curve will be adjusted according to these coefficients. These adjusted curves are connected end to end to form the optimized initial path, that is, the target path.
[0068] Optionally, each polynomial curve can be adjusted by the coefficients included in the target coefficient set to ensure that each polynomial curve can meet the given constraints and optimization goals. This process may need to be iterative, that is, after obtaining a set of target coefficients, evaluate whether the generated path meets the requirements of smoothness and proximity to the reference point. If not, optimize the weight of the loss function and solve the target coefficient set again until the path is optimized to a satisfactory degree.
[0069] Optionally, after repeated adjustment and optimization of the above steps, the final path is the target path. This path not only mathematically fits the reference point as closely as possible, but also physically ensures smoothness, reduces vibration and energy consumption during movement, and improves the safety and efficiency of automated equipment such as self-driving vehicles, drones or robots when performing tasks.
[0070] Optionally, during the process of path adjustment and optimization, special consideration is given to paths containing reverse segments and large-scale path planning. The processing of reverse segments requires special design of the conversion matrix to ensure the consistency of speed direction at the switching point between reverse and forward modes. In large-scale path planning, by reasonably constructing and solving the smoothness matrix and similarity matrix, the computational efficiency can be significantly improved, making path optimization still efficient and feasible in the case of long distances and large-scale reference points.
[0071] Alternatively, the polynomial curve-based path optimization method can effectively generate a target path that takes into account both work efficiency and physical smoothness. This method has demonstrated its superiority in large-scale path planning problems in autonomous driving, robot navigation, and complex environments, and provides a strong mathematical foundation for motion control of automated equipment.
[0072] In the above steps S101 to S105, after multiple reference points are determined, a high-order polynomial curve can be constructed based on the reference points, and then a loss function can be constructed through the polynomial curve. The optimal solution of the polynomial curve is determined by solving the minimum value of the loss function, so that the path composed of multiple polynomial curves is not only smooth, but also can reduce the vibration and stress in the movement of the equipment and improve the comfort and safety of the movement, and can accurately pass through or approach the pre-set reference points to ensure that the key operation points of the task are executed. The optimal solution of the high-order polynomial coefficients is determined by solving the loss function, which realizes the conversion of the path planning problem into a mathematical problem, significantly improves the path generation efficiency, and solves the technical problems of poor high-order smoothness and low generation efficiency of the path.
[0073] Next, the method for generating the path is further introduced.
[0074] As an optional implementation, step S102, constructing multiple polynomial curves based on multiple reference points, includes: starting from the starting positions of the multiple reference points, dividing at least two consecutive reference points into a reference point set to obtain multiple reference point sets; generating a polynomial curve based on the reference points in each reference point set to obtain multiple polynomial curves.
[0075] In this embodiment, after determining multiple reference points, the positions of the multiple reference points can be determined, and then starting from the starting positions of the multiple reference points, at least two consecutive reference points can be divided into a reference point set, thereby obtaining multiple reference point sets, wherein a reference point set may include at least two consecutive reference points or include multiple consecutive reference points, and no specific restrictions are made here.
[0076] For example, starting from the starting positions of the multiple reference points, every two adjacent reference points can be divided into a reference point set, thereby obtaining multiple reference point sets.
[0077] Optionally, if the number of reference points is large, multiple continuous reference points may be divided into a reference point set. For example, starting from the starting position of the multiple reference points, three continuous reference points may be divided into a reference point set, or starting from the starting position of the multiple reference points, four continuous reference points may be divided into a reference point set. This is only an illustrative example, and the number of reference points divided into a reference point set may be adjusted according to actual conditions, and is not specifically limited here.
[0078] Optionally, Figure 2 is a schematic diagram of a polynomial curve according to an embodiment of the present invention, such as Figure 2 As shown, the path generated based on the quintic polynomial curve has a higher degree of fit with the reference point.
[0079] As an optional implementation, step S103 constructs a loss function based on multiple polynomial curves, including: obtaining derivatives of each order corresponding to the multiple polynomial curves; constructing a smoothness matrix based on the integration of the square of each order derivative with respect to the independent variable, wherein the smoothness matrix is used to quantify the smoothness of the initial path formed by the multiple polynomial curves; constructing a similarity matrix based on the distance error between the initial path formed by the multiple polynomial curves and multiple reference points, wherein the similarity matrix is used to quantify the proximity between the initial path and the multiple reference points; and constructing a loss function based on the smoothness matrix and the similarity matrix.
[0080] In this embodiment, the loss function combines the path smoothness and the fit between the path and the reference point, wherein the smoothness can be determined by a smoothness matrix and the fit between the path and the reference point can be determined by a similarity matrix.
[0081] Optionally, when determining the smoothness matrix, derivatives of various orders corresponding to a plurality of polynomial curves may be obtained first, and then a smoothness matrix may be constructed according to the integral of the square of each order derivative with respect to the independent variable.
[0082] For example, based on the equation of each polynomial curve, its first-order, second-order and even higher-order derivatives are calculated. The derivative reflects the change in the slope of the curve. For path planning, the calculation of the derivative can provide motion information such as speed and acceleration at any point on the path, which is the basis for evaluating the smoothness of the path.
[0083] Optionally, the smoothness matrix is constructed by calculating the integral of the square of each derivative on each polynomial curve with respect to the independent variable. For example, for each curve, the square of its first-order derivative, second-order derivative, etc. is calculated, and then the square value is integrated, and the range of integration is usually the defined interval of the curve (such as the range of time t). The result of the integration reflects the degree of curvature of the curve in the interval. The smaller the value, the smoother the curve. The integration results of all curves are arranged in a matrix form to obtain a smoothness matrix.
[0084] Optionally, a similarity matrix is used to quantify the proximity between the initial path of multiple polynomial curves and multiple reference points. The matrix is constructed based on the distance error between each point on the path and the reference points. For each pair of points on the curve and the reference point, the distance difference between the two is calculated and the squared difference is placed in the matrix. The squared distance difference helps to highlight the path points that deviate greatly from the reference points, ensuring that the optimization algorithm prioritizes these points when correcting the path. The smaller the value of the element in the matrix, the closer the path matches the reference point.
[0085] Optionally, after calculating the smoothness matrix and the similarity matrix, a loss function can be constructed based on the smoothness matrix and the similarity matrix. The loss function contains two main parts: one is the measure of the path smoothness, that is, the value of the smoothness matrix; the other is the closeness of the path to the reference point, that is, the value of the similarity matrix. By calculating the minimum function value of the loss function, an optimal set of polynomial coefficients can be found so that the constructed path can achieve the optimal smoothness and closeness while satisfying continuity and passing through the reference point.
[0086] As an optional implementation, a loss function is constructed based on a smoothness matrix and a similarity matrix, including: determining the smoothness of an initial path composed of multiple polynomial curves at multiple reference points based on the smoothness matrix; determining the distance between the initial path composed of multiple polynomial curves and multiple reference points based on the similarity matrix; summing the smoothness of the initial path composed of multiple polynomial curves at multiple reference points and the distance between the initial path composed of multiple polynomial curves and multiple reference points to obtain a loss function.
[0087] In this embodiment, the smoothness matrix quantifies the smoothness of the path, and is composed of the integral of the square of each order derivative of the curve over time. For an initial path composed of multiple polynomial curves, this matrix reflects the change of the path over the time (t) interval, and the smaller its value, the smoother the path. This matrix is obtained by calculating the integral of the square of the first-order derivative and generalizing it to the integral of higher-order derivatives.
[0088] Optionally, a similarity matrix measures how close the path is to a given reference point. The similarity matrix can be constructed based on the actual distance difference between the path curve and the reference point at each reference point. These differences are squared to emphasize the impact of large distance errors, and then summed to obtain the overall similarity. The similarity matrix is designed to ensure that the path curve not only matches the reference point in position when passing through the reference point, but also matches the speed and acceleration as much as possible, thereby achieving high-precision path tracking.
[0089] Optionally, after determining the smoothness matrix, the smoothness of the initial path composed of multiple polynomial curves at multiple reference points can be determined according to the smoothness matrix, wherein the smoothness of the initial path at each reference point is used to measure the smoothness of the initial path at the reference point.
[0090] Optionally, after the similarity matrix is determined, the distance between the initial path formed by the multiple polynomial curves and the reference points at multiple reference points may be determined according to the similarity matrix, wherein the distance may represent the degree of fit between the initial path and the reference points.
[0091] Optionally, after determining the smoothness of the initial path formed by multiple polynomial curves at multiple reference points and the distances between the initial path formed by multiple polynomial curves and the reference points at multiple reference points, the loss function can be constructed by the following formula.
[0092]
[0093] Among them, f is used to represent the loss function, Smooth i Used to indicate the smoothness of the initial path at the i-th reference point, ReferenceDiatance i Used to represent the distance between the initial path and the i-th reference point.
[0094] Optionally, the loss function is calculated by summing the smoothness of the initial path composed of multiple polynomial curves at each reference point and the distance between the initial path and each reference point, and then by solving the minimum value of this loss function, the optimal set of polynomial coefficients that makes the path smooth and fits the reference points as closely as possible can be found.
[0095] Optionally, after determining the optimal set of coefficients, each polynomial curve is adjusted according to these coefficients to generate a final target path. This path is mathematically the optimal smooth path based on the reference point, which can meet the requirements of high-order path smoothness and close tracking of the reference point.
[0096] As an optional implementation, step S104, based on the loss function, determines the target coefficient set of multiple polynomial curves, including: differentiating the coefficients of the loss function with respect to the polynomial curves, determining the coefficient combination that minimizes the function value of the loss function; and determining the coefficient combination as the target coefficient set.
[0097] In this embodiment, as can be seen from the above introduction, the loss function consists of two parts: path smoothness and distance error between the path and the reference point. In order to find the coefficient set that minimizes the loss function value, it is necessary to differentiate the loss function with respect to the polynomial coefficients, and then determine the polynomial coefficient combination that minimizes the function value of the loss function.
[0098] Optionally, the polynomial coefficients when the derivative of the polynomial coefficients is zero may be combined to determine the target coefficient set.
[0099] Optionally, after obtaining the target coefficient set, these coefficients are converted into actual polynomial curve equations through a conversion matrix to generate a smooth path. The conversion matrix is used to ensure the continuity of the curve at the endpoints, and the curve coefficients are indirectly expressed by controlling the derivative values of the curve endpoints to ensure the continuity and controllability of the path at the connection points.
[0100] As an optional implementation, step S105, based on the target coefficient set and multiple polynomial curves, adjusts the initial path to obtain the target path, including: adjusting the multiple polynomial curves based on the coefficients included in the target coefficient set; adjusting the initial path based on the adjusted multiple polynomial curves to obtain the target path.
[0101] In this embodiment, after obtaining the target coefficient set, each polynomial curve can be adjusted according to the coefficients in the target coefficient set. That is, the shape and position of each polynomial curve will be updated according to the corresponding optimal coefficient to reflect the optimized path.
[0102] Optionally, the target coefficient set may be converted into specific parameters of the polynomial curve by applying a coefficient conversion matrix, thereby ensuring the continuity and high-order smoothness of the curve at the connection points.
[0103] Optionally, the adjusted polynomial curve will be used to reconstruct the entire path. Since each curve has been optimized according to the target coefficient, the entire path will show better smoothness and more accurate reference point fit after the curve is re-adjusted. This process is essentially an iterative improvement of the initial path until the set optimization goal is met.
[0104] Optionally, when all polynomial curves are adjusted according to the target coefficient set and the entire path is optimized, the final target path will be a path that is both smooth and closely follows the reference point. This path is the result of mathematical optimization, which not only reduces unnecessary bends in the path, but also ensures the continuity and high-order smoothness of the path when passing through the reference point, improving the movement efficiency and safety of automated equipment such as self-driving cars, drones or robots.
[0105] Optionally, in the process of adjusting the path, it is also particularly emphasized that for a path including a reversing section, special processing of the speed and acceleration is required at the connection point between the reversing section and the non-reversing section to ensure the continuity and rationality of the path at these key points.
[0106] Optionally, by determining a target coefficient set and adjusting the polynomial curve based on these coefficients, the initial path can be effectively optimized, and finally a target path that is smooth and meets the reference point alignment requirements is obtained.
[0107] As an optional implementation, the path generation method also includes: in response to two adjacent polynomial curves representing a reversing section and a non-reversing section respectively, taking the speed at the connection point of the reversing section and the non-reversing section as a minimum value, wherein the polynomial curve corresponding to the reversing section is in the opposite direction to the polynomial curve corresponding to the non-reversing section.
[0108] In this embodiment, in path planning, when two adjacent polynomial curves represent a reversing section and a non-reversing section respectively, since the directions of the speed and acceleration are opposite when reversing and moving forward, direct connection may cause unreasonable motion states of the path at that point, such as sudden acceleration or deceleration, which not only affects smoothness but may also violate physical constraints. Therefore, the continuity and directionality of the reversing section and the non-reversing section at the connection point need special processing.
[0109] Optionally, the directions of the polynomial curves corresponding to the reversing section and the non-reversing section are opposite at the connection point. This means that in a two-dimensional coordinate system, the first-order derivative (i.e., velocity vector) of the curve of the reversing section at the connection point and the first-order derivative of the curve of the non-reversing section at the connection point are the same in value but opposite in direction. This feature is crucial to ensure the continuity and rationality of the path when switching between reversing and forward.
[0110] Optionally, by setting the speed at the connection point to a minimum value and adjusting the curve in the opposite direction, a smooth transition between the reversing and non-reversing sections at the reversing point is ensured. This not only improves the aesthetics and continuity of the path, but also ensures the safety and rationality of the robot or vehicle when switching between reversing and forward, avoiding potential risks caused by discontinuity or unreasonable direction changes.
[0111] As an optional implementation, the starting position of the polynomial curve corresponding to the reversing section is the same as the ending position of the polynomial curve corresponding to the non-reversing section, and the speed and acceleration at the starting position of the polynomial curve corresponding to the reversing section are zero.
[0112] In this embodiment, when processing a path planning including a reversing operation, the connection between the reversing section and the non-reversing section is the key to ensuring the smoothness and continuity of the entire path. The starting point of the polynomial curve corresponding to the reversing section must be the same as the end point of the polynomial curve corresponding to the non-reversing section, and at the starting point of the reversing section, the speed and acceleration should be zero. This ensures the continuity and consistency of the path, avoids discontinuity or sudden acceleration and deceleration when switching between reversing and forward states, and is crucial for the safe and stable operation of automated equipment (such as self-driving cars and robots).
[0113] Optionally, at the moment of reversing, the automated device should be completely still, that is, the speed and acceleration should be zero. This is because if the device still maintains a non-zero speed or acceleration when reversing starts, it may cause a sudden acceleration or deceleration of the device, which is not only detrimental to the device itself, but also may pose a safety hazard to the surrounding environment and other traffic participants. Therefore, by adjusting the endpoint derivatives (i.e., speed and acceleration) of the polynomial curve to zero, it is achieved to ensure that the device can smoothly transition when reversing starts, avoiding unnecessary dynamic shocks.
[0114] Through this step, the path planning problem involving reversing operations can be effectively handled, and a path that meets actual driving needs (such as reversing into a warehouse) while maintaining a high degree of smoothness and continuity can be generated, which is of great significance for improving the safety and reliability of automated equipment in complex environments. By controlling the speed and acceleration at the connection point to zero and ensuring the continuity of the position, discontinuities in path planning can be avoided, thereby reducing the bumps and shocks that the equipment may encounter when executing the path, ensuring the smooth operation of the equipment.
[0115] The technical solution of the embodiment of the present invention is illustrated below in conjunction with preferred implementation modes.
[0116] The embodiment of the present invention provides a path generation method, which uses a quintic polynomial curve to construct a path that fits a given reference point and maintains a high degree of smoothness. By mathematically abstracting and optimizing the path generation problem, the similarity between the path and the reference point and the smoothness of the path itself are integrated into a loss function, and the optimal path is solved by controlling the function to reach a minimum value. By constructing a similarity matrix and a smoothness matrix, it can be ensured that the generated path is as close to the reference point as possible while maintaining high-order continuity, thereby achieving the controllability and predictability of the path shape. Secondly, through matrix decomposition and transformation, the complex path optimization problem is transformed into a series of highly repeatable and computable sub-problems, which greatly improves the calculation efficiency and solution speed, especially when processing a path containing a reversing section, it can ensure directional consistency while avoiding the problem of overfitting and a surge in calculation complexity. Finally, the consistency of the matrix is used to avoid repeated calculations, and the large matrix is decomposed to reduce the complexity of the inversion, so that the solution of the path optimization problem is no longer limited to the path length, and the efficiency and large-scale processing capability of path planning are achieved.
[0117] Optionally, the advantage of a quintic polynomial curve as a high-order curve over a low-order curve (such as a cubic polynomial curve) is the continuity of its curvature and curvature change. At the same time, the quintic polynomial has a higher degree of freedom. Further increasing the order of the curve will increase the complexity of the solution on the one hand, and the benefits are not significant on the other hand. Among them, a one-dimensional quintic polynomial curve can be expressed by the following formula:
[0118]
[0119] The derivatives of each order corresponding to the above formula can be expressed as:
[0120]
[0121] in, are the coefficients of the polynomial curve, [t 0 t 1 t 2 t 3 t 4 t 5 ] is the independent variable corresponding to the coefficients of each order of the polynomial curve. Generally, time can be selected as the independent variable.
[0122] Optionally, in the smooth part of the loss function, it is necessary to calculate the integral of the square of each order derivative of the curve with respect to the independent variable of the curve, wherein the integral of the first order derivative with respect to the independent variable t can be expressed by the following formula.
[0123]
[0124] Optionally, after further transforming the above formula, the obtained formula is expressed as:
[0125]
[0126] Among them, in the above formula, the P matrix is the polynomial coefficient vector, and is the value to be determined. The above calculation method is further generalized to obtain the integral of higher-order derivatives with respect to t.
[0127] Optionally, the element in the i-th row and j-th column of the square integral Q matrix of the n-th order derivative of the quintic polynomial curve may be calculated by the following formula.
[0128]
[0129] Optionally, the similarity matrix in the loss function can be solved by the following formula.
[0130]
[0131] Among them, ((x i ,y i )) is the coordinate of a reference point corresponding to the polynomial curve, which can be one or more. Here, one reference point is taken as an example, and the matrix expression is as follows.
[0132]
[0133] Among them, the last term is irrelevant to the variable to be solved and does not affect the optimization problem. It is discarded. Then the similarity matrix can be decomposed into a quadratic matrix and a linear matrix, expressed as: f = X T QX+GX.
[0134] Among them, the smooth matrix Similarity Matrix
[0135] Alternatively, if the variable to be solved is the coefficient vector [abcdef] of the polynomial, when the t order is too large and the t value itself is small or large, the matrix is prone to be singular. It is necessary to convert the coefficient vector of the above polynomial into numerical constraints at the two end points, that is, to indirectly express the coefficients of the curve by constraining the derivative values of each order at the end points of the polynomial curve.
[0136] For example, for a 5th order polynomial curve, there are 6 variables to be solved. Then the 0th, 1st, and 2nd order derivatives of the starting point and endpoint of the curve need to be calculated using the following formula to express the coefficients of the polynomial.
[0137]
[0138] Optionally, the coefficients of the polynomial are solved by taking derivatives of various orders at the starting point and the end point of the curve. This can directly restrict the posture of the starting point and the end point. At the same time, the state of the same point is used to represent the posture of the two previous and next polynomial curves at the same point, which can directly ensure the continuity of the separated quintic polynomial curve at the connection point.
[0139] Optionally, continuity is applied to the concatenation of different polynomial curves. For example, when the derivatives of each order at the end point of the previous polynomial curve are equal to the derivatives of each order at the starting point of the next polynomial curve, the two curves are continuous.
[0140] For example, assuming that the derivatives of each stage of the polynomial are represented by x, v, and a, the derivatives of each order of the i-th polynomial curve and the i+1-th polynomial curve can be solved by the following formula.
[0141]
[0142] Optionally, the end point of the i-th curve and the starting point of the i+1-th curve calculated by the above formula have the same position velocity and acceleration, thereby ensuring the high-order continuity of each quintic polynomial curve at the connection point.
[0143] Optionally, taking two adjacent polynomial curves as an example, the two adjacent polynomial curves have three endpoints, and the variables to be solved are expressed as [x0 v0 a0 x0 v1 a1 x2 v2 a2]', which are the three endpoints of the two polynomial curves. Among them, the starting point and the end point are given points, and the middle connecting point is the point to be found. By determining the position and state of the middle point, the two quintic polynomial curves connecting the starting point and the end point are determined.
[0144] Alternatively, the two curves can be extended to four endpoints using the continuity matrix described below.
[0145]
[0146] Optionally, considering the separation of known values from variables to be solved, the above formula can be simplified with the help of the following conversion matrix.
[0147]
[0148] Alternatively, the simplified formula can be expressed as:
[0149]
[0150] Where [T] is the transformation matrix, is the variable vector to be solved. p ] is the starting and ending point information, [R R ] is the information vector of the other endpoints of each polynomial curve and is the actual variable to be solved.
[0151] Optionally, a coefficient conversion matrix may be used to convert the polynomial curve endpoint vector into a coefficient vector of the polynomial curve, which is expressed as the following formula.
[0152]
[0153] Optionally, the coefficient matrix Expressed as [M], it is substituted into the loss function for calculation.
[0154] Optionally, the second-order forms of the similarity and smoothness matrices can be combined into a Hessin matrix [Q], and the linear matrix of similarity can be written as a Gradient matrix [H]. The loss function can then be expressed as: Taking the derivative of the loss function and setting the derivative to zero, we can get [R R ].
[0155] Optionally, the loss function can be simplified and transformed to: The loss function can be derived by the following formula to obtain [R R ].
[0156]
[0157] Optionally, the variables to be optimized may be transformed through a transformation matrix to obtain corresponding polynomial coefficients.
[0158] Optionally, Figure 3 is a schematic diagram of a reversing section and a non-reversing section according to an embodiment of the present invention, such as Figure 3 As shown in the figure, when there is a reversing section in the path, the conversion matrix at the connection point of the reversing section and the non-reversing section needs special processing. The starting point of the reversing section and the end point of the non-reversing section have the same position, but the speed and acceleration are both zero. In order to control the consistency of the speed direction at the connection point, a minimum value can be given to the speed at this point. It should be noted that the directions of the quintic polynomial curves at both ends at this connection point are opposite, that is, the first-order derivatives of the two-dimensional are opposite to each other. The specific matrix expression is as follows:
[0159]
[0160] Optionally, when solving for large-scale paths, for the same quintic polynomial curve, its matrix expression is the same in any dimension, the only difference is that [R P ] is caused by the difference in the x and y values in the vector, which means that for a two-dimensional quintic polynomial, only one-dimensional matrices can be constructed, and then the xy directions can be solved separately without any difference from the original problem. This means that for matrices, the construction, inversion and solution operations can be reduced to half of the original size.
[0161] Optionally, when constructing the problem in practice, the range of the independent variable t of each quintic polynomial curve can be set to be the same, that is, all polynomial curves have the same t. This ensures that the transformation matrix from the endpoint state vector to the coefficient vector of each quintic polynomial curve is completely consistent, so the inversion of the transformation matrix only needs to be performed once. The familiarity matrices of each quintic polynomial curve have a high degree of similarity. The differences are caused by the reference point coordinates of each polynomial curve. The same matrix is retained and the similarity matrix can be quickly obtained by multiplying with different reference point coordinates. The smoothness matrix of each quintic polynomial matrix is completely consistent.
[0162] Optionally, in the composition of the loss function, [A PR ] does not require inversion, it can be quickly constructed through the consistency of the matrix expression of each quintic polynomial without calculation. R ] and [R P ] The matrix is constructed in different ways, [A PR] There are also inconsistencies in the way the matrix is constructed, but they can all be constructed by dividing the second-order matrix of a single quintic polynomial curve into blocks and filling them into [A PR ] in the matrix.
[0163] Optionally, for [A RR ] matrix, since the second-order components of the loss functions of each block matrix have a high degree of consistency, it can be as [A PR ] is the same as the direct assignment to avoid repeated calculations, and only the deformation at the reversal point needs to be paid attention to. However, in terms of inversion, there are different treatments for whether or not the reversal point is included.
[0164] Optionally, for the case where no reversal point is included, [A RR ] The matrix is calculated according to the vector to be solved With [R P ] The different constructions will present a diagonal matrix, or an upper and lower triangular matrix. The inversion of this type of matrix can be simplified to the inversion of the block matrix. In the description of this problem, the block matrices are the same matrix, and the inversion result of one block can be directly used in the inversion of all other block matrices. In this way, the inversion of the large matrix is simplified to the inversion of a very small matrix (6x6) plus the block assignment.
[0165] Optionally, for matrices containing commutation points, [A RR ] The matrix can be obtained by With [R P ] is converted to the following form:
[0166]
[0167] Alternatively, since the time of each curve is consistent, the abcd matrix block has only two possible reference points along the curve, while the efg matrix block has only four possible expressions, which can be constructed quickly. Similarly, performing LDL transpose decomposition (LDLT) on it can obtain the following form:
[0168] D=[a,be*a -1 [e…] asdiagonal
[0169]
[0170] but
[0171] Optionally, through the above operation, the complexity can be changed from O(n 3 ) is reduced to O(n 2), thus avoiding the direct construction and inversion of large matrices and decoupling the complexity of the problem to be solved from the length of the curve.
[0172] In an embodiment of the present invention, by fitting a quintic polynomial curve, the generated path has high-order smoothness, which effectively avoids mutations and discontinuities in the path, which is crucial in autonomous driving and robot path planning and helps to improve driving comfort and safety.
[0173] Furthermore, in the embodiment of the present invention, not only can each path be smoothed individually, but also complex trajectories including reversing segments can be processed. This method ensures the continuity and natural transition of the path when passing through the reference point, and maintains the high quality of the path even in complex driving environments.
[0174] Furthermore, in the embodiment of the present invention, by changing the problem description form, the large-scale path generation problem is decomposed into multiple sub-problems, and the high consistency of the matrix expression in the sub-problems is used to significantly improve the calculation speed. In addition, by avoiding the direct inversion of large matrices, the calculation complexity is reduced, so that the curve length can be longer and the number can be greater without affecting the generation efficiency.
[0175] According to an embodiment of the present invention, a path generation device is also provided. It should be noted that the path generation device can be used to execute the path generation method in the embodiment of the present invention.
[0176] Figure 4 4 is a schematic diagram of a path generation device according to an embodiment of the present invention. The path generation device 400 includes: a first determination unit 401, a first construction unit 402, a second construction unit 403, a second determination unit 404 and an adjustment unit 405.
[0177] The first determining unit 401 is used to determine a plurality of reference points in the operation scene, wherein the plurality of reference points are used to represent key positions for path planning.
[0178] The first construction unit 402 is used to construct multiple polynomial curves based on multiple reference points, wherein the constraint condition of each polynomial curve at least includes the position and / or speed of the curve endpoint, and the multiple polynomial curves are connected end to end.
[0179] The second construction unit 403 is used to construct a loss function based on the multiple polynomial curves, wherein the loss function is used to evaluate the smoothness of the initial path formed by the multiple polynomial curves and the proximity between the initial path and the multiple reference points.
[0180] The second determining unit 404 is used to determine a target coefficient set of multiple polynomial curves based on the loss function, wherein the target coefficient set includes coefficients that minimize the function value of the loss function.
[0181] The adjustment unit 405 is used to adjust the initial path based on the target coefficient set and the multiple polynomial curves to obtain a target path, wherein the target path is a smooth path passing through multiple reference points.
[0182] Optionally, the first construction unit 402 is further used to: starting from the starting positions of the multiple reference points, divide at least two consecutive reference points into a reference point set to obtain multiple reference point sets; generate a polynomial curve based on the reference points in each reference point set to obtain multiple polynomial curves.
[0183] Optionally, the second construction unit 403 is also used to: obtain derivatives of each order corresponding to multiple polynomial curves; construct a smoothness matrix based on the integration of the square of each order derivative with respect to the independent variable, wherein the smoothness matrix is used to quantify the smoothness of the initial path formed by the multiple polynomial curves; construct a similarity matrix based on the distance error between the initial path formed by the multiple polynomial curves and multiple reference points, wherein the similarity matrix is used to quantify the proximity between the initial path and the multiple reference points; and construct a loss function based on the smoothness matrix and the similarity matrix.
[0184] Optionally, the second construction unit 403 is also used to: determine the smoothness of the initial path composed of multiple polynomial curves at multiple reference points based on the smoothness matrix; determine the distance between the initial path composed of multiple polynomial curves and multiple reference points based on the similarity matrix; sum the smoothness of the initial path composed of multiple polynomial curves at multiple reference points and the distance between the initial path composed of multiple polynomial curves and multiple reference points to obtain a loss function.
[0185] Optionally, the second determining unit 404 is further used to: derive the coefficients of the loss function with respect to the polynomial curve to determine a coefficient combination that minimizes the function value of the loss function; and determine the coefficient combination as a target coefficient set.
[0186] Optionally, the adjustment unit 405 is further configured to: adjust a plurality of polynomial curves based on the coefficients included in the target coefficient set; and adjust the initial path based on the adjusted plurality of polynomial curves to obtain the target path.
[0187] Optionally, the path generating device 400 is also used for: in response to two adjacent polynomial curves representing a reversing section and a non-reversing section respectively, taking the speed at the connection point of the reversing section and the non-reversing section as a minimum value, wherein the polynomial curve corresponding to the reversing section is in the opposite direction to the polynomial curve corresponding to the non-reversing section.
[0188] In this device, after multiple reference points are determined, a high-order polynomial curve can be constructed based on the reference points, and then a loss function can be constructed through the polynomial curve. The optimal solution of the polynomial curve is determined by solving the minimum value of the loss function, so that the path composed of multiple polynomial curves is not only smooth, but also can reduce the vibration and stress in the movement of the equipment and improve the comfort and safety of the movement. It can also accurately pass through or approach the pre-set reference points to ensure that the key operation points of the task are executed. The optimal solution of the high-order polynomial coefficients is determined by solving the loss function, which realizes the conversion of the path planning problem into a mathematical problem, significantly improves the path generation efficiency, and solves the technical problems of poor high-order smoothness and low generation efficiency of the path.
[0189] An embodiment of the present application further provides an electronic device, comprising: a memory storing an executable program; and a processor for running the program, wherein the program executes the methods in various embodiments of the present invention when running.
[0190] An embodiment of the present application further provides a computer-readable storage medium, which includes a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the methods in various embodiments of the present invention.
[0191] An embodiment of the present application further provides a computer program product, including a computer program, which implements the methods in various embodiments of the present invention when executed by a processor.
[0192] An embodiment of the present application further provides a computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the method in each embodiment of the present invention is implemented.
[0193] The embodiments of the present application further provide a computer program, which implements the methods in the above-mentioned embodiments of the present invention when executed by a processor.
[0194] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0195] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0196] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0197] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0198] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0199] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0200] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for generating a path, characterized in that: include: Determining a plurality of reference points in the operation scene, wherein the plurality of reference points are used to represent key positions of path planning; Based on the multiple reference points, construct multiple polynomial curves, wherein the constraint condition of each polynomial curve at least includes the position and / or speed of the curve endpoint, and the multiple polynomial curves are connected end to end; Based on the multiple polynomial curves, construct a loss function, wherein the loss function is used to evaluate the smoothness of an initial path formed by the multiple polynomial curves and the proximity between the initial path and the multiple reference points; Based on the loss function, determining a target coefficient set of the plurality of polynomial curves, wherein the target coefficient set includes coefficients that minimize the function value of the loss function; Based on the target coefficient set and the multiple polynomial curves, the initial path is adjusted to obtain a target path, wherein the target path is a smooth path passing through the multiple reference points.
2. The generation method according to claim 1, characterized in that: Based on the multiple reference points, multiple polynomial curves are constructed, including: Starting from the starting positions of the multiple reference points, dividing at least two consecutive reference points into a reference point set to obtain a plurality of reference point sets; A polynomial curve is generated based on each reference point in the reference point set to obtain multiple polynomial curves.
3. The generation method according to claim 1, characterized in that: Based on the multiple polynomial curves, a loss function is constructed, including: Obtaining derivatives of various orders corresponding to the multiple polynomial curves respectively; Based on the integration of the square of each order derivative with respect to the independent variable, construct a smoothness matrix, wherein the smoothness matrix is used to quantify the smoothness of the initial path formed by the multiple polynomial curves; Based on the distance errors between the initial path formed by the multiple polynomial curves and the multiple reference points, construct a similarity matrix, wherein the similarity matrix is used to quantify the proximity between the initial path and the multiple reference points; A loss function is constructed based on the smoothness matrix and the similarity matrix.
4. The generation method according to claim 3, characterized in that: Based on the smoothness matrix and the similarity matrix, a loss function is constructed, including: Based on the smoothness matrix, determining the smoothness of the initial path formed by the multiple polynomial curves at the multiple reference points; Based on the similarity matrix, determining the distance between the initial path formed by the multiple polynomial curves and the multiple reference points; The smoothness of the initial path formed by the multiple polynomial curves at the multiple reference points and the distances between the initial path formed by the multiple polynomial curves and the multiple reference points are summed to obtain a loss function.
5. The generation method according to claim 1, characterized in that: Determining target coefficient sets of the plurality of polynomial curves based on the loss function includes: Derivative the loss function with respect to the coefficients of the polynomial curve to determine a coefficient combination that minimizes the function value of the loss function; The coefficient combination is determined as the target coefficient set.
6. The generation method according to claim 1, characterized in that: Based on the target coefficient set and the multiple polynomial curves, the initial path is adjusted to obtain a target path, including: adjusting the plurality of polynomial curves based on coefficients included in the target coefficient set; Based on the adjusted multiple polynomial curves, the initial path is adjusted to obtain a target path.
7. The generation method according to claim 6, characterized in that: In the two adjacent adjusted polynomial curves, the speed at the end position of the first polynomial curve is respectively the same as the speed at the starting position of the second polynomial curve.
8. The generation method according to claim 7, characterized in that: The method further comprises: In response to the two adjacent polynomial curves representing a reversing section and a non-reversing section respectively, the speed at the connection point of the reversing section and the non-reversing section is minimized, wherein the polynomial curve corresponding to the reversing section is in the opposite direction to the polynomial curve corresponding to the non-reversing section.
9. The generation method according to claim 8, characterized in that: The starting position of the polynomial curve corresponding to the reversing section is the same as the ending position of the polynomial curve corresponding to the non-reversing section, and the speed and acceleration at the starting position of the polynomial curve corresponding to the reversing section are zero.
10. A path generation device, characterized in that: include: A determination unit, used to determine a plurality of reference points in an operation scene, wherein the plurality of reference points are used to represent key positions for path planning; A first construction unit is configured to construct a plurality of polynomial curves based on the plurality of reference points, wherein the constraint condition of each of the polynomial curves at least includes the position and / or speed of the curve endpoint, and the plurality of polynomial curves are connected end to end; A second construction unit is used to construct a loss function based on the multiple polynomial curves, wherein the loss function is used to evaluate the smoothness of the initial path formed by the multiple polynomial curves and the proximity between the initial path and the multiple reference points; a second determining unit, configured to determine a target coefficient set of the plurality of polynomial curves based on the loss function, wherein the target coefficient set includes coefficients that minimize a function value of the loss function; An adjustment unit is used to adjust the initial path based on the target coefficient set and the multiple polynomial curves to obtain a target path, wherein the target path is a smooth path passing through the multiple reference points.