lecture 9: pid control
TRANSCRIPT
Lecture 9: PID ControlProfessor Katie Driggs-Campbell
March 2, 2021
ECE484: Principles of Safe Autonomy
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
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!
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
Dynamical Systems Model
Describe behavior in terms of instantaneous laws:ππ₯ π‘
ππ‘= αΆπ₯(π‘) = π π₯ π‘ , π’ π‘
where π‘ β β, π₯ π‘ β βπ, π’ π‘ β βπ, and π:βπ Γ βπ β βπ gives the dynamics / transition function
αΆπ₯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
Control Paradigm
Error Dynamics
Feedback Control
PID Controllers
β’ Proportional π’ = πππ
β’ Integral π’ = ππβ« π π ππ
β’ Derivative π’ = ππ αΆπ
ππ UE
ππ1
π UE
πππ UE
U
Linear Error Dynamics and Stability
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
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πππ‘)πβππππ‘
Simple Damped Spring System
π α·π₯ + π αΆπ₯ + ππ₯ = πΉ
α·π₯ +π
παΆπ₯ +
π
ππ₯ = π’
α·π₯ + 2ππ0 αΆπ₯ + π02π₯ = π’
π damping ratio
π0 natural frequency
π α·π₯ + π αΆπ₯ + ππ₯ = π’
β π α·π₯ + π αΆπ₯ + ππ₯ =
ππ 2π π + ππ π π + ππ π
Transfer Function:π π
π(π )=
1
ππ 2 + ππ + π
Poles:
π =βπ Β± π2 β 4ππ
2π
Undamped Case: π = 0 Overdamped Case: π2 β 4ππ > 0
Underdamped Case: π2 β 4ππ < 0 With Feedback Control
Sorry β no video!
Break!
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.
Dubinβs Model
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 π π‘
π π‘ = [π₯ π‘ , π¦ π‘ , π π‘ ]
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
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
π π‘ = [π₯ π‘ , π¦ π‘ , π π‘ ]
Path following control
β’ Desired instantaneous pose π π‘
β’ How to define error between actual pose ππ΅ π‘ and desired pose π π‘ in the form of π¦π π‘ β π¦(π‘)?
π π‘ = [π₯ π‘ , π¦ π‘ , π π‘ ]
ππ΅ π‘ = [π₯π΅ π‘ , π¦π΅ π‘ , ππ΅ π‘ ]
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 π¦π π‘ β π¦(π‘)
π π‘ = [π₯ π‘ , π¦ π‘ , π π‘ , π£(π‘)]
ππ΅ π‘ = [π₯π΅ π‘ , π¦π΅ π‘ , ππ΅ π‘ , π£π΅(π‘)]
ππ΅
πΏπ
πΏπ
πΏπ
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
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
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
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 πΏπ.
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!
Extra Slides
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
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
Run
Walk
Yes! By switching between them the system becomes unstable