SlideShare a Scribd company logo
ME231B/EE220C: Programming Project
Muireann Spain
4th May 2020
Contents
1 Prior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Estimator Selection and Design . . . . . . . . . . . . . . . . . 5
4 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1
1 Prior
All edited code was completed in MATLAB and can be found in the
accompanying Gradescope submission.
The below work references both the project brief provided for this project
and Chapter 10: The Extended Kalman Filter in the accompanying course
notes.
2
2 Introduction
The problem specified required the implementation of a state estimator
that tracks the X-coordinate, Y-coordinate and heading angle of a bicycle.
Figure 1 was provided in the project brief, and illustrates the system
model. X1(t) and Y1(t) are the X- and Y- coordinates of the rear wheel, B
is the wheelbase (m), γ(t) is the steering angle relative to the bicycle
frame, θ(t) is the heading angle and ω(t) is the angular velocity of the rear
wheel.
Figure 1: Simple Bicycle Model Used
The bicycle dynamics were predefined as follows:
˙x1(t) = v(t) cos (θ(t)) (1)
˙y1(t) = v(t) sin (θ(t)) (2)
˙θ(t) =
v(t)
B
tan (γ(t)) (3)
where v(t) is the linear velocity of the bicycle.
3
An idealized measurement model p(k) of the discretized position
coordinates was also specified in the project brief:
p(k) =
x1(tk) + 1
2
B cos (θ(tk))
y1(tk) + 1
2
B sin (θ(tk))
(4)
It is known that measurements are obtained approximately every 0.5
seconds, however the sensors are faulty and measurements are not
guaranteed. γ(t) and ω(t) are known with certainty at each time step.
The goal is to design an estimator that can minimize the error in the
prediction of the true position and heading angle of the bicycle at the final
time step.
4
3 Estimator Selection and Design
This project was completed in MATLAB. The Extended Kalman Filter
(EKF) was chosen as an acceptable estimator for this project. The EKF
functions by linearizing the system equations about the current state
estimate, and applying a standard Kalman Filter prior and measurement
update equations to the linearized equations.
In this system, three states were defined for estimation: the X-coordinate
X, the Y-coordinate Y and the heading angle θ.
As shown above in Section 2, the bicycle dynamics were given in terms of a
continuous time model. The state space was discretized at Ts = 0.25s, as
the EKF equations are applied at discrete time intervals - although
measurements are obtained at approximately every 0.5 s, I found 0.25 s to
be optimal. The MATLAB inbuilt state-space model from the control
toolbox was used for this purpose. 1
The continuous time model was specified as follows, and are obtained from
linearizing the system equations about the current state estimate (which
depends on real-time measurements):
A(k) =


1 + v(t) cos (θ(k)) 0 0
0 1 + v(t) sin (θ(k)) 0
0 0 1 + v(t)
B
tan (γ(k))

 (5)
B(k) =


0 0
0 0
0 0

 (6)
H(k) =
1 0 −0.5B sin (θ(k))
0 1 0.5B cos (θ(k))
(7)
1
Interestingly, I accidentally initially used the continuous model in place of the dis-
cretized model, and I actually obtained superior performance from the estimator. How-
ever, this approach is clearly incorrect, and so I sacrificed estimator performance for
modelling accuracy. I am also unable to explain and justify this behaviour!
5
D(k) =
0 0
0 0
(8)
The matrices L(k), M(k) are obtained from the process noise derivative of
the state equation and measurement noise derivative of the measurement
equation respectively. As the process noise
For this system, these matrices are defined as follows:
L(k) =


1 0 0
0 1 0
0 0 1

 (9)
