Question: Vehicle Dynamics model [ x v ] = [ 0 1 0 0 ] [ x v ] + [ 0 a t r u
Vehicle Dynamics model
Acceleration measurement model
Measurement model
Range from the station
where are the position and the height of the radar. The position and altitude of each radar are provided in the table below
The truck accelerates from to in first remains at acceleration for next and deccelerates to in the next
Simulate the measured acceleration and the measured ranges based on the above specifications for s at every second. Develop an EKF estimator to
estimate the position, velocity and the accelerometer bias. Show the performance of the implemented EKF using proper figures with error, standard
deviations and residuals
summary
This module contains the classes used to implement various estimation algorithms.
import numpy as np
from scipy.linalg import expm, inv
from scipy.integrate import odeint
class state:
summary
This class is used to store the state of the system at a given time.
x state vector
P state covariance matrix
t time
z predicted observation
res residual
innovationcov innovation covariance matrix
def initselfkwargs:
if lenkwargs:
self.x None
self.P None
self.t None
self.z None
elif lenkwargs:
self.x kwargsx
self.P kwargsP
self.t kwargst
else:
self.x kwargsx
self.P kwargsP
self.t kwargst
self.z kwargsz
self.res kwargsres
self.innovationcov kwargsinnovationcov'
class kalmanfilter:
summary
This class is used to implement the Kalman filter algorithm.
model model of the system
Q process noise covariance matrix
R measurement noise covariance matrix
state initial state of the system
def initself model, Q R state dT:
summary
Args:
model structure:
model.dynamics function: system model dynamics needs to be compatible with odeint
model.Phi function: system jacobian
model.h function: observation model
model.H function: observation jacobian
Q ndarray: process noise covariance
R ndarray: measurement noise covariance
statestate: Initial state information
dT scalar: time step
self.model model
self.Q Q
self.R R
self.statepost state
self.statepriori state
self.dt dT
def KFpredictionself:
summary
Kalman filter prediction step
x self.statepost.x
P self.statepost.P
t self.statepost.t
Phi self.model.Phi
xpriori odeintselfmodel.dynamics, xt t self.dt: #state propagation
Ppriori Phi.dotPdotPhiT self.Q #covariance propagation
zpriori self.model.hxpriori #observation prediction
self.statepriori.x xpriori
self.statepriori.P Ppriori
self.statepriori.z zpriori
self.statepriori.t t
return
def KFcorrectionself observation:
summary
Args:
observation vector: Observation
xpriori self.statepriori.x
Ppriori self.statepriori.P
zpriori self.statepriori.z
H self.model.H
residue observation zpriori
R self.R
if lenRshape:
K Ppriori.dotHTdotinvHdotPprioridotHTR
self.statepost.x xpriori Kdotresidue
self.statepost.P npidentityKdotHdotPprioridotnpidentityKdotHT
KdotRdotKT
else:
K Ppriori.dotHTHdotPprioridotHTR
K KreshapeKshape
#pdbsettrace
self.statepost.x xpriori Kresiduereshapelenxpriori #state update
self.statepost.P npidentityKdo
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
