AE353 Homework #9: Control Design — Differential Drive Robot Race solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (5 votes)

Goal
This week, you will design a control system that makes a differential drive robot race along a road
as fast as possible. You will implement your control system by modifying the script:
hw9_ControlLoopTemplate.m
You will test your control system with the script:
hw9_Simulation.m
Instructions on exactly how to do these two things will be posted to piazza.
Model
The dynamics of the robot are:
q˙1 = v cos q3
q˙2 = v sin q3
q˙3 = w
w˙ R = kτ τR
w˙ L = kτ τL
where
v =
r
2
(wR + wL)
is the forward speed,
w =
r
2b
(wR − wL)
is the turning rate, and
• r = 0.15 is the radius of each wheel;
• b = 0.25 is half the distance between each wheel (i.e., half the length of the axle);
• kτ = 1 is a torque constant;
• wR and wL are the right and left wheel angular velocities, respectively;
• (q1, q2) is the position of the robot (i.e., of the center of the axle);
• q3 is the heading angle of the robot (in radians).
1
One way to make the robot follow a road is to make the robot track a given trajectory qdes that
itself follows the road and that satisfies
q˙des,1(t) = vdes(t) cos (qdes,3(t))
q˙des,2(t) = vdes(t) sin (qdes,3(t))
q˙des,3(t) = wdes(t)
for some forward speed vdes and turning rate wdes, both of which can be functions of time. If we
apply a coordinate transformation to define
e =


cos q3 sin q3 0
− sin q3 cos q3 0
0 0 1

 (q − qdes)
then e1 is the lateral position error (i.e., perpendicular to centerline of road at qdes), e2 is the
longitudinal position error (i.e., parallel to centerline of road at qdes), and e3 is the heading error.
The error dynamics can be written as
e˙1 = v − vdes cos e3 + e2w
e˙2 = vdes sin e3 − e1w
e˙3 = w − wdes.
If we linearize about e ≈ 0 and assume both vdes and wdes are piecewise-constant, we have
e˙1 = v − vdes
e˙2 = vdese3
e˙3 = w − wdes.
(1)
If we define
e4 = v − vdes
e5 = w − wdes,
(2)
then it is easy to show that
e˙4 =
rkτ
2
(τR + τL)
e˙5 =
rkτ
2b
(τR − τL).
(3)
Equations (1) and (3) can be combined and—eliminating v and w from (1) using (2)—put into
state space form (where the state is the 5 × 1 vector e and the inputs are τL and τR). The result
is a model that you can use to design a controller. Note that you may assume knowledge of vdes
and wdes (but only at the current time, not in the future). Given access to measurements of e1,
e2, wR, and wL, you can also design an observer. Implement both controller and observer in
hw9_ControlLoopTemplate.m, and you have yourself a control system.
How To Go Fast
The script hw9_ControlLoopTemplate.m gives you the ability, if you want, to change the desired
forward speed vdes. If you increase it, your robot will try to go faster — but be careful! Try to go
too fast and you’ll run off the road. You’ll have to figure out for yourself what to do with vdes. A
simple strategy for the race would be to test your control design many times, setting vdes to the
highest constant value that doesn’t often result in a crash.
2
What to Turn In
You may work, if you like, with one partner. (You may also, as usual, work and share code with
other people, as long as you include a list of all the people with whom you collaborated.) The two
of you should submit the following:
• A single MATLAB script to replace hw9_ControlLoopTemplate.m, with your final control
system. You must call this script hw9_NAME1_NAME2.m, where “NAME1” and “NAME2” are
replaced with the first five letters of your first name (in capitals) followed by the first letter
of your last name (in capitals) and—if you are working in a group—your teammate. For
example, if I was working alone, I would submit a script with the file name hw9_TIMB. Details
on how to submit your code will be posted to piazza.
• A brief description of your design process. If you use state space methods, this process should
at least include the following:
– Derivation of a state space model of the system (starting from what is described above).
– Analysis of controllability and observability.
– Design of controller and observer, either by eigenvalue placement or by optimality.
– Simulation results, and their use to refine or validate your control system.
If you use classical methods, the design process should at least include the following:
– A block diagram model of the system.
– Analysis of time response.
– Analysis of frequency response.
– Simulation results, and their use to refine or validate your control system.
Please be very concise. A formal report is not required.
As discussed in class, we will have a contest in class on the due date. Details of this contest—and
of opportunities for extra credit—will be posted online.
3