M(k) =
1 0
0 1
(10)
In this case, the position is measured and the heading angle is estimated.
However, given that the position measurements were not guaranteed at
each time step, a contingency was introduced to provide a measurement
estimate from the idealized model specified in Equation 4. When no
real-time measurements were provided, the position update was estimated
by Equation 11, in which α is a random variable in the range [0, 1] which
serves the purpose of added uniform noise.
z(k) =
0.99(x1(tk) + 1
2
B cos (θ(tk))) + 0.01α(x1(tk) + 1
2
B cos (θ(tk)))
0.99(y1(tk) + 1
2
B sin (θ(tk))) + 0.01α(y1(tk) + 1
2
B sin (θ(tk)))
(11)
There were certain other parameters that were defined to meet the
Extended Kalman Filter equation requirements:
V : approximation of the process noise variance,
W: approximation of the measurement noise variance, and
Pm: approximation of the prior conditional variance of the initial states
X,Y and θ.
The values for these parameters are shown in Equations 12, 13 and 14.
These values were converged upon by trial and error measuring the mean
6
and variance of the final error over all 93 data sets. However, the drastic
altering of these values did not have a huge impact on the final estimation
error.
V =


10 0 0
0 10 0
0 0 0.1

 (12)
W =
0.05 0
0 0.05
(13)
Pm =


10 0 0
0 10 0
0 0 0.1

 (14)
7
4 Results
The output of the main() MATLAB function is illustrated in Figure 2 and
Figure 3 for two randomly selected data sets. It can be seen graphically for
both cases that the estimator appears to have a decent approximation of
both the X- and Y- coordinates appear to follow the path in both cases.
The approximation of the heading angle θ is very inaccurate in both data
sets and oscillates significantly which does not represent the true heading
angle.
Figure 2: Estimator Performance For First Data Set
Figure 3: Estimator Performance For 78th Data Set
8
Histograms illustrating the mean and variance of X, Y and θ are shown in
Figures 4, 5 and 6 respectively. This data was obtained by measuring the
final error over all 93 data sets. The observations of these histograms
quantify what was roughly observed from the graphs in Figure 2 and 3.
The position errors are normally distributed, however both resulting errors
have a positive bias of approximately 0.2 m. The distribution of the Final
X-coordinate error has a tighter variance than the Y-coordinate equivalent.
Figure 4: Histogram of Heading Angle Error at Final Position
9
Figure 5: Histogram of Heading Angle Error at Final Position
The distribution of the final heading angle error, however, is uniform and
random. Given that the range of possible values of θ is [−π, π], the
estimator does not estimate the heading angle with any precision. This
may be because no measurements of heading angle are received, and the
value of θ is initialized as π
2
, as it is stated in the project brief that the
cyclist is headed ”approximately North-East” for each of the test cases.
10
Figure 6: Histogram of Heading Angle Error at Final Position
11
5 Conclusion
As stated in the course notes, if the actual state and noise values are close
to the values that we linearize about, then the linearization is a good
approximation of the actual nonlinear dynamics. The underlying
assumption we make, when using the EKF, is that we can push a random
variable through a linear function and use the linearization to compute the
resulting random variable’s statistics.
In the case of Gaussian noise, these quantities are not guaranteed to be
small since the noise is actually unbounded.
The EKF provides only an approximation of the conditional mean and
variance, and not the true value. In the case of this bicycle system,
significant effort was made to tune the parameters V , W, Pm(0) along
with the initial conditions of the state. This tuning resulted in little
reduction of the variance of the final error of the state estimation. The
EKF can be applied in this system, as the simplified bicycle dynamics are
not extremely nonlinear and the distribution is unimodal. The use of a
simplified model and the lack of measurement data for each time step
result in added uncertainty of estimation.
However, in hindsight the Unscented Kalman Filter or the Particle Filter
would probably provide a more accurate state estimation of this system’s
true final position.
12

More Related Content

What's hot

Linear Control Hard-Disk Read/Write Controller Assignment
Linear Control Hard-Disk Read/Write Controller AssignmentLinear Control Hard-Disk Read/Write Controller Assignment
Linear Control Hard-Disk Read/Write Controller Assignment
Isham Rashik
 
ME 644 Trebuchet Parametric Design Optimization
ME 644 Trebuchet Parametric Design OptimizationME 644 Trebuchet Parametric Design Optimization
ME 644 Trebuchet Parametric Design OptimizationBenjamin Johnson
 
