robotics programming...
TRANSCRIPT
![Page 1: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/1.jpg)
Chair of Software Engineering
Robotics Programming Laboratory
Bertrand MeyerJiwon Shin
Lecture 3:
Control
![Page 2: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/2.jpg)
2
Go forward, go right
Robot1 Robot2
Holonomic
DDOF=DOF
Nonholonomic
DDOF<DOF
DOF: Ability to achieve various poses
DDOF: Ability to achieve various velocities
![Page 3: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/3.jpg)
3
Differential drive
Forward:
Backward:
Right turn:
Left turn:
L R
0L R
L R
0L R
L R
![Page 4: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/4.jpg)
4
Differential drive
cos
sin
x v
y v
( , )x y
( , )v Input:
![Page 5: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/5.jpg)
5
Differential drive
B
R
( )cos
2
( )sin
2
( )
L R
L R
R L
x R
y R
R
B
L R
![Page 6: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/6.jpg)
6
Odometry: intuition
![Page 7: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/7.jpg)
7
Odometry for small t
( ) ( 1) cos ( )
( ) ( 1) sin ( )
( ) ( 1)
C
C
C
x t x t d t
y t y t d t
t t
B
Cd
Ld
Rd
1
2( )
C L R
R L
C
d d d
d d
B
![Page 8: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/8.jpg)
8
More accurate odometry for small t
1
2
1
2
( ) ( 1) cos( ( 1) )
( ) ( 1) sin( ( 1) )
( ) ( 1)
C C
C C
C
x t x t d t
y t y t d t
t t
B
Cd
Ld
Rd
1
2( )
arctan( )
C L R
R L
C
d d d
d d
B
![Page 9: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/9.jpg)
9
Wheel encoder
How do we get the distance each wheel has moved?
If the wheel has N ticks per revolution:
Thymio:
( ) ( 1)
2
tick tick tick
tick
n n t n t
nd R
N
Drift
d d t
![Page 10: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/10.jpg)
10
Go to goal
Goal
Control
![Page 11: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/11.jpg)
11
Feedback
A collection of two or more dynamical systems, in which each system influences the other, resulting in strongly-coupled dynamics
Open loop: the systems are not interconnected (no feedback)
Closed loop: the systems are interconnected (with feedback)
System 1 System 2
System 1 System 2
System 1 System 2
![Page 12: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/12.jpg)
12
Control
The use of algorithms and feedback in engineered systems
Robot speed control
Actuator: set the robot’s speed
Sensor: sense the robot’s actual speed
Control goals: set the robot’s speed such that:
Stability: the robot maintains the desired speed
Performance: the robot responds quickly to changes
Robustness: the robot tolerates perturbation in dynamics
Actuator
Sensor
ControllerDesired Actual
![Page 13: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/13.jpg)
13
On-off controller
𝑢 = 𝑢𝑚𝑎𝑥 if 𝑒 > 0𝑢𝑚𝑖𝑛 if 𝑒 < 0
error := set_point – measured
if error > 0.0 then
output := max
else
if error < 0.0 then
output := min
end
end
![Page 14: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/14.jpg)
14
On-off controller
Ou
tpu
t
Time
𝑢 = 𝑢𝑚𝑎𝑥 if 𝑒 > 0𝑢𝑚𝑖𝑛 if 𝑒 < 0
![Page 15: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/15.jpg)
15
Proportional controller
𝑢 𝑡 = 𝑘𝑝𝑒 𝑡
error := set_point – measured
output := k_p * error
![Page 16: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/16.jpg)
16
Proportional controller
Ou
tpu
t
Time
𝑢 𝑡 = 𝑘𝑝𝑒 𝑡
![Page 17: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/17.jpg)
17
Proportional derivative controller
𝑢 𝑡 = 𝑘𝑝𝑒 𝑡 + 𝑘𝑑𝑑𝑒 𝑡
𝑑𝑡
error := set_point – measured
proportional := k_p * error
derivative := k_d * (error - previous_error)/dt
output := proportional + derivative
previous_error := error
![Page 18: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/18.jpg)
18
Proportional derivative controller
𝑢 𝑡 = 𝑘𝑝𝑒 𝑡 + 𝑘𝑑𝑑𝑒 𝑡
𝑑𝑡O
utp
ut
Time
![Page 19: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/19.jpg)
19
Proportional integral derivative controller
𝑢 𝑡 = 𝑘𝑝𝑒 𝑡 + 𝑘𝑖 0
𝑡
𝑒 𝜏 𝑑𝜏 + 𝑘𝑑𝑑𝑒 𝑡
𝑑𝑡
error := set_point – measured
accumulated_error := accumulated_error + error * dt
proportional := k_p * error
integral := k_i * accumulated_error
derivative := k_d * (error - previous_error)/dt
output := proportional + integral + derivative
previous_error := error
![Page 20: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/20.jpg)
20
Proportional integral derivative controller
Ou
tpu
t
Time
𝑢 𝑡 = 𝑘𝑝𝑒 𝑡 + 𝑘𝑖 0
𝑡
𝑒 𝜏 𝑑𝜏 + 𝑘𝑑𝑑𝑒 𝑡
𝑑𝑡
![Page 21: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/21.jpg)
21
Go to goal
Goal
error := θgoal - θcurrent
![Page 22: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/22.jpg)
22
Control gains
Ziegler-Nicols method
Set Ki and Kd to 0.
Increase Kp until Ku at which point the output starts to oscillate.
Use Ku and the oscillation period Tu to set the control gains.
Manual tuning!
Control Type Kp Ki Kd
P 0.50Ku - -
PI 0.45Ku 1.2Kp/Tu -
PID 0.60Ku 2Kp/Tu KpTu/8
![Page 23: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/23.jpg)
23
P, PI, PID, ….?
𝑘𝑝, 𝑘𝑖 , 𝑘𝑑 ≠ 0
𝑘𝑖 = 0
𝑘𝑑 = 0
𝑘𝑝 = 0
𝑢 𝑡 = 𝑘𝑝𝑒 𝑡 + 𝑘𝑖 0
𝑡
𝑒 𝜏 𝑑𝜏 + 𝑘𝑑𝑑𝑒 𝑡
𝑑𝑡
a.
b.
c.
d.
![Page 24: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/24.jpg)
24
Software engineering tips
make
do
k_p := 1.0
k_i := 0.1
k_d := 0.3
end
make_with_gains (control_gains: ARRAY[REAL_64] )
do
k_p := control_gains[1]
k_i := control_gains[2]
k_d := control_gains[3]
end
![Page 25: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/25.jpg)
25
Software engineering tips
make
do
create robot.make_with_gains ( << 1.0, 0, 0.1 >> )
end
make
local
control_gains: ARRAY[REAL_64]
file: PLAIN_TEXT_FILE
index: INTEGER
do
create control_gains.make_filled (0.0, 1, 3)
create file.make_open_read (“param.txt”)
from index := 1 until index > 3 or file.exhausted loop
file.read_double
control_gains.put (file.last_double, index)
index := index + 1
end
file.close
create robot.make_with_gains (control_gains)
end
![Page 26: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/26.jpg)
26
Software engineering tips
update_velocity ( … )
…
e := desired_angle – current_angle
acc_e := acc_e + e * dt
p := k_p * e
i := k_i * acc_e
d := k_d * (e - prev_e)/dt
prev_e := e
output := p + i + d
…
update_velocity ( … )
…
e := desired_angle – current_angle
output := pid_controller (e,dt)
…
pid_controller ( … )
…
![Page 27: Robotics Programming Laboratoryse.inf.ethz.ch/courses/2015b_fall/rpl/lectures/03_RobotControl.pdf · Robotics Programming Laboratory Bertrand Meyer Jiwon Shin Lecture 3: Control](https://reader035.vdocuments.site/reader035/viewer/2022070113/605b2c34c8a868306e574be2/html5/thumbnails/27.jpg)
27
Software engineering tips
class
GO_TO_GOAL_CONTROLLER
feature
update_velocity ( … )
pid_controller ( … )
…
class
GO_TO_GOAL_CONTROLLER
feature
update_velocity ( … )
…
class
PID_CONTROLLER
feature
pid_controller ( … )
…