of 31
8/10/2019 14 Feedback Control
1/31
Introductory ControlTheoryI400/B659: Intelligent roboticsKris Hauser
8/10/2019 14 Feedback Control
2/31
8/10/2019 14 Feedback Control
3/31
Control Theory
The use of feedbackto regulate a signal
Controller
Plant
Desiredsignal xd
Signal x Control input u
Error e = x-xd(By convention, xd= 0)
x = f(x,u)
8/10/2019 14 Feedback Control
4/31
What might we be interested in?
Controls engineering
Produce a policy u(x,t), given a description of the
plant, that achieves good performance
Verifying theoretical properties Convergence, stability, optimality of a given policy
u(x,t)
8/10/2019 14 Feedback Control
5/31
Agenda
PID control
Feedforward + feedback control
Control is a hugetopic, and we wont dive into
much detail
8/10/2019 14 Feedback Control
6/31
Model-free vs model-based
Two general philosophies:
Model-free: do not require a dynamics model to be provided
Model-based: do use a dynamics model during computation
Model-free methods:
Simpler Tend to require much more manual tuning to perform well
Model-based methods:
Can achieve good performance (optimal w.r.t. some cost function)
Are more complicated to implement
Require reasonably good models (system-specific knowledge) Calibration: build a model using measurements before behaving
Adaptive control: learn parameters of the model online fromsensors
8/10/2019 14 Feedback Control
7/31
PIDcontrol
Proportional-Integral-Derivativecontroller
A workhorse of 1D control systems
Model-free
8/10/2019 14 Feedback Control
8/31
Proportional term
u(t) = -Kpx(t)
Negative sign assumes control acts in the same
direction as x
xt
Gain
8/10/2019 14 Feedback Control
9/31
Integral term
u(t) = -Kpx(t) - KiI(t)
I(t) =
0 (accumulation of errors)
xt
Residual steady-state errors driven
asymptotically to 0
Integral gain
8/10/2019 14 Feedback Control
10/31
Instability
For a 2ndorder system (momentum), P control
xt
Divergence
8/10/2019 14 Feedback Control
11/31
Derivative term
u(t) = -Kpx(t)Kdx(t)
x
Derivative gain
8/10/2019 14 Feedback Control
12/31
Putting it all together
u(t) = -Kpx(t) - KiI(t) - Kdx(t)
I(t) =
0
8/10/2019 14 Feedback Control
13/31
Putting it all together
u(t) = -Kpx(t) - KiI(t) - Kdx(t)
I(t) =
0
Intuition: Kpcontrols the spring stiffness
Kicontrols the learning rate
Kdcontrols the damping
8/10/2019 14 Feedback Control
14/31
Putting it all together
u(t) = -Kpx(t) - KiI(t) - Kdx(t)
I(t) =
0
Intuition: Kpcontrols the spring stiffness
Kdcontrols the amount of damping
Kicontrols the learning rate
Control limits If u is bounded in range [umin,umax], need to:
1. Clamp u
2. Bound the magnitude of the I term to prevent overshoot
8/10/2019 14 Feedback Control
15/31
Parameter tuning
8/10/2019 14 Feedback Control
16/31
Example: Damped Harmonic
Oscillator Second order time invariant linear system, PID controller
x(t) = A x(t) + B x(t) + C + D u(x,x,t)
For what starting conditions, gains is this stable and
convergent?
8/10/2019 14 Feedback Control
17/31
Stability and Convergence
System is stableif errors stay bounded
System is convergentif errors -> 0
8/10/2019 14 Feedback Control
18/31
Example: Damped Harmonic
Oscillator x = A x + B x + C + D u(x,x)
PID controller u = -KpxKdx Ki I
x = (A-DKp) x + (B-DKd) x + C - D Ki I
Assume Ki=0
8/10/2019 14 Feedback Control
19/31
Homogenous solution
Instable if A-DKp > 0
Natural frequency w0= sqrt(DKp-A)
Damping ratio z=(DKd-B)/2w0
If z> 1, overdamped
If z< 1, underdamped(oscillates)
8/10/2019 14 Feedback Control
20/31
Example: Trajectory following
Say a trajectory xdes(t) has been designed
E.g., a rockets ascent, a steering path for a car, a planes landing
Apply PID control
u(t) = Kp(xdes(t)-x(t)) - KiI(t) + Kd(xdes(t)-x(t))
I(t) = 0
The designer of xdesneeds to be knowledgeable about the
controllers behavior!
xdes(t)x(t)
x(t)
8/10/2019 14 Feedback Control
21/31
Controller Tuning Workflow
Hypothesize a control policy
Analysis:
Assume a model
Assume disturbances to be handled
Test performance either through mathematical analysis, orthrough simulation
Go back and redesign control policy
Mathematical techniques give you more insight to improve
redesign, but require more work
8/10/2019 14 Feedback Control
22/31
Example
8/10/2019 14 Feedback Control
23/31
Feedforward control
If we knowa model for a system and know how it should
move, why dont we just compute the correct control?
Ex: damped harmonic oscillator
x = A x + B x + C + D u
Calculate a trajectory x(t) leading to x(T)=0 at some point T
Compute its 1stand 2ndderivatives x(t), x(t)
Solve for u(t) = 1/D*(x(t) - A x(t) + B x(t) + C)
Would be perfect!
8/10/2019 14 Feedback Control
24/31
Feedforward control
If we knowa model for a system and know how it should
move, why dont we just compute the correct control?
Ex: damped harmonic oscillator
x = A x + B x + C + D u
Calculate a trajectory x(t) leading to x(T)=0 at some point T
Compute its 1stand 2ndderivatives x(t), x(t)
Solve for u(t) = 1/D*(x(t) - A x(t) + B x(t) + C)
Problems
Control limits: trajectory must be planned with knowledge ofcontrol constraints
Disturbances and modeling errors: open loop control leads to
errors not converging to 0
8/10/2019 14 Feedback Control
25/31
Handling errors: feedforward +
feedback Idea: combine feedforward control uff with feedback control
ufb e.g., ufbcomputed with PID control
Feedback term doesnt have to work as hard (= 0 ideally)
Plant
uffFeedforward
calculationx(0) +
ufb
Feedback
controller
u
x(t)
xdes
8/10/2019 14 Feedback Control
26/31
Application: Feedforward control
Feedback control: let torques be a
function of the current error between
actual and desired configuration
Problem: heavy arms require strong
torques, requiring a stiff system
Stiff systems become unstable relatively
quickly
8/10/2019 14 Feedback Control
27/31
Application: Feedforward control
Solution: include feedforward torques
to reduce reliance on feedback
Estimate the torques that would
compensate for gravity and achieve
desired accelerations (inverse
dynamics), send those torques to the
motors
8/10/2019 14 Feedback Control
28/31
Handling errors: feedforward +
feedback Idea: combine feedforward control uff with feedback control
ufb e.g., ufbcomputed with PID control
Feedback term doesnt have to work as hard (= 0 ideally)
Plant
uffFeedforward
calculationx(0) +
ufb
Feedback
controller
u
x(t)
xdes
Model based
Model free
8/10/2019 14 Feedback Control
29/31
Model predictive control
(MPC) Idea: repeatedly compute feedforward control using model of
the dynamics
In other words, rapid replanning
Plant
Feedforward
calculation u=uff
x(t)
xdes
8/10/2019 14 Feedback Control
30/31
MPC to avoid moving obstacles
8/10/2019 14 Feedback Control
31/31
Next class: Sphero Lab
You will design a feedback controller for the move command