0% found this document useful (0 votes)
4 views

2019 Lecture5 - MotorControl

The document discusses motor control and different types of controllers that can be used for motor control including feed-forward control, bang-bang control, proportional control, proportional-derivative control, proportional-integral control, and proportional-integral-derivative control. It provides examples of how these different controller types work and discusses concepts like feedback control, error, gain, and system response.

Uploaded by

Chailender
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

2019 Lecture5 - MotorControl

The document discusses motor control and different types of controllers that can be used for motor control including feed-forward control, bang-bang control, proportional control, proportional-derivative control, proportional-integral control, and proportional-integral-derivative control. It provides examples of how these different controller types work and discusses concepts like feedback control, error, gain, and system response.

Uploaded by

Chailender
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

EE474 Robotics and Control

Lecture 5: Motor Control

Dr Gordon Dobie, EEE


Motor Control
• Early mechanical examples
• Feed-forward and Feedback control
• Terminology Lecture 4:
• Basic controllers: Motors

– Feed-Forward (FF) control


– Bang-Bang control
Lecture 5:
– Proportional (P) control Motor Control
– The D term: Proportional-Derivative
(PD) control
– The I term: Proportional-Integral (PI)
Lecture 6:
control Motor Control
– Proportional-Integral-Derivative (PID)
control
• Gain selection
• Applications
*Material adapted from
http://www.roboticscourseware.org/
The Role of Control
• Many tasks in robotics are defined by
achievement goals
– Go to the end of the maze
– Push that box over here
• Other tasks in robotics are defined by
maintenance goals:
– Drive at 0.5m/s
– Balance on one leg
The Role of Control
• Control theory is generally used for low-level
maintenance goals
• General notions:
– output = Controller(input)
– output is control signal to actuator (e.g., motor
voltage/current)
– input is either goal state or goal state error (e.g.,
desired motor velocity)
• Controller is stateless
What is the point of control?
• Consider any mechanism with adjustable DOFs*
(e.g. a valve, furnace, engine, car, robot…)

• Control is purposeful variation of these DOFs


to achieve some specified maintenance state
– Early mechanical examples: float valve, steam governor

www.freshwatersystems.com

*DOFs = Degrees of Freedom


Motor Control: Open Loop
• Give robot task with no concern for the
environment
• Applications: ???
• Open loop: signal to action
• Not checked if correct action was taken
• Example: go forward for 15 secs, then turn
left for 10 secs. Issues?

signal actuator output


Open loop (feed-forward) control
• Open loop controller:
– output = FF(goal)
• Example.: motor speed controller (linear):
– V=k *s
– V is applied voltage on motor
– s is speed
– k is gain term (from calibration)
• Weakness:
– Varying load on motor => motor may not maintain goal
speed
Feed-Forward (FF) Control
• Pass command signal from external environment
directly to the loaded element (e.g., the motor)
• Command signal typically multiplied by a gain K
Command
signal
 Motor RPM

K
• … Where does the gain value K come from?

• Under what conditions will FF control work well?


Feed-Forward (FF) Control
• Pass command signal from external environment
directly to the loaded element (e.g., the motor)
• Command signal typically multiplied by a gain K
Command
signal
 Motor RPM

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
Feedback Control
• Feedback controller:
– output = FB(error)
– error = goal state - measured state
– controller attempts to minimise error
• Feedback control requires sensors:
– Binary (at goal/not at goal)
– Direction (less than/greater than)
– Magnitude (very bad, bad, good)
Example: Wall Following
• How would you use feedback control to
implement a wall-following behavior in a robot?

• What sensors would you use, and would they


provide magnitude and direction of the error?

• What will this robot's behavior look like?


Feedback Control Terminology
• Plant P: process commanded by a Controller
• Process Variable PV: Value of some process
or system quantity of interest (e.g. temperature,
speed, force, …) as measured by a Sensor
• Set Point* SP: Desired value of that quantity
e(t) u(t)
SP - Controller Plant PV

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

Example source: Mathworks


Bang-bang control
Desired speed Actual speed
Vd < V? *k motor
0/1
Encoder measurement

O(t) = k if v(t) < Vd


O(t) = 0 otherwise
Example: Home Heating System
• Plant P:
• Process Variable PV:
• Controller: Sensor:
• Set Point SP:
• Control signal:
e(t) u(t)
SP - Thermostat Boiler PV

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

How could the function u(t) be implemented?


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

How could the function u(t) be implemented?


