当前位置:网站首页>Particle filter PF -- Application in maneuvering target tracking (particle filter vs extended Kalman filter)

Particle filter PF -- Application in maneuvering target tracking (particle filter vs extended Kalman filter)

2022-06-26 15:25:00 Skull II

Particle filtering PF—— Application in maneuvering target tracking ( Particle filtering VS Extended Kalman filter )

For the blog tracking code and problem discussion, you can contact :WX:ZB823618313
For the code and discussion of other tracking and positioning problems, you can also contact

Originality is not easy. , Please give a compliment to all the big guys passing by

One 、 Problem description ( Description of discrete-time nonlinear systems )

Consider the general nonlinear system model ,
x k = f ( x k − 1 , w k − 1 ) z k = h ( x k , v k ) (1) x_k=f(x_{k-1},w_{k-1}) \\ z_k=h(x_k,v_k ) \tag{1} xk=f(xk1,wk1)zk=h(xk,vk)(1)
among x k x_k xk by k k k Target state vector at time . z k z_k zk by k k k Time measurement vector ( Sensor data ). The controller is not considered here u k u_k uk. w k {w_k} wk and v k {v_k} vk They are process noise sequence and measurement noise sequence , And suppose w k w_k wk and v k v_k vk Zero mean Gaussian white noise , The variances are Q k Q_k Qk and R k R_k Rk The Gaussian white noise of , namely w k ∼ ( 0 , Q k ) w_k\sim(0,Q_k) wk(0,Qk), v k ∼ ( 0 , R k ) v_k\sim(0,R_k) vk(0,Rk), And satisfy the following relationship ( Linear Gaussian hypothesis ) by :
E [ w i v j ′ ] = 0 E [ w i w j ′ ] = 0 i ≠ j E [ v i v j ′ ] = 0 i ≠ j \begin{aligned} E[w_iv_j'] &=0\\ E[w_iw_j'] &=0\quad i\neq j \\ E[v_iv_j'] &=0\quad i\neq j \end{aligned} E[wivj]E[wiwj]E[vivj]=0=0i=j=0i=j

Two 、 Particle filtering PF

The core idea : Is to use a group of random samples with corresponding weights ( The particle ) To represent the posterior distribution of States . The basic idea of this method is to select an importance probability density and random sampling from it , Get some random samples with corresponding weights , Adjust the weight based on the state observation . And the position of the particles , These samples are then used to approximate the state posterior distribution , Finally, the weighted sum of these samples is taken as the estimated value of the state . Particle filter is not constrained by the linear and Gaussian assumptions of the system model , The state probability density is described in the form of sample rather than function , So that it does not need too many constraints on the probability distribution of state variables , So it is widely used in nonlinear non Gaussian dynamic systems . For all that , At present, the computation of particle filter is still too large 、 Key problems such as particle degradation need to be solved .

Usually, a priori distribution is chosen as the importance density function 、 namely
q ( x k ∣ x k − 1 ( i ) , z k ) = p ( x k ∣ x k − 1 ( i ) ) q(x_k |x_{k-1}^{(i)}, z_{k})=p(x_k |x_{k-1}^{(i)}) q(xkxk1(i),zk)=p(xkxk1(i))
The importance weight of this function is
w k ( i ) = w k − 1 ( i ) p ( z k ∣ x k ( i ) ) w_k^{(i)}=w_{k-1}^{(i)}p(z_k |x_{k}^{(i)}) wk(i)=wk1(i)p(zkxk(i))
Again w k ( i ) w_k^{(i)} wk(i) Normalization is required to obtain w ~ k ( i ) \tilde{w}_k^{(i)} w~k(i).

The standard particle filter algorithm steps are :

Particle filtering PF:
Step 1: according to p ( x 0 ) p(x_{0}) p(x0) Sampling to get N N N A particle x 0 ( i ) ∼ p ( x 0 ) x_0^{(i)} \sim p(x_{0}) x0(i)p(x0)
For i = 2 : N i=2:N i=2:N
  Step 2: The new particle generated from the state transition function is :$ x k ( i ) ∼ p ( x k ∣ x k − 1 ( i ) ) x_k^{(i)} \sim p(x_{k} |x_{k-1}^{(i)}) xk(i)p(xkxk1(i))
  Step 3: Calculate the importance weight : w k ( i ) = w k − 1 ( i ) p ( z k ∣ x k ( i ) ) w_k^{(i)}=w_{k-1}^{(i)}p(z_k |x_{k}^{(i)}) wk(i)=wk1(i)p(zkxk(i))
  Step 4: Normalized importance weight : w ~ k ( i ) = w k ( i ) ∑ j = 1 N w k ( j ) \tilde{w}_k^{(i)}=\frac{w_k^{(i)}}{\sum_{j=1}^Nw_k^{(j)}} w~k(i)=j=1Nwk(j)wk(i)
  Step 5: Resample particles using resample method ( Take system resampling as an example )
  Step 6: obtain k k k A posteriori state estimation of time :
E [ x ^ k ] = ∑ i = 1 N x k ( i ) w ~ k ( i ) E[\hat{x}_{k}]= \sum_{i=1}^Nx_{k}^{(i)}\tilde{w}_k^{(i)} E[x^k]=i=1Nxk(i)w~k(i)
End For

Particle filtering PF Algorithm structure diagram

 Insert picture description here

Algorithm : System resampling (systematic resampling)
For i = 1 : N i=1:N i=1:N
  Step 1: Initialize the cumulative probability density function CDF: c 1 = 0 c_1=0 c1=0
For i = 2 : N i=2:N i=2:N
  Step 2: structure CDF: c i = c i − 1 + w k ( i ) c_i=c_{i-1}+w_k^{(i)} ci=ci1+wk(i)
  Step 3: from CDF Start at the bottom of : i = 1 i=1 i=1
  Step 4: Sampling starting point : u 1 = U [ 0 , 1 / N ] u_1=\mathcal{U}[0,1/N] u1=U[0,1/N]
End For
For j = 1 : N j=1:N j=1:N
  Step 5: Along the CDF Move : u j = u 1 + ( j − 1 ) / N u_j=u_{1}+(j-1)/N uj=u1+(j1)/N
  Step 6: While u j > c i u_j>c_i uj>ci
       i = i + 1 i=i+1 i=i+1
     End While
  Step 7: Assignment particle : x k ( j ) = x k ( i ) x_k^{(j)}=x_k^{(i)} xk(j)=xk(i)
  Step 8: Assignment weight : w k ( j ) = 1 / N w_k^{(j)}=1/N wk(j)=1/N
  Step 9: Assign parent : i ( j ) = i i^{(j)}=i i(j)=i
End For

3、 ... and 、 Simulation scenario : 3D radar target tracking

3.1 Simulation scenario ( Three dimensional spiral rising maneuvering target )

Target model
Consider a three-dimensional uniform turning moving target :
x k + 1 = F k x k + G k w k x_{k+1}=F_kx_k+G _kw_k xk+1=Fkxk+Gkwk
Where the state vector x k = [ x k , x ˙ k , y k , y ˙ k , z k , z ˙ k ] ′ x_k=[x_k,\dot{x}_k,y_k,\dot{y}_k,z_k,\dot{z}_k]' xk=[xk,x˙k,yk,y˙k,zk,z˙k]; The noise is w k = [ w x , w y , w z ] ′ w_k=[w_x,w_y,w_z]' wk=[wx,wy,wz];

The target trajectory is a three-dimensional uniform turning motion model
path of particle : Spiral rise

If it is a nonlinear target , Then the state transition matrix F k F_k Fk Replace with Jacobian matrix . In order not to be general, the linear model is used for simulation . It mainly deals with target tracking , The problem of nonlinear filtering in radar measurement .

Radar measurement model
In the three-dimensional case , Radar measurements are range and angle
r k m = r k + r ~ k b k m = b k + b ~ k e k m = e k + e ~ k {r}_k^m=r_k+\tilde{r}_k\\ b^m_k=b_k+\tilde{b}_k\\ e^m_k=e_k+\tilde{e}_k rkm=rk+r~kbkm=bk+b~kekm=ek+e~k
among
r k = ( x k − x 0 ) + ( y k − y 0 ) 2 ) b k = tan ⁡ − 1 y k − y 0 x k − x 0 e k = tan ⁡ − 1 z k − z 0 ( x k − x 0 ) 2 + ( y k − y 0 ) 2 r_k=\sqrt{(x_k-x_0)^+(y_k-y_0)^2)}\\ b_k=\tan^{-1}{\frac{y_k-y_0}{x_k-x_0}}\\ e_k=\tan^{-1}{\frac{z_k-z_0}{\sqrt{(x_k-x_0)^2+(y_k-y_0)^2}}}\\ rk=(xkx0)+(yky0)2)bk=tan1xkx0yky0ek=tan1(xkx0)2+(yky0)2zkz0
[ x 0 , y 0 , z 0 ] [x_0,y_0,z_0] [x0,y0,z0] Is radar coordinates , The general situation is 0. Radar measurement is z k = [ r k , b k , e k ] ′ z_k=[r_k,b_k,e_k]' zk=[rk,bk,ek]. The radar measurement variance is
R k = cov ( v k ) = [ σ r 2 0 0 0 σ b 2 0 0 0 σ e 2 ] R_k=\text{cov}(v_k)=\begin{bmatrix}\sigma_r^2 & 0 &0\\0 & \sigma_b^2 &0\\0&0& \sigma_e^2 \end{bmatrix} Rk=cov(vk)=σr2000σb2000σe2 And σ r = 20 m \sigma_r=20m σr=20m, σ b = 20 m r a d \sigma_b=20mrad σb=20mrad, σ e = 15 m r a d \sigma_e=15mrad σe=15mrad.
Performance indicators
RMSE(Root mean-squared error): Montacarlo times M = 500 M=500 M=500, x ^ k ∣ k i \hat{x}_{k|k}^i x^kki For the first time i i i The estimation obtained from this simulation .
RMSE ( x ^ ) = 1 M ∑ i = 1 M ( x k − x ^ k ∣ k i ) ( x k − x ^ k ∣ k i ) ′ \text{RMSE}(\hat{x})=\sqrt{\frac{1}{M}\sum_{i=1}^{M}(\mathbf{x}_k-\hat{\mathbf{x}}_{k|k}^i)(\mathbf{x}_k-\hat{\mathbf{x}}_{k|k}^i)'} RMSE(x^)=M1i=1M(xkx^kki)(xkx^kki)
Position RMSE ( x ^ ) = 1 M ∑ i = 1 M ( x k − x ^ k ∣ k i ) 2 + ( y k − y ^ k ∣ k i ) 2 + ( z k − z ^ k ∣ k i ) 2 \text{Position RMSE}(\hat{x})=\sqrt{\frac{1}{M}\sum_{i=1}^{M}(x_k-\hat{x}_{k|k}^i)^2+(y_k-\hat{y}_{k|k}^i)^2+(z_k-\hat{z}_{k|k}^i)^2} Position RMSE(x^)=M1i=1M(xkx^kki)2+(yky^kki)2+(zkz^kki)2
Velocity RMSE ( x ^ ) = 1 M ∑ i = 1 M ( x ˙ k − x ˙ ^ k ∣ k i ) 2 + ( y ˙ k − y ˙ ^ k ∣ k i ) 2 + ( z ˙ k − z ˙ ^ k ∣ k i ) 2 \text{Velocity RMSE}(\hat{x})=\sqrt{\frac{1}{M}\sum_{i=1}^{M}(\dot{x}_k-\hat{\dot{x}}_{k|k}^i)^2+(\dot{y}_k-\hat{\dot{y}}_{k|k}^i)^2+(\dot{z}_k-\hat{\dot{z}}_{k|k}^i)^2} Velocity RMSE(x^)=M1i=1M(x˙kx˙^kki)2+(y˙ky˙^kki)2+(z˙kz˙^kki)2
ANEES(average normalized estimation error square), n n n Is the state dimension , P k ∣ k i \mathbf{P}_{k|k}^i Pkki For the first time i i i The estimated covariance of the output of the secondary simulation filter
ANEES ( x ^ ) = 1 M n ∑ i = 1 M ( x k − x ^ k ∣ k i ) ′ ( P k ∣ k i ) − 1 ( x k − x ^ k ∣ k i ) \text{ANEES}(\hat{x})=\frac{1}{Mn}\sum_{i=1}^{M}(\mathbf{x}_k-\hat{\mathbf{x}}_{k|k}^i)'(\mathbf{P}_{k|k}^i)^{-1} (\mathbf{x}_k-\hat{\mathbf{x}}_{k|k}^i) ANEES(x^)=Mn1i=1M(xkx^kki)(Pkki)1(xkx^kki)

3.2 Track track

3D track :
 Insert picture description here

 Insert picture description here

 Insert picture description here

 Insert picture description here

3.3 Tracking error

 Insert picture description here

 Insert picture description here

Four 、 Part of the code

For the blog tracking code and problem discussion, you can contact :WX:ZB823618313
For the code and discussion of other tracking and positioning problems, you can also contact

Code : System resampling (systematic resampling)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  The system reacquires the appearance function 
%  Input parameters :weight Is the weight corresponding to the original data 
%  Output parameters :outIndex It's based on weight Filter and copy results 
function outIndex = systematicR(weight);
N=length(weight);
N_children=zeros(1,N);
label=zeros(1,N);
label=1:1:N;
s=1/N;
auxw=0;
auxl=0;
li=0;
T=s*rand(1);
j=1;
Q=0;
i=0;
u=rand(1,N);
while (T<1)
    if (Q>T)
        T=T+s;
        N_children(1,li)=N_children(1,li)+1;
    else
        i=fix((N-j+1)*u(1,j))+j;
        auxw=weight(1,i);
        li=label(1,i);
        Q=Q+auxw;
        weight(1,i)=weight(1,j);
        label(1,i)=label(1,j);
        j=j+1;
    end
end
index=1;
for i=1:N
    if (N_children(1,i)>0)
        for j=index:index+N_children(1,i)-1
            outIndex(j) = i;
        end;
    end;
    index= index+N_children(1,i);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
原网站

版权声明
本文为[Skull II]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206261506247809.html