A New Approach to Design a Reduced Order Observer
A New Approach to Design a Reduced Order ObserverA New Approach to Design a Reduced Order Observer
A New Approach to Design a Reduced Order Observer
IJERD Editor
 
Alternating direction-implicit-finite-difference-method-for-transient-2 d-hea...
Alternating direction-implicit-finite-difference-method-for-transient-2 d-hea...Alternating direction-implicit-finite-difference-method-for-transient-2 d-hea...
Alternating direction-implicit-finite-difference-method-for-transient-2 d-hea...
Abimbola Ashaju
 
The cubic root unscented kalman filter to estimate the position and orientat...
The cubic root unscented kalman filter to estimate  the position and orientat...The cubic root unscented kalman filter to estimate  the position and orientat...
The cubic root unscented kalman filter to estimate the position and orientat...
IJECEIAES
 
control engineering revision
control engineering revisioncontrol engineering revision
control engineering revision
ragu nath
 
[Review] contact model fusion
[Review] contact model fusion[Review] contact model fusion
[Review] contact model fusion
Hancheol Choi
 
Fieldtheoryhighlights2015 setb
Fieldtheoryhighlights2015 setbFieldtheoryhighlights2015 setb
Fieldtheoryhighlights2015 setb
foxtrot jp R
 
Reduction of multiple subsystem [compatibility mode]
Reduction of multiple subsystem [compatibility mode]Reduction of multiple subsystem [compatibility mode]
Reduction of multiple subsystem [compatibility mode]azroyyazid
 
Algorithms for Global Positioning
Algorithms for Global PositioningAlgorithms for Global Positioning
Algorithms for Global Positioning
Kevin Le
 
Review robot-collisions-survey
Review robot-collisions-surveyReview robot-collisions-survey
Review robot-collisions-survey
Hancheol Choi
 
Lossless image compression via by lifting scheme
Lossless image compression via by lifting schemeLossless image compression via by lifting scheme
Lossless image compression via by lifting schemeSubhashini Subramanian
 
PID Controller Design for a Real Time Ball and Beam System – A Double Integra...
PID Controller Design for a Real Time Ball and Beam System – A Double Integra...PID Controller Design for a Real Time Ball and Beam System – A Double Integra...
PID Controller Design for a Real Time Ball and Beam System – A Double Integra...
idescitation
 
Chapter 8 Root Locus Techniques
Chapter 8 Root Locus TechniquesChapter 8 Root Locus Techniques
Chapter 8 Root Locus Techniquesguesta0c38c3
 
FDM Numerical solution of Laplace Equation using MATLAB
FDM Numerical solution of Laplace Equation using MATLABFDM Numerical solution of Laplace Equation using MATLAB
FDM Numerical solution of Laplace Equation using MATLAB
Aya Zaki
 
Module 5
Module 5Module 5
Module 5
Mohammad Javed
 
SIMMECHANICS VISUALIZATION OF EXPERIMENTAL MODEL OVERHEAD CRANE, ITS LINEARIZ...
SIMMECHANICS VISUALIZATION OF EXPERIMENTAL MODEL OVERHEAD CRANE, ITS LINEARIZ...SIMMECHANICS VISUALIZATION OF EXPERIMENTAL MODEL OVERHEAD CRANE, ITS LINEARIZ...
SIMMECHANICS VISUALIZATION OF EXPERIMENTAL MODEL OVERHEAD CRANE, ITS LINEARIZ...
ijccmsjournal
 

What's hot (20)

Linear Control Hard-Disk Read/Write Controller Assignment
Linear Control Hard-Disk Read/Write Controller AssignmentLinear Control Hard-Disk Read/Write Controller Assignment
Linear Control Hard-Disk Read/Write Controller Assignment
 
ME 644 Trebuchet Parametric Design Optimization
ME 644 Trebuchet Parametric Design OptimizationME 644 Trebuchet Parametric Design Optimization
ME 644 Trebuchet Parametric Design Optimization
 