u(t) = 1 if e(t) > 0 [i.e., if SP > PV], 0 otherwise
Motor Control: closed loop
• A way of getting a robot to achieve and
maintain a goal state by constantly comparing
current state with goal state.
• Use sensor for feedback

Desired speed Actual speed


test motor
computation

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
Car Example
Proportional Control
• Suppose plant can be commanded by a
continuous, rather than discrete, signal
– Valve position to a pipeline or carburetor
– Throttle to an internal combustion engine
– PWM value to a DC motor
• What’s a natural thing to try?
– Proportional (P) Control: make the command signal
a scalar multiple of the error term: u(t) = KP  e(t)
e(t) u(t)
SP - Controller Plant PV

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

Define e(t) = Vdesired-Vactual, u(t) = KP  e(t), clipped to [0..1]


i.e. Throttle = KP  (Vdesired - Vactual)
Does this controller “settle” at the desired speed?
No; it exhibits error (E).
Proportional Control: Why E?

– Suppose e(t) = 0. Then u(t) = KP * e = 0 (Plant inactivated)


– Process Variable deviates from Set Point, activating plant
– But any real physical system has a delayed response
– Deviation, sustained over delay interval, yields error

Set Delay
Point
Error (E)
Process
Variable

PV < SP, u(t) > 0, Plant activates


PV = SP, u(t) = 0, Plant inactive
Time
Proportional Control Step Response
Notional plot and terminology:

Step
input Error (E)

Set Settle Time


Point
Process
Variable
Time

Is E constant over time? No; it depends on load.

When E = 0, plant turns off, so E grows, so plant turns on, etc etc.
This reaches an equilibrium with a constant E.
Proportional Control and Error
• Can combat E by increasing KP (“the P gain”)
• This gives a faster response and lower E!
• But increasing the gain too much leads to
overshoot and instability
Higher KP
Step
Set input
Point
Low KP

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

Step Higher KP
Set input
Damped response, KD > 0
Point
Low KP
Small derivative
Process Large derivative
Variable Time

• … But still haven’t eliminated steady-state error!


Combating Steady-State Error: I Term
• Idea: apply correction based on integrated error
– If error persists, integrated term will grow in magnitude
– Sum proportional and integral term into control output
e(t) u(t)
SP -  Plant KP PV

  KI

Then u(t) = KP  e(t) + KI   e(t) (where the integral of


the error term is taken over some specified time interval)
This produces a proportional-integral (PI) controller

Incorporating the I term eliminates SSE by modulating


the plant input so that the time-averaged error is zero.
Putting it All Together: PID Control
• Incorporate P, I and D terms in controller output
– Combine as a weighted sum, using gains as weights

d/dt  KD

e(t) u(t)
SP -   Plant PV
KP
  KI

Then u(t) = KP  e(t) + KI   e(t) + KD  d [e(t)] / dt


This is a “proportional-integral-derivative” or PID controller
Implementation Issues
• How do we approximate Ki *  err(t) dt to
implement an I controller?

• How do we approximate Kd * derr/dt to


implement a D controller?
PID Examples
Ziegler-Nichols Tuning Method
Exploration: set the plant under P control and start increasing
the Kp gain until loop oscillates
Note critical gain KC and oscillation period TC

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
Critical Gain (Verge of instability)
Control summary
Control type Feedback Pro/Con

Bang- Simple
bang discrete yes /
Discrete

Open Simple/may
loop Control law no be
unrepeatable

Closed Continuous/
loop P, I, D yes Tune Gains
Velocity PID Controller

Here we are controlling wheel speed.

A rate controller leaves motor output unchanged if error is


0. No steady state error, so we can remove I.
What You Should Have Learnt!
• 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
• Car example
Example: driving
• Steer a car in the center of a lane
Example: driving
• Steer a car in the center of it lane

Observed error: distance off from center line


Example: driving
• Steer a car in the center of it lane

Error is zero but how is the car pointed?


What will this do to the car?
P controller is happy on line independent of orientation!
What if respond ~ rate of change ?
• Steer a car in the center of it lane
Example: driving
• Steer a car in the center of it lane

What is the observed rate of error?


Other error?
What if respond ~ rate of change ?
• Steer a car in the center of it lane

D controller is Happy on any parallel line!


What if Road Sloped ?
• Steer a car in the center of its lane
What if Road Sloped ?
• Steer a car in the center of it lane

Slower response uphill

Faster response downhill

Gravity contributes a steady-state error

You might also like