$30.00
1 Introduction
In this project, you will complete the following goals:
1. Check controllability and observability of the system.
2. For lateral control of the vehicle, design a feedback control matrix using poleplacement.
[Remember to submit the writeup and codes on the Gradescope]
2
2 Model
When the objective is to develop a steering control system for automatic lane keeping, it is
useful to utilize a dynamic model in which the state variables are in terms of position and
orientation error with respect to the road [1].
Hence the linearized model derived in Exercise 1, P1 can be redefined in terms of errors
in the state variables.
The errorbased linearized statespace system should be used for designing the controllers
henceforth.
3
3 Resources
3.1 Buggy Simulator
A Buggy Simulator designed in python has been provided along with the assignment. The
simulator takes the control command[steering, longitudinal Force] and then outputs the
buggy state after the given fixed time step (fixed fps). Additional script util.py contains
functions to help you design and execute the controller. Please design your controller in
controller.py. After the complete run, a response plot is generated by the simulator. This
plot contains visualization of the buggy trajectory and variation of states with respect to
time.
3.2 Trajectory Data
The trajectory is given in buggyTrace.csv. It contains the coordinates of the trajectory:
(x, y). The satellite map of the track is shown in Figure 1.
Figure 1: Buggy track[3]
4
4 P2:Problems [Due 5:00 PM, November 19]
Exercise 1. Consider the linearized, errorbased state space system for the vehicle:
1. Check the controllability and observability of the system at the following longitudinal
velocities: 2 m/s, 5 m/s and 8 m/s.
2. For longitudinal velocities V from 1m/s to 40 m/s, plot the following:
(a) log10(
σ1
σn
) vs V (m/s), where σi
: i’th singular value of the controllability matrix P
(i=1,2,…….n).
(b) Re(pi) vs V (m/s), where Re:Real part, pi
: i’th pole of the continuous state space
system. [Use 4 subplots, one for each of the 4 poles]
Also, what can you conclude about the controllability and stability of the system, by
observing these two plots.
[Submit you answers in the pdf file and also the python script. The python script should be
named Q1.py]
5
Exercise 2. Consider the linearized, errorbased state space model of the vehicle:
For the lateral control of the vehicle, design a state feedback control matrix F using pole
placement. Tune the poles of the closed loop system such that it can achieve the performance
criteria mentioned below.
For the longitudinal control, use a PID controller.
Design the controllers in controller.py.
[You have to edit only the controller.py python script]
Execute the main.py python script to check your controller. It generates a performance plot
and saves the vehicle states in a .npz file. Submit the Buggy states in .npz file, the response
plots in pdf file, and your controller in the controller.py script.
Your controller is required to achieve the following performance criteria:
1. Time to complete the loop = 410 s
2. Maximum deviation from the reference trajectory = 8.0 m
3. Average deviation from the reference trajectory = 4.5 m
6
5 Appendix
(Already covered in P1)
Figure 2: Bicycle model[2]
Figure 3: Tire slipangle[2]
Here you will use the bicycle model for the vehicle, which is a popular model in the study
of vehicle dynamics. Shown in Figure 2, the car is modeled as a twowheel vehicle in two
degree of freedom, described in longitudinal and lateral dynamics separately. The model
parameters are defined in Table 1.
5.1 Lateral dynamics
Ignoring road bank angle and applying Newton’s second law of motion along the y axis
may = Fyf cos δf + Fyr
where ay =
d
2
y
dt2
inertial
is the inertial acceleration of the vehicle at the center of geometry
in the direction of the y axis, Fyf and Fyr are the lateral tire forces of the front and rear
7
wheels respectively and δf is the front wheel angle which will be denoted as δ later. Two
terms contribute to ay: the acceleration ¨y which is due to motion along the y axis and the
centripetal acceleration . Hence
ay = ¨y + ψ˙x˙
Combining the two equations, the equation for the lateral translational motion of the vehicle
is obtained as
y¨ = −ψ˙x˙ +
1
m
(Fyf cos δ + Fyr)
Moment balance about the axis yields the equation for the yaw dynamics as
ψI¨
z = lfFyf − lrFyr
The next step is to model the lateral tire forces Fyf and Fyr. Experimental results show
that the lateral tire force of a tire is proportional to the slipangle for small slipangles when
vehicle’s speed is large enough, let’s say when ˙x ≥ 0.5 m/s. The slip angle of a tire is defined
as the angle between the orientation of the tire and the orientation of the velocity vector of
the vehicle. the slip angle of the front and rear wheel is
αf = δ − θV f
αr = −θV r
where θV p is the angle between the velocity vector and the longitudinal axis of the vehicle,
for p ∈ {f, r}. A linear approximation of the tire forces are given by
Fyf = 2Cα
δ −
y˙ + lfψ˙
x˙
!
Fyr = 2Cα
−
y˙ − lrψ˙
x˙
!
where Cα is called the cornering stiffness of tires. If ˙x < 0.5 m/s, we just set Fyf and Fyr
both to zeros.
5.2 Longitudinal dynamics
Similarly, a force balance along the vehicle longitudinal axis yields
x¨ = ψ˙y˙ + ax
max = F − sign( ˙x)Ff
Ff = fmg
where F is the total tire force along x axis, Ff is the force due to rolling resistance at the
tires, and f is the friction coefficient. sign function returns +1 when ˙x ≥ 1 otherwise 1.
8
5.3 Global coordinates
In the global frame we have
X˙ = ˙x cos ψ − y˙ sin ψ
Y˙ = ˙x sin ψ + ˙y cos ψ
5.4 System equation
Gathering all the equations, if ˙x ≥ 0.5 m/s we have:
y¨ = −ψ˙x˙ +
2Cα
m
(cos δ
δ −
y˙ + lfψ˙
x˙
!
−
y˙ − lrψ˙
x˙
)
x¨ = ψ˙y˙ +
1
m
(F − fmg)
ψ¨ =
2lfCα
Iz
δ −
y˙ + lfψ˙
x˙
!
−
2lrCα
Iz
−
y˙ − lrψ˙
x˙
!
X˙ = ˙x cos ψ − y˙ sin ψ
Y˙ = ˙x sin ψ + ˙y cos ψ
otherwise since the lateral tire forces are zeros we only consider the longitudinal model.
5.5 Measurements
The observable states are with some Gaussian noise = N(0, σ), where
y =
x˙
y˙
ψ˙
X
Y
ψ
+ , σ =
0.5 · · · 0
0.5
0.05
.
.
. 0.05
1
0 0.5
.
5.6 Physical constraints
The system satisfies the constraints that:
δ 6
π
6
rad/s

