basics of control - university of washington · the pid controller a weighted combination of...
TRANSCRIPT
![Page 1: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/1.jpg)
Basics of Control Based on slides by Benjamin Kuipers
How can an information system (like a micro-CONTROLLER, a fly-ball governor, or your brain) control the physical world?
Examples: Thermostat You, walking down the street without
falling over A robot trying to keep a joint at a
particular angle A blimp trying to maintain a particular
heading despite air movement in the room
A robot finger trying to maintain a particular distance from an object
CSE 466 Control 1
![Page 2: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/2.jpg)
A controller
CSE 466 Control 2
Controller is trying to balance sensor values on 4 sensors
![Page 3: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/3.jpg)
Controlling a Simple System
Consider a simple system:
Scalar variables x and u, not vectors x and u. Assume effect of motor command u:
The setpoint xset is the desired value. The controller responds to error: e = x xset
The goal is to set u to reach e = 0.
( , )x F x u
0Fu
Action
StateChange in state “is a fn of”
![Page 4: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/4.jpg)
Joint angle controller example
CSE 466 Control 4
State : joint angle
Action : motor command causes to change: 0
Sensor : joint angle encoderSet point : a target joint angle (or vector of angles)Linear restoring force / Quadratic error function
sprin
20
g like behaviorSpring Force Spring Energy 1 2( )F kx E x x
![Page 5: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/5.jpg)
The intuition behind control
Use action u to push back toward error e = 0
What does pushing back do? Position vs velocity versus acceleration control
How much should we push back? What does the magnitude of u depend on?
![Page 6: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/6.jpg)
Velocity or acceleration control?
Velocity:
Acceleration:
( ) ( , ) ( )x F u x x u x (x)
x xv
( , )x v
Fv u
x x u
v x u
![Page 7: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/7.jpg)
Laws of Motion in Physics
Newton’s Law: F=ma or a=F/m.
But Aristotle said: Velocity, not acceleration, is proportional to the
force on a body. True in a friction-dominated setting
/x vv F m
x
![Page 8: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/8.jpg)
The Bang-Bang Controller Push back, against the direction of the error
Error:
To prevent chatter around
Household thermostat. Simple but effective. PWM!
e x xset
0 : ( , ) 00 : ( , ) 0
e u on x F x one u off x F x off
::
e u one u off
e 0i.e., use small hysteresis , instead of0 as threshold
![Page 9: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/9.jpg)
Bang-Bang Control
CSE 466 Control 9
Here, error is
e=xhuman – xrobotin some region close to the robot
![Page 10: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/10.jpg)
Proportional Control Push back, proportional to the error.
Set ub so that For a linear system, exponential
convergence.
The controller gain k determines how quickly the system responds to error.
u ke ub
( , ) 0set bx F x u
x(t) Ce t xset
ub: bias action
![Page 11: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/11.jpg)
Proportional control (discrete time)
CSE 466 Control 11
![Page 12: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/12.jpg)
Velocity Control
You want the robot to move at velocity vset.
You command velocity vcmd. You observe velocity vobs.
Define a first-order controller:
k is the controller gain.
( )cmd obs setv k v v
![Page 13: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/13.jpg)
Velocity control
CSE 466 Control 13
![Page 14: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/14.jpg)
Steady-State Offset
Suppose we have continuing disturbances:
The P-controller cannot stabilize at e = 0. Why not?
( , )x F x u d
![Page 15: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/15.jpg)
Steady-State Offset
Suppose we have continuing disturbances:
The P-controller cannot stabilize at e = 0. If ub is defined so F(xset,ub) = 0 then F(xset,ub) + d 0, so the system is
unstable Must adapt ub to different disturbances d.
( , )x F x u d
![Page 16: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/16.jpg)
Nonlinear P-control
Generalize proportional control to
Nonlinear control laws have advantages f has vertical asymptote: bounded error e f has horizontal asymptote: bounded effort u Possible to converge in finite time. Nonlinearity allows more kinds of composition.
( ) bu f e u
![Page 17: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/17.jpg)
Derivative Control
Damping friction is a force opposing motion, proportional to velocity.
Try to prevent overshoot by damping controller response.
Estimating a derivative from measurements is fragile, and amplifies noise.
P Du k e k e
![Page 18: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/18.jpg)
Adaptive Control
Sometimes one controller isn’t enough. We need controllers at different time scales.
This can eliminate steady-state offset. Why?
u kPe ub
whereb I I Pu k e k k
![Page 19: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/19.jpg)
Adaptive Control
Sometimes one controller isn’t enough. We need controllers at different time scales.
This can eliminate steady-state offset. Because the slower controller adapts ub.
u kPe ub
whereb I I Pu k e k k
![Page 20: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/20.jpg)
Integral Control
The adaptive controller
Therefore
The Proportional-Integral (PI) Controller.
b Iu k e
0
( )t
b I bu t k edt u
0
( ) ( )t
P I bu t k e t k edt u
Integrate both sides wrt time
![Page 21: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/21.jpg)
Proportional – Integral (PI) control
CSE 466 Control 21
![Page 22: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/22.jpg)
The PID Controller
A weighted combination of Proportional, Integral, and Derivative terms.
The PID controller is the workhorse of the control industry. Tuning is non-trivial.
0
( ) ( ) ( )t
P I Du t k e t k edt k e t
![Page 23: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/23.jpg)
PID controller
CSE 466 Control 23
![Page 24: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/24.jpg)
Tuning
PID properties to consider Rise time Overshoot Settling time Steady-state error Stability
Many PID tuning methods exist
CSE 466 Control 24
Proportional gain term
![Page 25: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/25.jpg)
Integral and Derivative terms
Question from class: the integral of the red trace on the left is non-zero. Yet the controller is converging to the setpoint. Is there a decay mechanisms for the I term?
A: not necessarily. In this example system, a non-zero bias command may be necessary to keep the system at its setpoint. Think of an application like gravity compensation: to keep the joint still, you may have to apply a constant force to counteract gravity. The integral term can find that bias point.
CSE 466 Control 25
Integral gain term Derivative gain term
![Page 26: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/26.jpg)
PID Control Demohttps://sites.google.com/site/fpgaandco/pid
CSE 466 Control 26
![Page 27: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/27.jpg)
Habituation Integral control adapts the bias term ub. Habituation adapts the setpoint xset. It prevents situations where too much control
action would be dangerous. Both adaptations reduce steady-state error.
u kPe ub
whereset h h Px k e k k
![Page 28: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/28.jpg)
Other control techniques Feedback control
Sense error, determine control response. Feedforward control
Sense disturbance, predict resulting error, respond to predicted error before it happens.
Optimal control Optimize some sort of cost (e.g. actuation energy) Linear Quadratic Gaussian Control (LQC) Model-predictive control
Plan trajectory to reach goal. Take first step. Repeat. Combines benefits of planning & control See Emo Todorov’s ping pong ball juggling robot
“Intelligent control” Use machine learning, planning May learn system dynamics (state, action state)
Even with the model learned, you may need to do planning to find a sequence of actions that gets you to the goal state
Culturally more CS than EE Tends to use more complex data structures Less amenable to mathematical analysis
![Page 29: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/29.jpg)
Example PID controller ---OpenServo Servomotor controller High performance AVR 8-bit microcontroller Compact H-Bridge with high performance MOSFETs Precision control over servo position and speed I2C/TWI based interface for control and feedback Feedback of position, speed, voltage and power Advanced curve based motion profile support EEPROM storage of servo configuration information Software written in C using free development tools I2C/TWI bootloader and GUI programmer
CSE 466 Control 29
http://www.openservo.com/
![Page 30: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/30.jpg)
Open Servo API
CSE 466 Control 30
API call DescriptionSet Position Set the position of the servoSet the servo address Configure the device address of the servo on the
TWI/I2C busConfigure PID Configure the servo response parametersServo specific configuration Configure servo max and min positions, as well as
deadband and reverse seekServo commands Send a command to the OpenServo to stop, start or
resetMotion Profiles Program the OpenServo to follow complex hermite
curvesR/C PWM Motion Run your OpenServo from an R/C controller
![Page 31: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/31.jpg)
Open Servo PID configuration
CSE 466 Control 31
0x22 PID_PGAIN_HI PID proportional gain high byte0x23 PID_PGAIN_LO PID proportional gain low byte0x24 PID_DGAIN_HI PID derivative gain high byte0x25 PID_DGAIN_LO PID derivative gain low byte0x26 PID_IGAIN_HI PID integral gain high byte0x27 PID_IGAIN_LO PID integral gain low byte
![Page 32: Basics of Control - University of Washington · The PID Controller A weighted combination of Proportional, Integral, and Derivative terms. The PID controller is the workhorse of the](https://reader036.vdocuments.site/reader036/viewer/2022081521/5eaf0f39dd67a36c1b7fdb0d/html5/thumbnails/32.jpg)
End
CSE 466 Control 32