Disclosure of Invention
The running speed of the unmanned automobile is dynamically planned in consideration of input quantities such as the degree of curvature of a road ahead, the degree of slippery on the current road surface, the magnitude of lateral deviation and the like, in order to obtain good and comfortable riding experience, the planned speed is as stable as possible, large or high-frequency oscillation is avoided in a short time, and uncomfortable body feeling of a rider is avoided in the switching process of high, medium and low speed.
In order to achieve the purpose, the technical scheme adopted by the invention is a wavy vehicle speed planning method with a constraint square based on a fuzzy algorithm, and the method comprises the following implementation steps:
step 1, determining a membership function and a fuzzy rule of system input and output;
step 1.1, determining input and output signals and membership functions thereof;
inputs to the system are front road curvature, road surface friction coefficient, and lateral tracking error. The curvature fuzzy language value B is large, the M is medium, and the S is small, the fuzzy language value of the lateral tracking error is B, M, S, the fuzzy language value of the road surface friction coefficient VB is very large, and the fuzzy language value of the road surface friction coefficient B, S, VS is very small. The membership functions all adopt bell-shaped functions:
in the formula abell、bbell、cbellIs a parameter of a generalized bell-shaped membership function, wherein abellDetermining the position of the horizontal axis corresponding to the bell-shaped membership function with the membership degree of 0.5, bbellThe greater the absolute value of (c), the faster the speed of change of membership, the opening of the bell-shaped function being directed downwards when taking a positive value, cbellThe position of the center of the bell-shaped membership function is determined.
The system output is the driving speed of the target path point, the fuzzy language values VB, B and LB are relatively large, the M expression and LS expression are relatively small, the S expression is small, and the VS expression is very small. The membership function adopts a triangular function:
in the formula atri、btri、ctriThe positions of the horizontal axes of the three vertexes of the membership degree curve are determined for the parameters of the triangular membership functions.
Step 1.2, designing a fuzzy rule;
the driving speed range of the target path point output when the friction coefficient is large is larger, the upper limit is higher, the speed change is small when the friction coefficient is small, and the highest speed per hour is also smaller; the curvature is the most sensitive input quantity, when the curvature is increased, the output vehicle speed is integrally reduced, otherwise, the output vehicle speed is increased; lateral tracking error is inversely proportional to output vehicle speed, but is less sensitive on road segments where the coefficient of friction is greater and the road curvature is less.
Step 2, calculating a global variable;
step 2.1, calculating curvatures of all target path points;
and 3 continuous path points are selected each time from the planned path provided by the path planning system by using a sliding window with the window length of 3, and the curvature of the target path point is obtained by using the triangular relation between the three points. The curvatures of all target path points on the path are calculated by the method.
L in the formulai-1,i、Li,i+1、Li-1,i+1The distance between every two of the three continuous target path points.
Step 2.2, carrying out moving average filtering aiming at the curvature;
the high-frequency vibration part existing in the curvature calculated by the triangular relation influences the output result of the system; under the continuous turning working condition, the change of the steering direction causes the change of the curvature absolute value to unreasonably describe the bending degree of the real road. To solve the above problem, a moving average filtering algorithm is used to smooth the curvature signal queue:
where K is the original curvature calculated by trigonometric relationship, KfilterFor the filtered curvature, 2n +1 is the sliding window length of the moving average filter.
Step 2.3, calculating thresholds and curvature references of different areas of square wave fitting;
dividing the curvature queue into different standard regions based on the absolute value of the global curvature queue, wherein transition regions exist between the standard regions, and the length of the standard regions is
L=(KfilterMax-KfilterMin)/(N+q×(N-1))
Wherein KfilterMaxAnd KfilterMinThe maximum curvature value and the minimum curvature value in the global curvature queue are respectively, N is the number of the standard areas, and the ratio of the length of the q transition area to the length of the standard area.
And obtaining the length and the relation of the standard region and the transition region, wherein i is 1, …, and N is the serial number of the standard region:
Tmin(i)=KfilterMin+(i-1)×(1+q)×L
Tmax(i)=KfilterMin+(i-1)×(1+q)×L+L
after the upper threshold and the lower threshold of each standard area are obtained, the curvatures of all target path points in the corresponding standard area in the global curvature queue are subjected to arithmetic mean to obtain the area standard value of the current area
Wherein n ispointNumber of target path points with curvature in the standard region, KfilterRegionIs the set of curvatures for the target waypoints whose curvatures are within the standard region.
Step 3, calculating the traveling speed of the target planning point;
step 3.1, acquiring input quantity required by a fuzzy algorithm and performing square wave fitting according to curvature;
comparing the curvature of the dynamically planned path with the region threshold in step 2.3, directly classifying and approximating the curvature as a region standard value, and keeping the curvature in the transition region consistent with the region standard value in the adjacent standard region in terms of safety:
wherein KfuzzyInputThe curve value is used as the input quantity of the fuzzy algorithm after being approximated, r is the weight value of the area standard value in different standard areas, and K is calculated according to different planning strategiesfuzzyInputAnd (6) adjusting.
Step 3.2, calculating the output speed through a fuzzy algorithm;
calculating output by using a fuzzy algorithm, using a multiplier rule for a fuzzy implication relation, and adopting a weighted average method for a defuzzification method:
in the formula NruleNumber of fuzzy rules to activate, mukj(xk)、μej(xe)、μmj(xm) Respectively represents the membership degree, z, of the fuzzy subset in which the curvature, the transverse tracking error and the ground friction coefficient are respectively positioned in the activated 'j' fuzzy rulejOutputting u for different fuzzy rulesspeedThe abscissa value corresponding to the cusp of the membership function of the fuzzy subset.
Step 3.3, applying dynamic constraints to the obtained speed to perform re-planning;
the velocity output curve is adjusted again with a constant jerk, acceleration with an initial value of 0:
uspeed(k+1)=uspeed(k)+a(k+1)
wherein a is the acceleration, amaxIs the maximum acceleration (or maximum deceleration) for avoiding the discomfort of the passenger, and Δ a is a constant jerk, uspeedHigh、uspeedLowHigher and lower speeds, respectively, for different levels of speed conversion.
Detailed Description
The invention is further described with reference to the following figures and detailed description.
The invention provides a method for planning a wavy vehicle speed with a constraint square based on a fuzzy algorithm, aiming at a speed planning system of an unmanned vehicle. The method firstly determines membership function and fuzzy rule of fuzzy algorithm input and output quantity, adopts the fuzzy algorithm to plan the reference speed of a target path point, solves the problem of difficult modeling of a speed planning system, and provides a new solution for the current situation that the speed planning system is designed by utilizing the traditional following model or the economic energy consumption speed per hour. Then, the curvature signal queue calculated by utilizing the triangular relation is filtered, and the global variable related to the square wave fitting algorithm is calculated, so that the problem that the curvature calculated by a computer is too frequent in fluctuation and is not in line with the thinking habit of normal automobile driving is solved. And finally, converting the obtained input quantity into an output speed through a fuzzy algorithm, and carrying out quadratic programming on the planned speed curve by considering the vehicle dynamics. Even the vehicle speed tracking system designed based on the non-dynamic constraint controller can provide stable and comfortable riding experience for passengers under the condition of stably tracking the final speed curve. The system flow chart of the related method is shown as the attached figure 1, and the specific implementation process comprises the following steps:
step 1, determining a membership function and a fuzzy rule of system input and output;
step 1.1, determining input and output signals and membership functions thereof;
according to the driving habit, when the curvature of the road on the front side is large, a large centrifugal phenomenon is generated when the road passes at a high speed, and poor riding experience is brought to a rider; when the road surface is wet and slippery, the tire can slip, and the working conditions of emergent doubling and braking can be caused by maintaining high-speed running, so that the property and even life safety are endangered; when the automobile has larger deviation in tracking a target path, the speed is properly reduced to improve the transverse tracking performance of the automobile steering controller and reduce the transverse tracking error. On the contrary, the driving speed can be properly increased under the conditions that the front road is straight, the ground adhesion condition is good and the lateral tracking error is small.
The input is defined as three components of front road curvature, road surface friction coefficient and transverse tracking error, wherein the fuzzy language value of curvature and transverse tracking error is B to indicate large, M to indicate medium and S to indicate small, the fuzzy language value of road surface friction coefficient is VB to indicate very large, and B, S, VS to indicate very small. The membership function adopts a bell-shaped function:
the output is the driving speed of the target path point, the fuzzy language values VB, B and LB are larger, M, LS is smaller, and S, VS is adopted. The membership function adopts a triangular function:
a schematic diagram of the membership function of the input and output signals of the system is shown in FIG. 2, wherein FIGS. 2-a, 2-b, 2-c and 2-d are schematic diagrams of the membership function of curvature, lateral error, ground friction coefficient and speed, respectively.
Step 1.2, designing a fuzzy rule;
the road surface friction coefficient directly influences the ground gripping performance of the tire, so that the driving speed range of the output target path point is larger and the upper limit is higher when a large friction coefficient is set; when the friction coefficient is small, the vehicle speed change is small, and the highest speed per hour is also controlled within the safe speed.
The curvature of the road in front directly affects the body feeling of the rider and the lateral stability of the automobile, so the overall fuzzy rule takes the curvature as the most sensitive input quantity, when the curvature is increased, the input speed is reduced as a whole, and vice versa.
The transverse tracking error increase of the automobile in the bending process is a normal phenomenon, the automobile can be gradually converged after the automobile is bent, and different automobile states are reflected by considering the transverse tracking error under different working conditions, so that the sensitivity of the fuzzy rule to the transverse tracking error is small on a road section with a large friction coefficient and a small road curvature; on the road surface with small friction coefficient and large curvature, the sensitivity to the input quantity of the transverse tracking error is improved.
The specified curvature is K, the transverse error is E, the friction coefficient is Mu, the speed is V, a specific fuzzy rule set is designed as follows, and a schematic diagram of a fuzzy inference curved surface is shown in FIG. 3:
if K=S and E=S and Mu=VS then V=M
or if K=S and E=M and Mu=VS then V=M
or if K=S and E=B and Mu=VS then V=M
or if K=M and E=S and Mu=VS then V=LS
or if K=M and E=M and Mu=VS then V=LS
or if K=M and E=B and Mu=VS then V=S
or if K=B and E=S and Mu=VS then V=S
or if K=B and E=M and Mu=VS then V=VS
or if K=B and E=B and Mu=VS then V=VS
or if K=S and E=S and Mu=S then V=LB
or if K=S and E=M and Mu=S then V=LB
or if K=S and E=B and Mu=S then V=LB
or if K=M and E=S and Mu=S then V=M
or if K=M and E=M and Mu=S then V=M
or if K=M and E=B and Mu=S then V=LS
or if K=B and E=S and Mu=S then V=LS
or if K=B and E=M and Mu=S then V=S
or if K=B and E=B and Mu=S then V=S
or if K=S and E=S and Mu=B then V=B
or if K=S and E=M and Mu=B then V=B
or if K=S and E=B and Mu=B then V=B
or if K=M and E=S and Mu=B then V=LB
or if K=M and E=M and Mu=B then V=LB
or if K=M and E=B and Mu=B then V=M
or if K=B and E=S and Mu=B then V=M
or if K=B and E=M and Mu=B then V=LS
or if K=B and E=B and Mu=B then V=S
or if K=S and E=S and Mu=VB then V=VB
or if K=S and E=M and Mu=VB then V=VB
or if K=S and E=B and Mu=VB then V=VB
or if K=M and E=S and Mu=VB then V=B
or if K=M and E=M and Mu=VB thenV=B
or if K=M and E=B and Mu=VB thenV=LB
or if K=B and E=S and Mu=VB then V=M
or if K=B and E=M and Mu=VB thenV=LS
or if K=B and E=B and Mu=VB thenV=LS
step 2, calculating a global variable;
step 2.1, calculating curvatures of all target path points;
because the speed planning is established on the premise that a safe and collision-free path is provided by a path planning system, the number of speed points planned in a single time is not more than the number of the path planning points, and because of the consideration of safety and driving smoothness, a path planning algorithm often provides the farthest dynamic path planning result under the condition that an environment sensing system reaches the maximum, the speed planning can calculate the curvatures of all target path points at one time, and corresponding curvature results can be directly taken out from an internal memory when the next operation is carried out, and the calculation of the curvatures can be obtained through a simple triangular relation:
l in the formulai-1,i、Li,i+1、Li-1,i+1The distance between every two of the three continuous target path points.
Step 2.2, carrying out moving average filtering aiming at the curvature;
the curvature calculated by using three continuous target path points generates high-frequency oscillation due to the close distance of the points, and under the working condition of continuous turning, a small-curvature road section is necessarily calculated in the process of alternating the bending direction of the path from left to right, but is not a straight line in macroscopic view. Both of the above cases result in the calculation of a target vehicle speed that is jittered or unreasonable; and the change of the output vehicle speed generated by the curvature change of the small curvature part and the short-distance slow-bending part in the two sections of straight roads in the continuous turning process is not in accordance with the normal driving habit, so that the filtering algorithm is required to be used for smoothing high-frequency vibration and weakening the curvature change under the relevant working conditions, and the adoption of the moving average filtering algorithm is considered:
where K is the original curvature calculated by trigonometric relationship, KfilterFor the filtered curvature, 2n +1 is the sliding window length of the moving average filter.
Step 2.3, calculating thresholds and curvature references of different areas of square wave fitting;
according to the driving habits, the following steps are known: when the curve degree of the road at the front is larger or the road is a continuous curve, the driver often passes through the curve at a lower constant speed, and the driving speed cannot be adjusted in real time due to slight change of the curvature in the continuous curve process, so that the curvature queue is divided into different areas according to the absolute value, and the curvature queue in the same area is fitted to the same value, so that the subsequent fuzzy algorithm can output a stable speed curve.
Dividing the curvature queue into different standard regions based on the absolute value of the global curvature queue, wherein transition regions exist between the standard regions, and the length of the standard regions is
L=(KfilterMax-KfilterMin)/(N+q×(N-1))
Wherein KfilterMaxAnd KfilterMinThe maximum curvature value and the minimum curvature value in the global curvature queue are respectively, N is the number of the standard areas, and the ratio of the length of the q transition area to the length of the standard area.
And obtaining the length and the relation of the standard region and the transition region, wherein i is 1, …, and N is the serial number of the standard region:
Tmin(i)=KfilterMin+(i-1)×(1+q)×L
Tmax(i)=KfilterMin+(i-1)×(1+q)×L+L
after the upper threshold and the lower threshold of each standard area are obtained, the curvatures of all target path points in the corresponding standard area in the global curvature queue are subjected to arithmetic mean to obtain the area standard value of the current area
Wherein n ispointNumber of target path points with curvature in the standard region, KfilterRegionIs the set of curvatures for the target waypoints whose curvatures are within the standard region.
Step 3, calculating the traveling speed of the target planning point;
step 3.1, acquiring input quantity required by a fuzzy algorithm and performing square wave fitting according to curvature;
the input quantity required by the fuzzy algorithm comprises a ground friction coefficient, a current transverse tracking error of the vehicle and the curvature of a front reference path point, the ground friction coefficient can be obtained by system presetting or analyzing the environment by using a sensor, the transverse tracking error can be directly calculated by using the position of the current vehicle and a target tracking track, the relevant information of the curvature of the front reference path is provided by a path planning system, the vibration of the curvature is directly obtained or calculated, the speed planning is not facilitated, the curvature of the dynamically planned path is compared with the area threshold value in the step 2.3, the curvature can be directly classified and approximated into an area standard value, and in consideration of safety, the curvature in a transition area is kept consistent with the area standard value in an adjacent standard area, wherein the area standard value is lower:
wherein KfuzzyInputThe curve value can be used as fuzzy algorithm input quantity after approximation, r is the weight value of the area standard value in different standard areas, and K can be adjusted according to different planning strategiesfuzzyInputAnd (6) adjusting.
In combination with the runway example, starting from the coordinate (0, 0) point to the negative direction of the x-axis, the runway returns to the (0, 0) point after running for one circle along the runway, and the schematic diagram of the runway is shown in fig. 4. The results of the square wave fitting curvature according to this example are shown in fig. 5.
Step 3.2, calculating the output speed through a fuzzy algorithm;
after obtaining fuzzy algorithm input quantity, calculating through a membership function to obtain membership degrees of three input components of curvature, transverse tracking error and ground friction coefficient in different fuzzy subsets, wherein fuzzy implication relation utilizes a multiplier rule, and a defuzzification method adopts a weighted average method:
in the formula NruleNumber of fuzzy rules to activate, mukj(xk)、μej(xe)、μmj(xm) Respectively represents the membership degree, z, of the fuzzy subset in which the curvature, the transverse tracking error and the ground friction coefficient are respectively positioned in the activated 'j' fuzzy rulejOutputting u for different fuzzy rulesspeedThe abscissa value corresponding to the cusp of the membership function of the fuzzy subset. For the runway example, considering that the tracking performance is good, the planning speed of the target path point output by the fuzzy algorithm is shown as a blue cross-dashed line in fig. 6.
Step 3.3, applying dynamic constraints to the obtained speed to perform re-planning;
under the condition that the performance of a transverse tracking system is good and stable, a planned speed curve can generate certain tiny fluctuation due to the change of transverse errors, but the whole speed curve can present square wave-shaped speed curves with different levels of high, medium and low, however, the speed interconversion with different levels is realized in a jumping mode, although the tracking of the speed curve can be realized by utilizing a control system with constraints under the condition that the body feeling of a passenger is not influenced, the planning system has better applicability to the control system of the next level, so the planning system needs to carry out speed planning under the premise of considering the dynamic constraints of a vehicle or carry out secondary planning on the existing speed planning result.
The speed output curve is adjusted by constant acceleration and acceleration with an initial value of 0 on the premise that the speeds of different levels caused by curvatures of different standard areas are selected by taking no discomfort as a parameter at the mutual conversion:
uspeed(k+1)=uspeed(k)+a(k+1)
wherein a is the acceleration, amaxIs the maximum acceleration (or maximum deceleration) for avoiding the discomfort of the passenger, and Δ a is a constant jerk, uspeedHigh、uspeedLowHigher and lower speeds, respectively, for different levels of speed conversion. Considering the jerk of 0.2m/s3The resulting re-planning speed of the target waypoint is shown as a black "dotted solid line" in fig. 6.
Fig. 7 is a schematic diagram of the guideline results of the combination of the obtained speed and the runway example, and in order to more intuitively reflect the results of speed planning in different road sections, the diameter of the point in the defined result diagram is proportional to the speed, namely the size of the point reflects the speed. It can be seen from the results that the sudden change of speed due to the existence of the part with smaller curvature does not occur in the continuous turning process, but a moderate speed is stably output, a smaller speed is output on the road section with larger curvature, and a larger speed is output in the straight-line and small-curvature turning process. On the whole, the output speed is very stable, the speed is reduced in advance when the vehicle enters a bend, and the speed transition of different levels is very smooth, so that the effectiveness of the method is proved, and the use requirements of the unmanned vehicle speed planning system are met.