A New Approach to Design a Reduced Order Observer
A New Approach to Design a Reduced Order ObserverA New Approach to Design a Reduced Order Observer
A New Approach to Design a Reduced Order Observer
 
Alternating direction-implicit-finite-difference-method-for-transient-2 d-hea...
Alternating direction-implicit-finite-difference-method-for-transient-2 d-hea...Alternating direction-implicit-finite-difference-method-for-transient-2 d-hea...
Alternating direction-implicit-finite-difference-method-for-transient-2 d-hea...
 
The cubic root unscented kalman filter to estimate the position and orientat...
The cubic root unscented kalman filter to estimate  the position and orientat...The cubic root unscented kalman filter to estimate  the position and orientat...
The cubic root unscented kalman filter to estimate the position and orientat...
 
control engineering revision
control engineering revisioncontrol engineering revision
control engineering revision
 
[Review] contact model fusion
[Review] contact model fusion[Review] contact model fusion
[Review] contact model fusion
 
Foreman-Report2
Foreman-Report2Foreman-Report2
Foreman-Report2
 
Fieldtheoryhighlights2015 setb
Fieldtheoryhighlights2015 setbFieldtheoryhighlights2015 setb
Fieldtheoryhighlights2015 setb
 
Reduction of multiple subsystem [compatibility mode]
Reduction of multiple subsystem [compatibility mode]Reduction of multiple subsystem [compatibility mode]
Reduction of multiple subsystem [compatibility mode]
 
Algorithms for Global Positioning
Algorithms for Global PositioningAlgorithms for Global Positioning
Algorithms for Global Positioning
 
Review robot-collisions-survey
Review robot-collisions-surveyReview robot-collisions-survey
Review robot-collisions-survey
 
Hsieh etal spl
Hsieh etal splHsieh etal spl
Hsieh etal spl
 
Lossless image compression via by lifting scheme
Lossless image compression via by lifting schemeLossless image compression via by lifting scheme
Lossless image compression via by lifting scheme
 
PID Controller Design for a Real Time Ball and Beam System – A Double Integra...
PID Controller Design for a Real Time Ball and Beam System – A Double Integra...PID Controller Design for a Real Time Ball and Beam System – A Double Integra...
PID Controller Design for a Real Time Ball and Beam System – A Double Integra...
 
Chapter 8 Root Locus Techniques
Chapter 8 Root Locus TechniquesChapter 8 Root Locus Techniques
Chapter 8 Root Locus Techniques
 
Relatório
RelatórioRelatório
Relatório
 
FDM Numerical solution of Laplace Equation using MATLAB
FDM Numerical solution of Laplace Equation using MATLABFDM Numerical solution of Laplace Equation using MATLAB
FDM Numerical solution of Laplace Equation using MATLAB
 
Module 5
Module 5Module 5
Module 5
 
SIMMECHANICS VISUALIZATION OF EXPERIMENTAL MODEL OVERHEAD CRANE, ITS LINEARIZ...
SIMMECHANICS VISUALIZATION OF EXPERIMENTAL MODEL OVERHEAD CRANE, ITS LINEARIZ...SIMMECHANICS VISUALIZATION OF EXPERIMENTAL MODEL OVERHEAD CRANE, ITS LINEARIZ...
SIMMECHANICS VISUALIZATION OF EXPERIMENTAL MODEL OVERHEAD CRANE, ITS LINEARIZ...
 

Similar to Programming project

Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...
Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...
Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...
Alexander Litvinenko
 
Balancing Robot Kalman Filter Design – Estimation Theory Project
Balancing Robot Kalman Filter Design – Estimation Theory ProjectBalancing Robot Kalman Filter Design – Estimation Theory Project
Balancing Robot Kalman Filter Design – Estimation Theory Project
Surya Chandra
 
SLAM of Multi-Robot System Considering Its Network Topology
SLAM of Multi-Robot System Considering Its Network TopologySLAM of Multi-Robot System Considering Its Network Topology
SLAM of Multi-Robot System Considering Its Network Topologytoukaigi
 
