Project: Part 2
24-677 Modern Control Theory - Modern Control for Robotics
Prof. D. Zhao
Due: Nov 7, 2025, 11:59 pm. Submit within the deadline.
• Your online version and its timestamp will be used for assessment.
• We will use Gradescope to grade. The link is on the panel of CANVAS. If you are
confused about the tool, post your questions on Campuswire.
• Submit your [Link] to Gradescope under P2-code and your solutions in .pdf
format to P2-writeup. Insert the performance plot image in the .pdf. We will test
your [Link] and manually check all answers.
• We will make extensive use of Webots, an open-source robotics simulation software,
for this project. Webots is available here for Windows, Mac, and Linux.
• For Python usage with Webots, please see the Webots page on Python. Note that
you may have to reinstall libraries like numpy, matplotlib, scipy, etc. for the
environment you use Webots in.
• Please familiarize yourself with Webots documentation, specifically their User Guide
and their Webots for Automobiles section, if you encounter difficulties in setup or use.
It will help to have a good understanding of the underlying tools that will be used in
this assignment. To that end, completing at least Tutorial 1 in the user guide is highly
recommended.
• If you have issues with Webots that are beyond the scope of the documentation (e.g.
the software runs too slow, crashes, or has other odd behavior), please let the TAs
know via Campuswire. We will do our best to help.
• We advise you to start with the assignment early. All the submissions are to be done
before the respective deadlines of each assignment. For information about the late
days and scale of your Final Grade, refer to the Syllabus in Canvas.
1
1 Introduction
In this part of the project, you will complete the following two assignments:
1. Check the controllability and stabilizability of the linearized system
2. Design a lateral full-state feedback controller
[Remember to submit the write-up, plots, and codes on Gradescope.]
2 Model
The error-based linearized state-space for the lateral dynamics is as follows.
e1 is the distance to the center of gravity of the vehicle from the reference trajectory.
e2 is the orientation error of the vehicle with respect to the reference trajectory.
0 1 0 0
o
e1 e1 0 0
4Cα 4Cα 2Cα (lf −lr ) 2Cα 2Cα (lf −lr )
d e˙1 0
− mẋ m
− mẋ e˙1 m 0 δ + − mẋ − ẋ
= 0 + 0 ψ̇des
dt e2
0 0 1 e2 0 F 0
2 2
2Cα (lf +lr ) 2Cα lf 2 2
2Cα (lf +lr )
e˙2 2C (l −l ) 2Cα (lf −lr ) e˙2 0
0 − αIzfẋ r Iz
− Iz ẋ Iz − Iz ẋ
In lateral vehicle dynamics, ψ̇des is a time-varying disturbance in the state space equation.
Its value is proportional to the longitudinal speed when the radius of the road is constant.
When deriving the error-based state space model for controller design, ψ̇des can be safely
assumed to be zero.
0 1 0 0
e1 e1 0 0
2C (l −l )
− 4C 4Cα
− αmfẋ r 2C
d 0 α α
0
e˙1 =
0 mẋ m e˙1
+ 0
m δ
dt e2
0 0 1 e2 0 F
2Cα (lf −lr ) 2Cα (lf −lr ) 2Cα (lf2 +lr2 ) 2Cα lf
e˙2 0 − Iz ẋ − Iz ẋ e˙2 Iz
0
Iz
For the longitudinal control:
d x 0 1 x 0 0 δ 0
= + 1 +
dt ẋ 0 0 ẋ 0 m
F ψ̇ ẏ − f g
Assuming ψ̇ = 0:
d x 0 1 x 0 0 δ
= + 1
dt ẋ 0 0 ẋ 0 m
F
2
3 P2: Problems
Exercise 1. Considering the linearized, error-based state space system for the vehicle in
the Model section above:
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 1 m/s to 40 m/s, plot the following:
(a) log10 ( σσn1 ) versus v (m/s), where σi is the ith singular value of the controllability
matrix P (i = 1, 2, ..., n). (In other words, what is the logarithm of the greatest
singular value divided by the smallest?)
(b) Re(pi ) versus v (m/s), where Re is real part and pi is the ith pole of the continuous
state space system. [Use 4 subplots, one for each of the 4 poles]
What conclusions can you draw about the overall controllability and stability of the
system in observing these two plots?
[Submit you answers in the .pdf file and also submit the Python script. The Python script
should be named [Link]]
3
Exercise 2. For the lateral control of the vehicle, design a state feedback controller using
pole placement. Tune the poles of the closed loop system such that it can achieve the per-
formance criteria mentioned below.
You can reuse your longitudinal PID controller from part 1 of this project, or even im-
prove upon it. However, it may require retuning based on observed performance.
Design the two controllers in your [Link]. You can make use of Webots’ built-
in code editor, or use your own.
Check the performance of your controller by running the Webots simulation. You can press
the play button in the top menu to start the simulation in real-time, the fast-forward button
to run the simulation as quickly as possible, and the triple fast-forward to run the simulation
without rendering (any of these options is acceptable, and the faster options may be better
for quick tests). If you complete the track, the scripts will generate a performance plot via
matplotlib. This plot contains a visualization of the car’s trajectory, and also shows the
variation of states with respect to time.
Submit your [Link] and the final completion plot as described on the title page.
Your controller is required to achieve the following performance criteria to receive full
points:
1. Time to complete the loop = 350 s
2. Maximum deviation from the reference trajectory = 9.0 m
3. Average deviation from the reference trajectory = 4.5 m
Some hints that may be useful:
• The signal subpackage within scipy is required for this part. Please investigate which
functions you will need to use. The main goal is to calculate a gain matrix K such
that −Kx = u, where x is the states and u is the control input.
• It is somewhat difficult to tune pole-placement controllers. Learning optimal control
in the next submodule will fortunately make this task much easier. Some tips to help
for this assignment follow.
– Poles must be negative if the system is stable.
– Poles can be complex, where an imaginary number is denoted with j, e.g. -3+1j .
If you use a complex pole, you must also include its complex conjugate.
– Don’t use the poles from Exercise 1 as a starting point - these are the system’s
open-loop poles. Your goal is to select new positions for the closed-loop poles.
– Poles placed closer to the imaginary axis (in other words, closer to 0 on the real
axis) will dominate the system response. These poles allow the system to converge
quickly.
4
– The further poles are placed from the imaginary axis, the less influence they have.
The same is true for poles which are further from the real axis. If all poles are
fairly distant, the system will have a slow response.
– Having at least one dominant pole to help the system to converge is recommended.
The placement of your other poles is up to you based on your performance. Al-
ternatively, you can also place a pair of conjugate poles close to the imaginary
axis, and keep the other two away from it.
• The controller itself can be continuous or discrete - it is your choice whether to discretize
the system or not.
5
4 Appendix
(Already covered in P1)
Figure 1: Bicycle model[2]
Figure 2: Tire slip-angle[2]
We will make use of a bicycle model for the vehicle, which is a popular model in the
study of vehicle dynamics. Shown in Figure 1, the car is modeled as a two-wheel vehicle
with two degrees of freedom, described separately in longitudinal and lateral dynamics. The
model parameters are defined in Table 2.
4.1 Lateral dynamics
Ignoring road bank angle and applying Newton's second law of motion along the y-axis:
may = Fyf cos δf + Fyr
d2 y
where ay = is the inertial acceleration of the vehicle at the center of geometry
dt2 inertial
in the direction of the y axis, Fyf and Fyr are the lateral tire forces of the front and rear
6
wheels, respectively, and δf is the front wheel angle, which will be denoted as δ later. Two
terms contribute to ay : the acceleration ÿ, which is due to motion along the y-axis, and the
centripetal acceleration. Hence:
ay = ÿ + ψ̇ ẋ
Combining the two equations, the equation for the lateral translational motion of the vehicle
is obtained as:
1
ÿ = −ψ̇ ẋ + (Fyf cos δ + Fyr )
m
Moment balance about the axis yields the equation for the yaw dynamics as
ψ̈Iz = lf Fyf − lr Fyr
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 “slip-angle” for small slip-angles when
vehicle’s speed is large enough - i.e. when ẋ ≥ 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
!
ẏ + lf ψ̇
Fyf = 2Cα δ −
ẋ
!
ẏ − lr ψ̇
Fyr = 2Cα −
ẋ
where Cα is called the cornering stiffness of the tires. If ẋ < 0.5 m/s, we just set Fyf and
Fyr both to zeros.
4.2 Longitudinal dynamics
Similarly, a force balance along the vehicle longitudinal axis yields:
ẍ = ψ̇ ẏ + ax
max = F − Ff
Ff = f mg
where F is the total tire force along the x-axis, and Ff is the force due to rolling resistance
at the tires, and f is the friction coefficient.
7
4.3 Global coordinates
In the global frame we have:
Ẋ = ẋ cos ψ − ẏ sin ψ
Ẏ = ẋ sin ψ + ẏ cos ψ
4.4 System equation
Gathering all of the equations, if ẋ ≥ 0.5 m/s, we have:
!
2Cα ẏ + lf ψ̇ ẏ − lr ψ̇
ÿ = −ψ̇ ẋ + (cos δ δ − − )
m ẋ ẋ
1
ẍ = ψ̇ ẏ + (F − f mg)
m ! !
2lf Cα ẏ + lf ψ̇ 2lr Cα ẏ − lr ψ̇
ψ̈ = δ− − −
Iz ẋ Iz ẋ
Ẋ = ẋ cos ψ − ẏ sin ψ
Ẏ = ẋ sin ψ + ẏ cos ψ
otherwise, since the lateral tire forces are zeros, we only consider the longitudinal model.
4.5 Measurements
The observable states are:
ẋ
ẏ
ψ̇
y=
X
Y
ψ
4.6 Physical constraints
The system satisfies the constraints that:
|δ| ⩽ π6 rad
F ⩾ 0 and F ⩽ 15736 N
ẋ ⩾ 10−5 m/s
8
Table 1: Model parameters.
Name Description Unit Value
(ẋ, ẏ) Vehicle’s velocity along the direction of m/s State
vehicle frame
(X, Y ) Vehicle’s coordinates in the world m State
frame
ψ, ψ̇ Body yaw angle, angular speed rad, State
rad/s
δ or δf Front wheel angle rad Input
F Total input force N Input
m Vehicle mass kg 1888.6
lr Length from rear tire to the center of m 1.39
mass
lf Length from front tire to the center of m 1.55
mass
Cα Cornering stiffness of each tire N 20000
Iz Yaw intertia kg mˆ2 25854
Fpq Tire force, p ∈ {x, y},q ∈ {f, r} N Depends on input force
f Rolling resistance coefficient N/A 0.019
delT Simulation timestep sec 0.032
4.7 Simulation
Figure 3: Simulation code flow
Several files are provided to you within the controllers/main folder. The [Link] script
initializes and instantiates necessary objects, and also contains the controller loop. This loop
runs once each simulation timestep. [Link] calls your [Link]’s update method
9
on each loop to get new control commands (the desired steering angle, δ, and longitudinal
force, F ). The longitudinal force is converted to a throttle input, and then both control
commands are set by Webots internal functions. The additional script [Link] contains
functions to help you design and execute the controller. The full codeflow is pictured in
Figure 3.
Please design your controller in the your [Link] file provided for the project part
you’re working on. Specifically, you should be writing code in the update method. Please
do not attempt to change code in other functions or files, as we will only grade the
relevant your [Link] for the programming portion. However, you are free to
add to the CustomController class’s init method (which is executed once when the
CustomController object is instantiated).
4.8 BaseController Background
The CustomController class within each your [Link] file derives from the Base-
Controller class in the base [Link] file. The vehicle itself is equipped with a
Webots-generated GPS, gyroscope, and compass that have no noise or error. These sensors
are started in the BaseController class, and are used to derive the various states of the
vehicle. An explanation on the derivation of each can be found in the table below.
Table 2: State Derivation.
Name Explanation
(X, Y ) From GPS readings
(ẋ, ẏ) From the derivative of GPS readings
ψ From the compass readings
ψ̇ From the gyroscope readings
4.9 Trajectory Data
The trajectory is given in [Link]. It contains the coordinates of the trajectory as
(x, y). The satellite map of the track is shown in Figure 4.
10
Figure 4: Buggy track[3]
5 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. [Link], [Link]
4. “PID Controller - Manual Tuning.” Wikipedia, Wikimedia Foundation, August 30th,
2020. [Link]
11