Vehicle state estimation method based on particle filter algorithm
Technical Field
The invention belongs to the field of vehicle state estimation, and relates to a vehicle state estimation method based on a particle filter algorithm.
Background
The effectiveness of an automotive chassis control system depends largely on the accuracy of vehicle state parameters required during operation of the control system, and inaccurate vehicle state parameters may reduce the effectiveness of the control system and even cause the control system to malfunction. Some vehicle conditions can be measured directly by on-board sensors, while other condition parameters (such as vehicle longitudinal and lateral speed) are difficult to measure directly by low-cost sensors. In actual use, the latter is often evaluated by available information obtained from existing sensing devices on the vehicle.
In the vehicle state estimation method, a Bayes filter designed based on vehicle dynamics is widely applied, and in the vehicle state which can not be measured at low cost, the most basic driving state quantity and the centroid slip angle of the vehicle in the longitudinal speed and the lateral speed can be directly calculated by the two. When a dynamic model is used for designing a Bayes filter, the acquisition of longitudinal force and lateral force of an automobile is critical, but tire force of the automobile is difficult to acquire accurately in practical application, and a tire model is generally introduced to estimate tire force as a state quantity simultaneously or an estimator is designed for tire force estimation separately. However, the former introduces the problem of model parameter acquisition and accuracy of the tire model, and the latter causes the observation structure to become very large and the calculation amount to increase.
Disclosure of Invention
In view of the above, the present invention provides a vehicle state estimation method based on a particle filter algorithm, which is designed based on a vehicle kinematics model and does not depend on tire force information; accurately estimating the vehicle state under various working conditions; in the program, a random number function is replaced by a random number table lookup value method, and the operation speed is high.
In order to achieve the purpose, the invention provides the following technical scheme:
a vehicle state estimation method based on a particle filter algorithm comprises the following steps:
s1: establishing a self-adaptive noise parameter state transition equation based on a vehicle kinematic model and an observation equation containing sensor measurement quantity;
s2: generating a random number table to replace a random number function;
s3: and estimating the longitudinal speed and the lateral speed of the vehicle according to the basic flow of the particle filter algorithm.
Further, the vehicle kinematics model in step S1 includes:
longitudinal direction:
lateral direction:
wherein v isxIndicating longitudinal vehicle speed, vyRepresents lateral vehicle speed, unit m/s;
axrepresenting longitudinal acceleration, ayRepresenting longitudinal acceleration in m/s2;
r represents yaw rate, in rad/s.
Further, the process of establishing the adaptive noise parameter state transition equation of the vehicle kinematics model in step S1 is as follows:
discretizing equations (1) and (2) in the time domain yields:
vx,k=vx,k-1+ax,k-1T+vy,k-1rk-1T (21)
vy,k=vy,k-1+ay,k-1T-vx,k-1rk-1T (22)
wherein T represents a sampling period, and k represents the current time;
the state variables are defined as:
x=[vx ax vy ay r]T (23)
the state transition equation is obtained from equations (3), (4), and (5):
xk=Fxk-1+GLu (24)
in the formula:
u=[ux uy uz]T (28)
mx、myand mrAre respectively three self-defined constant coefficients, ux、uyAnd urThree mutually independent standard gaussian noises respectively.
Further, the establishment process of the observation equation including the sensor measurement amount in step S1 is as follows:
define the sensor measurements as:
z=[ax ay r]T (29)
the observation equation is obtained as:
zk=Hxk+v (30)
in the formula:
in the formula
And v
r,kThe sensors, which represent the three state variables of longitudinal acceleration, lateral acceleration and yaw rate, respectively, measure noise.
Further, step S2 specifically includes the following steps:
s21: random number table of state equation
Generating a 3 XN random number table xi, wherein each row is a random number which obeys standard normal distribution, and substituting the value of the random number table for the value generated by a random number function to obtain a state transition equation:
xk=Fxk-1+GLξ (33)
wherein N is the number of particles;
s22: random number table of observation equation
According to ax、ayAnd r, measuring the noise parameters by the sensor to generate a 3 XN random number table w, and replacing the random number function generation value with the value obtained by looking up the random number table to obtain an observation equation:
zk=Hxk+w (34)
s23: resampling random number table
And generating a 1 XN random number table which is uniformly distributed between 0 and 1 in the resampling stage, and replacing the random number function generation value with the value of the random number table.
Further, step S3 specifically includes the following steps:
s31: representing the state quantity x of the particles at the k-1 momentk-1,iThe state transition equation (15) is substituted to obtain a one-step predicted value x of each particle state at the moment kk,i
S32: predicting the state of each particle by one stepk,iSubstituting into an observation equation (16) to obtain a one-step predicted value z of the measured variable at the moment kk,i;
S33: a set of sensor measurements z unique according to time kk,gTo weigh the weight of each particle:
dzk,i=zk,i-zk,g (35)
wk,i=g(dzk,i) (36)
in the formula, dzk,iRepresenting the deviation between the one-step predicted value of each particle measurement variable at the moment k and the sensor measurement value, and obtaining the weight w of each particle through a weight calculation function g (x)k,i(ii) a Weight calculation function being capable of expressing dz in arbitrary formk,iThe smaller the absolute value, the greater the weight, the greater the absolute value, the smaller the weight;
s34: normalizing each particle weight yields:
s35: according to a resampling algorithm, a resampling random number table is used for replacing a random number function, particles are copied and eliminated according to the weight of each particle, and the quantity N of a particle set before and after sampling is guaranteed to be unchanged;
s36: and outputting the mean value of the resampled particle set, namely the vehicle state filtering estimation value, and substituting the resampled particle set into the next iteration cycle.
Further, step S35 specifically includes the following steps:
s351: replacing the random number function with a 1 XN resampled random number table;
s352: generating a particle weight accumulation function cdf satisfying
S353: resampling is performed according to a resampling algorithm.
The invention has the beneficial effects that: the scheme can quickly and accurately estimate the vehicle state, is applied to the vehicle chassis control system, and has important significance for improving the energy efficiency of the control system.
Additional advantages, objects, and features of the invention will be set forth in part in the description which follows and in part will become apparent to those having ordinary skill in the art upon examination of the following or may be learned from practice of the invention. The objectives and other advantages of the invention may be realized and attained by the means of the instrumentalities and combinations particularly pointed out hereinafter.
Drawings
For purposes of promoting a better understanding of the objects, aspects and advantages of the invention, reference will now be made to the following detailed description taken in conjunction with the accompanying drawings in which:
FIG. 1 is a schematic flow chart of a vehicle state estimation method based on a particle filter algorithm according to the present invention;
FIG. 2 is a schematic view of a kinematic model of a vehicle;
fig. 3 is a pseudo code of a particle filter estimation algorithm.
Detailed Description
The embodiments of the present invention are described below with reference to specific embodiments, and other advantages and effects of the present invention will be easily understood by those skilled in the art from the disclosure of the present specification. The invention is capable of other and different embodiments and of being practiced or of being carried out in various ways, and its several details are capable of modification in various respects, all without departing from the spirit and scope of the present invention. It should be noted that the drawings provided in the following embodiments are only for illustrating the basic idea of the present invention in a schematic way, and the features in the following embodiments and examples may be combined with each other without conflict.
Wherein the showings are for the purpose of illustrating the invention only and not for the purpose of limiting the same, and in which there is shown by way of illustration only and not in the drawings in which there is no intention to limit the invention thereto; to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of an actual product; it will be understood by those skilled in the art that certain well-known structures in the drawings and descriptions thereof may be omitted.
The same or similar reference numerals in the drawings of the embodiments of the present invention correspond to the same or similar components; in the description of the present invention, it should be understood that if there is an orientation or positional relationship indicated by terms such as "upper", "lower", "left", "right", "front", "rear", etc., based on the orientation or positional relationship shown in the drawings, it is only for convenience of description and simplification of description, but it is not intended to indicate or imply that the referred device or element must have a specific orientation, be constructed in a specific orientation, and be operated, and therefore, the terms describing the positional relationship in the drawings are only used for illustrative purposes and are not to be construed as limiting the present invention, and it is possible for a person having ordinary skill in the art to understand the specific meaning of the above terms according to specific circumstances.
As shown in fig. 1, a vehicle state estimation method based on a particle filter algorithm includes the following steps:
step 1: establishing a self-adaptive noise parameter state transition equation based on a vehicle kinematic model and an observation equation containing sensor measurement quantity;
step 2: generating a random number table to replace a random number function;
and step 3: and estimating the longitudinal speed and the lateral speed of the vehicle according to the basic flow of the particle filter algorithm.
The step 1 specifically comprises the following steps:
as shown in fig. 2, step 1.1: vehicle plane kinematics model
A schematic diagram of a planar kinematic model is shown in fig. 1.
Longitudinal (x-axis):
lateral (y-axis):
wherein v isxIndicating longitudinal vehicle speed, vyRepresents a lateral vehicle speed (m/s); a isxRepresents the longitudinal acceleration (m/s)2);ayRepresents the longitudinal acceleration (m/s)2) (ii) a r represents yaw rate (rad/s).
Step 1.2: kinematic model-based state transition equation
Discretizing equations (1) and (2) in the time domain yields:
vx,k=vx,k-1+ax,k-1T+vy,k-1rk-1T (39)
vy,k=vy,k-1+ay,k-1T-vx,k-1rk-1T (40)
wherein T represents a sampling period, and k represents the current time;
the state variables are defined as:
x=[vx ax vy ay r]T (41)
the state transition equation is obtained from equations (3), (4), and (5):
xk=Fxk-1+GLu (42)
in the formula:
u=[ux uy uz]T (46)
mx、myand mrAre respectively three self-defined constant coefficients, ux、uyAnd urThree independent standard gaussian noise respectively.
Step 1.3: equation of observation
Define the sensor measurements as:
z=[ax ay r]T (47)
the observation equation is obtained as:
zk=Hxk+v (48)
in the formula:
in the formula
And v
r,kThe sensors, which represent the three state variables of longitudinal acceleration, lateral acceleration and yaw rate, respectively, measure noise.
The step 2 specifically comprises the following steps:
step 2.1: random number table of state equation
Generating a 3 XN random number table xi, wherein each row is a random number which obeys standard normal distribution, and replacing a random number function generation value with a random number table value in a program to obtain a state transition equation:
xk=Fxk-1+GLξ (51)
wherein N is the number of particles.
Step 2.2: random number table of observation equation
According to ax、ayAnd r, measuring the noise parameters by the sensor to generate a 3 XN random number table w, and searching the random number table in the program to obtain a value to replace a random number function to generate a value so as to obtain an observation equation:
zk=Hxk+w (52)
step 2.2: resampling random number table
In the resampling stage, a 1 XN random number table which is uniformly distributed between 0 and 1 is generated, and the random number function generation value is replaced by the random number table value checking in the program.
As shown in fig. 3, the step 3 specifically includes:
step 3.1:
representing the state quantity x of the particles at the k-1 momentk-1,iThe state transition equation (15) is substituted to obtain a one-step predicted value x of each particle state at the moment kk,i
Step 3.2:
predicting the state of each particle by one stepk,iSubstituting into the observation equation (16) to obtain a one-step predicted value z of the measured variable at the moment kk,i;
Step 3.3:
a set of sensor measurements z unique according to time kk,gTo weigh the weight of each particle:
dzk,i=zk,i-zk,g (53)
wk,i=g(dzk,i) (54)
in the formula, dzk,iRepresenting the deviation between the one-step predicted value of each particle measurement variable at the moment k and the sensor measurement value, and obtaining the weight w of each particle through a weight calculation function g (x)k,i. The weight calculation function can express dz in an arbitrary formk,iThe smaller the absolute value, the more the weight, the larger the absolute value, the less the weight, this regular function.
Step 3.4: normalizing each particle weight yields:
step 3.5: according to a resampling algorithm, a resampling random number table is used for replacing a random number function, particles are copied and eliminated according to the weight of each particle, and the quantity N of a particle set before and after sampling is guaranteed to be unchanged;
1): replacing the random number function with a 1 XN resampled random number table;
2): generating a particle weight accumulation function cdf satisfying
3): resampling is carried out according to a resampling algorithm, and specific codes can be referred to Huang Xiao Ping et al (particle filter principle and application [ M ]. electronic industry Press, 2017.);
step 3.6: and outputting the mean value of the resampled particle set, namely the vehicle state filtering estimation value, and substituting the resampled particle set into the next iteration cycle.
Specific codes corresponding to the basic flow of the particle filter algorithm can be referred to yellow Xiaoping et al (particle filter principle and application [ M ]. electronic industry Press, 2017.).
Finally, the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions, and all that should be covered by the claims of the present invention.