MODELLING ANALYSIS & DESIGN OF DSP BASED NOVEL SPEED SENSORLESS VECTOR CONTRO...
MODELLING ANALYSIS & DESIGN OF DSP BASED NOVEL SPEED SENSORLESS VECTOR CONTRO...MODELLING ANALYSIS & DESIGN OF DSP BASED NOVEL SPEED SENSORLESS VECTOR CONTRO...
MODELLING ANALYSIS & DESIGN OF DSP BASED NOVEL SPEED SENSORLESS VECTOR CONTRO...
IAEME Publication
 
IFAC2008art
IFAC2008artIFAC2008art
IFAC2008artYuri Kim
 
The Controller Design For Linear System: A State Space Approach
The Controller Design For Linear System: A State Space ApproachThe Controller Design For Linear System: A State Space Approach
The Controller Design For Linear System: A State Space Approach
Yang Hong
 
Using Generic Image Processing Operations to Detect a Calibration Grid
Using Generic Image Processing Operations to Detect a Calibration GridUsing Generic Image Processing Operations to Detect a Calibration Grid
Using Generic Image Processing Operations to Detect a Calibration Grid
Jan Wedekind
 
Maneuvering target track prediction model
Maneuvering target track prediction modelManeuvering target track prediction model
Maneuvering target track prediction model
IJCI JOURNAL
 
Stability and pole location
Stability and pole locationStability and pole location
Stability and pole location
ssuser5d64bb
 
PG Project
PG ProjectPG Project
PG Project
mathew1122
 
videoMotionTrackingPCA
videoMotionTrackingPCAvideoMotionTrackingPCA
videoMotionTrackingPCAKellen Betts
 
Kk2518251830
Kk2518251830Kk2518251830
Kk2518251830
IJERA Editor
 
Kk2518251830
Kk2518251830Kk2518251830
Kk2518251830
IJERA Editor
 
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
ieijjournal
 
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
ieijjournal
 

Similar to Programming project (20)

Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...
Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...
Computation of Electromagnetic Fields Scattered from Dielectric Objects of Un...
 
Balancing Robot Kalman Filter Design – Estimation Theory Project
Balancing Robot Kalman Filter Design – Estimation Theory ProjectBalancing Robot Kalman Filter Design – Estimation Theory Project
Balancing Robot Kalman Filter Design – Estimation Theory Project
 
Ball and beam
Ball and beamBall and beam
Ball and beam
 
SLAM of Multi-Robot System Considering Its Network Topology
SLAM of Multi-Robot System Considering Its Network TopologySLAM of Multi-Robot System Considering Its Network Topology
SLAM of Multi-Robot System Considering Its Network Topology
 
MODELLING ANALYSIS & DESIGN OF DSP BASED NOVEL SPEED SENSORLESS VECTOR CONTRO...
MODELLING ANALYSIS & DESIGN OF DSP BASED NOVEL SPEED SENSORLESS VECTOR CONTRO...MODELLING ANALYSIS & DESIGN OF DSP BASED NOVEL SPEED SENSORLESS VECTOR CONTRO...
MODELLING ANALYSIS & DESIGN OF DSP BASED NOVEL SPEED SENSORLESS VECTOR CONTRO...
 
IFAC2008art
IFAC2008artIFAC2008art
IFAC2008art
 
The Controller Design For Linear System: A State Space Approach
The Controller Design For Linear System: A State Space ApproachThe Controller Design For Linear System: A State Space Approach
The Controller Design For Linear System: A State Space Approach
 
Using Generic Image Processing Operations to Detect a Calibration Grid
Using Generic Image Processing Operations to Detect a Calibration GridUsing Generic Image Processing Operations to Detect a Calibration Grid
Using Generic Image Processing Operations to Detect a Calibration Grid
 
Maneuvering target track prediction model
Maneuvering target track prediction modelManeuvering target track prediction model
Maneuvering target track prediction model
 
Stability and pole location
Stability and pole locationStability and pole location
Stability and pole location
 
