lecture 9: pid control
TRANSCRIPT
![Page 1: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/1.jpg)
Lecture 9: PID ControlProfessor Katie Driggs-Campbell
March 2, 2021
ECE484: Principles of Safe Autonomy
![Page 2: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/2.jpg)
Administrivia β’ Safety training information posted on discord
β’ MP1 due this weekβͺ Demo due Thursday
βͺ Report due Friday
β’ Milestone report due Friday 3/19 by 5pmβͺ Rubric posted tonight
![Page 3: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/3.jpg)
Todayβs Plan
β’ Review some properties of dynamical systems and differential equations
β’ Take a look at PID controllers
β’ Build up to waypoint following using the models discussed last week!
![Page 4: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/4.jpg)
Typical planning and control modulesβ’ Global navigation and planner
βͺ Find paths from source to destination with static obstaclesβͺ Algorithms: Graph search, Dijkstra, Sampling-based planningβͺ Time scale: Minutesβͺ Look ahead: Destinationβͺ Output: reference center line, semantic commands
β’ Local planner βͺ Dynamically feasible trajectory generationβͺ Dynamic planning w.r.t. obstaclesβͺ Time scales: 10 Hzβͺ Look ahead: Secondsβͺ Output: Waypoints, high-level actions, directions / velocities
β’ Controllerβͺ Waypoint follower using steering, throttleβͺ Algorithms: PID control, MPC, Lyapunov-based controllerβͺ Lateral/longitudinal controlβͺ Time scale: 100 Hzβͺ Look ahead: current stateβͺ Output: low-level control actions
![Page 5: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/5.jpg)
Dynamical Systems Model
Describe behavior in terms of instantaneous laws:ππ₯ π‘
ππ‘= αΆπ₯(π‘) = π π₯ π‘ , π’ π‘
where π‘ β β, π₯ π‘ β βπ, π’ π‘ β βπ, and π:βπ Γ βπ β βπ gives the dynamics / transition function
![Page 6: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/6.jpg)
αΆπ₯2αΆπ₯1
= β1/4 β2/53 β1/4
π₯1π₯2
Ξ»1=β0.25βi1.10Ξ»2=β0.25+i1.10
αΆπ₯2αΆπ₯1
= 1/4 β2/53 β1/4
π₯1π₯2
Ξ»1=+i0.1066Ξ»2=-i0.1066
αΆπ₯2αΆπ₯1
= 1/2 β2/53 β1/4
π₯1π₯2
Ξ»1=0.125+i1.029Ξ»2=-0.125-i1.029
Examples αΆπ₯2αΆπ₯1
= β1/4 β2/53 β1/2
π₯1π₯2
Ξ»1=β0.375βi1.088Ξ»2=β0.375+i1.088
![Page 7: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/7.jpg)
Control Paradigm
![Page 8: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/8.jpg)
Error Dynamics
![Page 9: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/9.jpg)
Feedback Control
![Page 10: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/10.jpg)
PID Controllers
β’ Proportional π’ = πππ
β’ Integral π’ = ππβ« π π ππ
β’ Derivative π’ = ππ αΆπ
ππ UE
ππ1
π UE
πππ UE
U
![Page 11: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/11.jpg)
Linear Error Dynamics and Stability
![Page 12: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/12.jpg)
Viewing as a Second Order System
β’ The second order system is: α·π + π1 αΆπ + π2π = 0
β’ In standard form, we write:
α·π π‘ + 2πππ αΆπ π‘ + ππ2π π‘ = 0
where π is the damping ratio and ππ is the natural frequency
β’ The eigenvalues are given as:
π1,2 = βπππ Β± ππ π2 β 1
β’ Note that the system is stable iff ππ and π are positive
![Page 13: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/13.jpg)
Second Order Dynamics: Casesβ’ Overdamped: π > 1
β’ Roots π 1 and π 2 are distinct
β’ ππ π‘ = π1ππ 1π‘ + π2π
π 2π‘
β’ Time constant is the less negative root
β’ Critically damped: π = 1β’ Roots π 1 and π 2 are equal and real
β’ ππ π‘ = (π1+π2π‘)πβπππ‘
β’ Time constant is given by 1/ππ
β’ Underdamped: π < 1β’ Roots are complex conjugates:
π 1,2 = βπππ Β± πππ 1 β π2
β’ ππ π‘ = (π1cosπππ‘ + π2 sinπππ‘)πβππππ‘
![Page 14: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/14.jpg)
Simple Damped Spring System
π α·π₯ + π αΆπ₯ + ππ₯ = πΉ
α·π₯ +π
παΆπ₯ +
π
ππ₯ = π’
α·π₯ + 2ππ0 αΆπ₯ + π02π₯ = π’
π damping ratio
π0 natural frequency
π α·π₯ + π αΆπ₯ + ππ₯ = π’
β π α·π₯ + π αΆπ₯ + ππ₯ =
ππ 2π π + ππ π π + ππ π
Transfer Function:π π
π(π )=
1
ππ 2 + ππ + π
Poles:
π =βπ Β± π2 β 4ππ
2π
![Page 15: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/15.jpg)
Undamped Case: π = 0 Overdamped Case: π2 β 4ππ > 0
Underdamped Case: π2 β 4ππ < 0 With Feedback Control
Sorry β no video!
![Page 16: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/16.jpg)
Break!
![Page 17: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/17.jpg)
Simple vehicle model: Dubinβs car
β’ Key assumptionsβͺ Front and rear wheel in the plane in a stationary
coordinate system
βͺ Steering input, front wheel steering angle πΏ
βͺ No slip: wheels move only in the direction of the plane they reside in
β’ Zeroing out the accelerations perpendicular to the plane in which the wheels reside, we can derive simple equations
Reference: Paden, Brian, Michal Cap, Sze Zheng Yong, Dmitry S. Yershov, and Emilio Frazzoli. 2016. A survey of motion planning and control techniques for self-driving
urban vehicles. IEEE Transactions on Intelligent Vehicles 1 (1): 33β55.
![Page 18: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/18.jpg)
Dubinβs Model
![Page 19: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/19.jpg)
Path following control
β’ The path followed by a robot can be represented by a trajectory or path parameterized by timeβ from a higher-level planner
β’ Defines the desired instantaneous pose π π‘
π π‘ = [π₯ π‘ , π¦ π‘ , π π‘ ]
![Page 20: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/20.jpg)
Open-loop waypoint following
β’ We can write an open-loop controller for a robot that is naturally controlled via angular velocity, such as a differential-drive robot:
π’π,ππΏ π‘ =π£ π‘π π‘
=αΆπ₯ π‘ 2 + αΆπ¦ π‘ 2
αΆπ π‘
β’ We can write an open-loop controller for a robot with car-like steering:
π’π ,ππΏ π‘ =π£ π‘π π‘
=
αΆπ₯ π‘ 2 + αΆπ¦ π‘ 2
αΆπ π‘
αΆπ₯ π‘ 2 + αΆπ¦ π‘ 2
![Page 21: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/21.jpg)
Path following control
β’ The path followed by a robot can be represented by a trajectory or path parameterized by timeβ from a higher-level planner
β’ Defines the desired instantaneous pose π π‘
PlantSensor Controller
Input/waypoint
Controlπ’(π‘)
Output
Feedback
Noise Disturbance
π π‘ = [π₯ π‘ , π¦ π‘ , π π‘ ]
![Page 22: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/22.jpg)
Path following control
β’ Desired instantaneous pose π π‘
β’ How to define error between actual pose ππ΅ π‘ and desired pose π π‘ in the form of π¦π π‘ β π¦(π‘)?
π π‘ = [π₯ π‘ , π¦ π‘ , π π‘ ]
ππ΅ π‘ = [π₯π΅ π‘ , π¦π΅ π‘ , ππ΅ π‘ ]
![Page 23: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/23.jpg)
Path following controlThe error vector measured vehicle coordinates
e π‘ = [πΏπ π‘ , πΏπ π‘ , πΏπ π‘ , πΏπ£ π‘ ]
[πΏπ , πΏπ] define the coordinate errors in the vehicleβs reference frame: along track error and cross track error
β’ Along track error: distance ahead or behind the target in the instantaneous direction of motion.
πΏπ = cos ππ΅ π‘ π₯ π‘ β π₯π΅ π‘ + π ππ ππ΅ π‘ π¦ π‘ β π¦π΅ π‘
β’ Cross track error: portion of the position error orthogonal to the intended direction of motion
πΏπ = βsin ππ΅ π‘ π₯ π‘ β π₯π΅ π‘ + πππ ππ΅ π‘ π¦ π‘ β π¦π΅ π‘
β’ Heading error: difference between desired and actual orientation and directionπΏπ = π π‘ β ππ΅ π‘πΏπ£ = π£ π‘ β π£π΅(π‘)
β Each of these errors match the form π¦π π‘ β π¦(π‘)
π π‘ = [π₯ π‘ , π¦ π‘ , π π‘ , π£(π‘)]
ππ΅ π‘ = [π₯π΅ π‘ , π¦π΅ π‘ , ππ΅ π‘ , π£π΅(π‘)]
ππ΅
πΏπ
πΏπ
πΏπ
![Page 24: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/24.jpg)
A simple P-controller example
β’ Given a simple system: αΆπ¦ π‘ = π’ π‘ + π π‘
β’ Using proportional (P) controller:
π’ π‘ = βπΎππ π‘ = βπΎπ(π¦ π‘ β π¦π π‘ )
αΆπ¦ π‘ = βπΎππ¦ π‘ + πΎππ¦π π‘ + π π‘
β’ Consider constant setpoint π¦0 and disturbance ππ π
αΆπ¦ π‘ = βπΎππ¦ π‘ + πΎππ¦0 + ππ π
β’ What is the steady state output? βͺ Set: βπΎππ¦ π‘ + πΎππ¦0 + ππ π = 0
βͺ Solve for π¦π π : π¦ π‘ =ππ π
πΎπ+ π¦0
![Page 25: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/25.jpg)
A simple P-controller example
β’ Given a simple system: αΆπ¦ π‘ = π’ π‘ + π π‘
β’ Consider constant setpoint π¦0 and disturbance ππ π αΆπ¦ π‘ = βπΎππ¦ π‘ + πΎππ¦0 + ππ π
β’ Steady state output π¦π π =ππ π
πΎπ+ π¦0
β’ Transient behavior:
π¦ π‘ = π¦0πβπ‘/π + π¦π π 1 β πβπ‘/π , π = 1/πΎπ
β’ To make steady state error small, we can increase πΎπ at the expense of longer transients
![Page 26: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/26.jpg)
Control Law
Control input is given by π’ = π, πΏ β€
where π is the acceleration and πΏ is the steering angle
π’ = πΎ
πΏπ πΏππΏππΏπ£
πΎ =πΎπ 0 0 πΎπ£0 πΎπ πΎπ 0
PlantSensor Controller
π π‘ = [π₯ π‘ , π¦ π‘ , π π‘ ]
Control
π’ π‘ =ππΏ
Output
Feedback
Noise Disturbance
![Page 27: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/27.jpg)
Control Law
πΎ =πΎπ 0 0 πΎπ£0 πΎπ πΎπ 0
The pure-pursuit controller produced by this gain matrix performs a PD-control. It uses a PD-controller to correct along-track error.
The control on curvature is also a PD-controller for cross-track error because πΏπ is related to the derivative of πΏπ.
![Page 28: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/28.jpg)
Summary
β’ Reviewed linear systems and stability of differential equations
β’ Looked at PID controllers as a way to regulate systems using state feedback
β’ Derived a waypoint following error dynamicsβThis will be MP2! Tutorial on 3/11.
β’ Next time: Advanced Control Topics!
![Page 29: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/29.jpg)
Extra Slides
![Page 30: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/30.jpg)
Hybrid system model
Nonlinear hybrid dynamics
Physical plant
ππ₯
ππ‘= πππππ π₯, π’
merge leftππ₯
ππ‘= πππππ‘(π₯, π’)
cruiseππ₯
ππ‘= ππππ (π₯, π’)
merge rightππ₯
ππ‘= ππππβπ‘(π₯, π’)
speed upππ₯
ππ‘= ππ’π(π₯, π’)
slow downππ₯
ππ‘= ππππ€π(π₯, π’)
Decision and control software
Interaction between computation and physics can lead to unexpected behaviors
Typical system models
![Page 31: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/31.jpg)
Run
Walk
Each of the modes of a walking robot are asymptotically stable
Is it possible to switch between them to make the system unstable?
Hybrid Instability: Switching between two stable linear models
![Page 32: Lecture 9: PID Control](https://reader033.vdocuments.us/reader033/viewer/2022060610/6296c5fc5e76681cb93c67bb/html5/thumbnails/32.jpg)
Run
Walk
Yes! By switching between them the system becomes unstable