Description
Purpose
For this homework, we will study linearization, reflect on the project, and start thinking about racing.
Instructions
This homework assignment will be submitted using Gradescope.
All written portions must be turned in through Gradescope. See the Piazza post on homework guidelines
for more instructions on the different homework resources available to you. Whatever format you decide to
use, please BOX all of your final answers.
1
Assignment 6: Linearization and Project Reflection 2
Problem 1 – Linearization
In the last homework, you used your intuition about vehicle dynamics to determine signs of feedback gains
to stabilize around a drift equilibrium. This week, we are going to learn how we can compute a linearization
and use linear control techniques to determine these gains, rather than by inspection.
For all the following problems, consider a drift equilibrium consisting of req = 0.7486 rad/s, Uy,eq = −8.661
m/s, Ux,eq = 10.3224 m/s, δeq = −0.5132 rad, and Fxr,eq = 7317 N.
(This is derived from drifting an 18 meter radius path (κ = 1/18) with constant sideslip of −40°)
Question 1.A – Linearization of our Velocity Dynamics (MATLAB Grader)
Up until now, we have linearized our dynamics via linear assumptions, such as small angle approximations
and linear tires. We will now directly linearize our dynamics (which allows analysis and control of cool
vehicle behavior such as drifting).
Consider just our velocity states, so x = [r, Uy]
T
. We can write our dynamics as being a nonlinear function
of our state and steering input (forget Fxr for now – assume we are using the same longitudinal controller
from HW5):
x˙ = f(x, δ)
We can linearize the dynamics and write our system as:
x˙ = f(xeq) + A(x − xeq) + B(δ − δeq) = A(x − xeq) + B(δ − δeq)
x¯˙ = Ax¯ + B¯δ
A =
” ∂r˙
∂r
∂r˙
∂Uy
∂U˙
y
∂r
∂U˙
y
∂Uy
#
x=xeq
(6.1)
B =
”
∂r˙
∂δ
∂U˙
y
∂δ #
x=xeq
(6.2)
To calculate the partial derivatives, we need to carefully consider what each term in our dynamics is a
function of. Based on the Fiala lateral tire model:
Fyf = f(αf ) = f(Uy, r, δ)
Generally while drifting, αr > αsl so:
Fyr = f(Fxr)
So to calculate the first entry in the A matrix:
∂r˙
∂r
x=xeq
=
1
Iz
(a
∂Fyf
∂r cos(δ) − b
∂Fyr
∂r )
x=xeq
=
acos(δ)
Iz
∂Fyf
∂r
x=xeq
To calculate ∂Fyf
∂r , we then need to take the derivative of each term in the Fiala model with respect to r.
The rest of the derivatives can be computed similarly.
Assignment 6: Linearization and Project Reflection 3
For this two state model we have computed the A & B matrices for you (so you won’t need to take the
derivative of the Fiala model). However, make sure you understand how one could compute each term in A
& B, as you will be finding some of the derivatives in the next problem.
A =
−1.1963 −0.744
−11.5025 −0.7339
(6.3)
B =
13.1451
12.967
(6.4)
Finally, lets use the control law ¯δ = −Kx¯ (full state feedback).
Find the gain vector K that puts the poles of the closed loop system at -4 and -8. Compute
this by hand and show your work. Submit your gain vector to MATLAB Grader.
Question 1.B – Incorporating Path Tracking (MATLAB Grader)
Drifting by itself is pretty cool, but what if we wanted to incorporate a reference path? Let’s define a new
state x = [r, Uy, e, ∆ψ]
T
.
Find a value for ∆ψeq given the drift equilibrium we are using in this problem. Do not make
any small angle assumptions.
Let’s linearize these dynamics as before and then try to find gains that stabilize the system. This time, our
linearized matrices are:
A =
∂r˙
∂r
∂r˙
∂Uy
∂r˙
∂e
∂r˙
∂∆ψ
∂U˙
y
∂r
∂U˙
y
∂Uy
∂U˙
y
∂e
∂U˙
y
∂∆ψ
∂e˙
∂r
∂e˙
∂Uy
∂e˙
∂e
∂e˙
∂∆ψ
∂∆˙ψ
∂r
∂∆˙ψ
∂Uy
∂∆˙ψ
∂e
∂∆˙ψ
∂∆ψ
x=xeq
(6.5)
B =
∂r˙
∂δ
∂U˙
y
∂δ
∂e˙
∂δ
∂∆˙ ψ
∂δ
x=xeq
(6.6)
Find ∆ψss and the new linearized dynamics matrices. Using full state feedback as before, place
the poles at [-4 +/- 4.5j, -0.15 +/- 0.75j]. You are encouraged to use the ’place’ function in
MATLAB. Report your gain vector and ∆ψss on MATLAB Grader
Question 1.C – Simulation (MATLAB Online / Gradescope)
Let’s see if the gains for combined drifting and path tracking work. Implement our new controller using the
provided simulator framework.
We have provided the 18m radius reference path, as well as the lower level functions that you have implemented several times by now. You only need to edit the file called mainproblem 1c.
Assignment 6: Linearization and Project Reflection 4
Provide two plots, one of the velocity states (Ux, Uy, r) and one of our path tracking errors
(Fig’s 2 &4 in provided plotting script). Do the results match what you expected, based on
our closed loop pole locations? Why or why not.
Assignment 6: Linearization and Project Reflection 5
Problem 2 – Reflection
You’ve completed your project. You’ve watched your lookahead and group controller executed on a real
vehicle. You’re officially a vehicle dynamicist!
In the project, you developed feedforward and feedback controllers for steering Niki along a defined path.
Having had a chance to try those controllers on the actual car, you now have additional information about
the appropriateness of your design choices beyond what you could gain from simulation. We want you to
reflect on your project experience in light of this new information. This should be an individual response, not
a team response. If you do find something wrong in your code when answering the first question, however,
you can (and should) point this out to your teammates.
With the data and video from your vehicle testing, let’s take a closer look at how your simulated performance
compares to the actual performance on the vehicle.
Question 2.A – Reflection of Lookahead Controller (Gradescope)
We’ll start with a reflection on your lookahead controller. Let’s take a look at your code and make sure
that everything was actually implemented correctly. A couple of teams had some implementation issues so,
if your results seemed strange, check again that your code was written correctly.
Next, consider whether you think the amount of feedback and feedforward was appropriate. Feedforward
enables you to lower feedback gains by adjusting the steering to the value you expect you need for a turn.
It can, however, lead to errors if the feedforward steering is not exact (which is very possible if there is
even a slight misalignment of the steering). Feedback – particularly proportional feedback – reduces the
steady-state error but also makes the system response faster, potentially amplifying noise or the effects of
delay.
(1) Was everything implemented correctly? If not, what implementation challenges did your
team run into?
(2) Did each of your controllers effectively use feedback and feedforward? Support your
conclusion with plots of your performance.
Question 2.B – Reflection of Group Controller (Gradescope)
Now let’s move on to your group’s controller. Let’s take a look at your code once more to make sure
that everything was actually implemented correctly. Let’s again consider whether you think the amount of
feedback and feedforward was appropriate in this case.
(1) Was everything implemented correctly? If not, what implementation challenges did your
team run into?
(2) Did each of your controllers effectively use feedback and feedforward? Support your
conclusion with plots of your performance.
Question 2.C – Reflection of Project (Gradescope)
Now that we’ve reflected on both the lookahead controller and your group’s controller, let’s reflect on what
we’ve learned from the design, analysis, and testing of these controllers.
Assignment 6: Linearization and Project Reflection 6
(1) What did you take away from the project?
(2) What, if anything, is still unclear to you about the controllers you used or linear vehicle
dynamics after this project?