˙δ 6
π
6
rad/s
F 6 10000 N
0 m/s 6 x˙ 6 100 m/s
y˙ 6 10m/s
9
Table 1: Model parameters.
Name Description Unit Value
( ˙x, y˙) Vehicle’s velocity along the direction of
vehicle frame
m/s State
(X, Y ) Vehicle’s coordinates in the world
frame
m State
ψ, ψ˙ Body yaw angle, angular speed rad State
δ or δf Front wheel angle rad State
˙δ Steering Rate rad Input
F Total input force N Input
lr Length from front tire to the center of
mass
m 1.7
lf Length from front tire to the center of
mass
m 1.1
Cα Cornering stiffness of each tire N 15000
Iz Yaw intertia kg mˆ2 3344
Fpq Tire force, p ∈ {x, y},q ∈ {f, r} N Depend on input force
m vehicle mass Kg 2000
f Friction coefficient 1 0.01
6 Reference
1. Rajamani Rajesh. Vehicle dynamics and control. Springer Science & Business Media,
2011.
2. Kong Jason, et al. ”Kinematic and dynamic vehicle models for autonomous driving
control design.” Intelligent Vehicles Symposium, 2015.
3. cmubuggy.org, https://cmubuggy.org/reference/File:Course_hill1.png
10
WhatsApp us