solver (1)
solver (1)solver (1)
solver (1)
 
Work
WorkWork
Work
 
PG Project
PG ProjectPG Project
PG Project
 
videoMotionTrackingPCA
videoMotionTrackingPCAvideoMotionTrackingPCA
videoMotionTrackingPCA
 
Report Final
Report FinalReport Final
Report Final
 
Kk2518251830
Kk2518251830Kk2518251830
Kk2518251830
 
Kk2518251830
Kk2518251830Kk2518251830
Kk2518251830
 
Lab3_final
Lab3_finalLab3_final
Lab3_final
 
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
 
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
FITTED OPERATOR FINITE DIFFERENCE METHOD FOR SINGULARLY PERTURBED PARABOLIC C...
 

Recently uploaded

Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 

Recently uploaded (20)

Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 

Programming project

  • 2. Contents 1 Prior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3 Estimator Selection and Design . . . . . . . . . . . . . . . . . 5 4 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1
  • 3. 1 Prior All edited code was completed in MATLAB and can be found in the accompanying Gradescope submission. The below work references both the project brief provided for this project and Chapter 10: The Extended Kalman Filter in the accompanying course notes. 2
  • 4. 2 Introduction The problem specified required the implementation of a state estimator that tracks the X-coordinate, Y-coordinate and heading angle of a bicycle. Figure 1 was provided in the project brief, and illustrates the system model. X1(t) and Y1(t) are the X- and Y- coordinates of the rear wheel, B is the wheelbase (m), γ(t) is the steering angle relative to the bicycle frame, θ(t) is the heading angle and ω(t) is the angular velocity of the rear wheel. Figure 1: Simple Bicycle Model Used The bicycle dynamics were predefined as follows: ˙x1(t) = v(t) cos (θ(t)) (1) ˙y1(t) = v(t) sin (θ(t)) (2) ˙θ(t) = v(t) B tan (γ(t)) (3) where v(t) is the linear velocity of the bicycle. 3
  • 5. An idealized measurement model p(k) of the discretized position coordinates was also specified in the project brief: p(k) = x1(tk) + 1 2 B cos (θ(tk)) y1(tk) + 1 2 B sin (θ(tk)) (4) It is known that measurements are obtained approximately every 0.5 seconds, however the sensors are faulty and measurements are not guaranteed. γ(t) and ω(t) are known with certainty at each time step. The goal is to design an estimator that can minimize the error in the prediction of the true position and heading angle of the bicycle at the final time step. 4
  • 6. 3 Estimator Selection and Design This project was completed in MATLAB. The Extended Kalman Filter (EKF) was chosen as an acceptable estimator for this project. The EKF functions by linearizing the system equations about the current state estimate, and applying a standard Kalman Filter prior and measurement update equations to the linearized equations. In this system, three states were defined for estimation: the X-coordinate X, the Y-coordinate Y and the heading angle θ. As shown above in Section 2, the bicycle dynamics were given in terms of a continuous time model. The state space was discretized at Ts = 0.25s, as the EKF equations are applied at discrete time intervals - although measurements are obtained at approximately every 0.5 s, I found 0.25 s to be optimal. The MATLAB inbuilt state-space model from the control toolbox was used for this purpose. 1 The continuous time model was specified as follows, and are obtained from linearizing the system equations about the current state estimate (which depends on real-time measurements): A(k) =   1 + v(t) cos (θ(k)) 0 0 0 1 + v(t) sin (θ(k)) 0 0 0 1 + v(t) B tan (γ(k))   (5) B(k) =   0 0 0 0 0 0   (6) H(k) = 1 0 −0.5B sin (θ(k)) 0 1 0.5B cos (θ(k)) (7) 1 Interestingly, I accidentally initially used the continuous model in place of the dis- cretized model, and I actually obtained superior performance from the estimator. How- ever, this approach is clearly incorrect, and so I sacrificed estimator performance for modelling accuracy. I am also unable to explain and justify this behaviour! 5
  • 7. D(k) = 0 0 0 0 (8) The matrices L(k), M(k) are obtained from the process noise derivative of the state equation and measurement noise derivative of the measurement equation respectively. As the process noise For this system, these matrices are defined as follows: L(k) =   1 0 0 0 1 0 0 0 1   (9) M(k) = 1 0 0 1 (10) In this case, the position is measured and the heading angle is estimated. However, given that the position measurements were not guaranteed at each time step, a contingency was introduced to provide a measurement estimate from the idealized model specified in Equation 4. When no real-time measurements were provided, the position update was estimated by Equation 11, in which α is a random variable in the range [0, 1] which serves the purpose of added uniform noise. z(k) = 0.99(x1(tk) + 1 2 B cos (θ(tk))) + 0.01α(x1(tk) + 1 2 B cos (θ(tk))) 0.99(y1(tk) + 1 2 B sin (θ(tk))) + 0.01α(y1(tk) + 1 2 B sin (θ(tk))) (11) There were certain other parameters that were defined to meet the Extended Kalman Filter equation requirements: V : approximation of the process noise variance, W: approximation of the measurement noise variance, and Pm: approximation of the prior conditional variance of the initial states X,Y and θ. The values for these parameters are shown in Equations 12, 13 and 14. These values were converged upon by trial and error measuring the mean 6
  • 8. and variance of the final error over all 93 data sets. However, the drastic altering of these values did not have a huge impact on the final estimation error. V =   10 0 0 0 10 0 0 0 0.1   (12) W = 0.05 0 0 0.05 (13) Pm =   10 0 0 0 10 0 0 0 0.1   (14) 7
  • 9. 4 Results The output of the main() MATLAB function is illustrated in Figure 2 and Figure 3 for two randomly selected data sets. It can be seen graphically for both cases that the estimator appears to have a decent approximation of both the X- and Y- coordinates appear to follow the path in both cases. The approximation of the heading angle θ is very inaccurate in both data sets and oscillates significantly which does not represent the true heading angle. Figure 2: Estimator Performance For First Data Set Figure 3: Estimator Performance For 78th Data Set 8
  • 10. Histograms illustrating the mean and variance of X, Y and θ are shown in Figures 4, 5 and 6 respectively. This data was obtained by measuring the final error over all 93 data sets. The observations of these histograms quantify what was roughly observed from the graphs in Figure 2 and 3. The position errors are normally distributed, however both resulting errors have a positive bias of approximately 0.2 m. The distribution of the Final X-coordinate error has a tighter variance than the Y-coordinate equivalent. Figure 4: Histogram of Heading Angle Error at Final Position 9
  • 11. Figure 5: Histogram of Heading Angle Error at Final Position The distribution of the final heading angle error, however, is uniform and random. Given that the range of possible values of θ is [−π, π], the estimator does not estimate the heading angle with any precision. This may be because no measurements of heading angle are received, and the value of θ is initialized as π 2 , as it is stated in the project brief that the cyclist is headed ”approximately North-East” for each of the test cases. 10
  • 12. Figure 6: Histogram of Heading Angle Error at Final Position 11
  • 13. 5 Conclusion As stated in the course notes, if the actual state and noise values are close to the values that we linearize about, then the linearization is a good approximation of the actual nonlinear dynamics. The underlying assumption we make, when using the EKF, is that we can push a random variable through a linear function and use the linearization to compute the resulting random variable’s statistics. In the case of Gaussian noise, these quantities are not guaranteed to be small since the noise is actually unbounded. The EKF provides only an approximation of the conditional mean and variance, and not the true value. In the case of this bicycle system, significant effort was made to tune the parameters V , W, Pm(0) along with the initial conditions of the state. This tuning resulted in little reduction of the variance of the final error of the state estimation. The EKF can be applied in this system, as the simplified bicycle dynamics are not extremely nonlinear and the distribution is unimodal. The use of a simplified model and the lack of measurement data for each time step result in added uncertainty of estimation. However, in hindsight the Unscented Kalman Filter or the Particle Filter would probably provide a more accurate state estimation of this system’s true final position. 12