Lec03 MotorControl
Lec03 MotorControl
RSS Lecture 3
Monday, 7 Feb 2011
Prof. Daniela Rus
(includes some material by Prof. Seth Teller)
Jones, Flynn & Seiger § 7.8.2
http://courses.csail.mit.edu/6.141/
Today: Control
• Early mechanical examples
• Feed-forward and Feedback control
• Terminology
• Basic controllers:
– Feed-Forward (FF) control
– Bang-Bang control
– Proportional (P) control
– The D term: Proportional-Derivative (PD) control
– The I term: Proportional-Integral (PI) control
– Proportional-Integral-Derivative (PID) control
• Gain selection
• Applications
The Role of Control
www.freshwatersystems.com
K
• … Where does the gain value K come from?
K
• … Where does the gain value K come from?
– Calibration (example: PWM = 0, PWM = 255)
• Under what conditions will FF control work well?
– When the presented load is uniform and known
• You will implement an FF controller in Lab 2
Feedback Control
• Feedback controller:
– output = FB(error)
– error = goal state - measured state
– controller attempts to minimize error
• Feedback control requires sensors:
– Binary (at goal/not at goal)
– Direction (less than/greater than)
– Magnitude (very bad, bad, good)
Example: Wall Following
Feedback Sensor
• Error signal e(t) = SP-PV: error in the process
variable at time t, computed via Feedback
• Control signal u(t): controller output (value of
switch, voltage, PWM, throttle, steer angle, …)
*Set point is sometimes called the “Reference”
Bang-bang control
• Discrete on/off
• Furnace: goal
temp = 70
• when temp < 70
BANG! Heat;
• when temp >
70 BANG! Stop
the heat
Encoder measurement
O(t) =
O(t) =
Bang-bang control
Temperature Sensor
Example: Home Heating System
• Plant P: Boiler with on-off switch (1 = all on ; 0 = all off)
• Process Variable PV: Current home temperature
• Controller: Thermostat Sensor: Thermometer
• Set Point SP: Thermostat setting (desired temp.)
• Control signal: Boiler on-off switch u(t) ∈ {0, 1}
e(t) u(t)
SP - Thermostat Boiler PV
Temperature Sensor
Temperature Sensor
Encoder measurement
Motor Control: PID
• Control theory is the science that studies the
behavior of control systems
• CurrentState - DesiredState = Error
• Main types of simple linear controllers:
– P: proportional control
– PD: proportional derivative control
– PI: proportional integral control
– PID: proportional integral derivative control
Example: driving
Sensor
Example: Cruise Control (CC) System
• Plant P:
• Process Variable PV:
• Controller: Sensor:
• Set Point SP:
• Control signal:
e(t) u(t)
Vdesired - C-C System Engine Vactual
Speedometer
Example: Cruise Control (CC) System
• Plant P: Engine with throttle setting u ∈ [0..1]
• Process Variable PV: Current speed Vactual
• Controller: C-C system Sensor: Speedometer
• Set Point SP: Desired speed Vdesired
• Control signal: Continuous throttle value u ∈ [0..1]
e(t) u(t)
Vdesired - C-C System Engine Vactual
Speedometer
Set Delay
Point
Error (E)
Process
Variable
Step
input Error (E)
Process
Variable Time
Combating Overshoot: The D Term
• Note the derivative of error in responses below
• Subtract it from output to counteract overshoot
• Then u(t) = KP × e(t) + KD × d [e(t)] / dt
– KD the “derivative” or “damping” term in PD controller
Higher KP
Step
Set input
Damped response, KD > 0
Point
Low KP
Small derivative
Process Large derivative
Variable Time
d/dt × KD
e(t) u(t)
SP - × Σ
Plant PV
KP
∫ × KI
KP KI KD
P 0.5KC
PI 0.45KC 1.2KP/TC
PID 0.5KC 2KP/TC KPTC/8
Z & N developed rule using Monte Carlo method
Rule useful in the absence of models
Example: Quadrotor Control
Using Ziegler-Nichols Method
KP = 0.6*KC
KI = 2*KP / TC
KD = 0.125*KP*TC
TC = 4
The Ziegler-Nichols
Method is a guideline
for experimentally
obtaining 25%
overshoot from a step
response.
What does KI do?
Reasonable KD helps
minimize overshoot
and settling time.
Too much KD leads to
system instability.
P system has
unacceptable
overshoot, settling
time, and steady state
error. However, it is
stable.
Control summary
Control type Feedback Pro/Con
Bang- Simple/
discrete yes
bang Discrete
Simple/may
Open
Control law no be
loop
unrepeatable
Closed Continuous/
P, I, D yes
loop Tune Gains