11
Introduction to Experimental Robotics CSCI 1108 — Lecture 16 Review (PID, binary rep. constraints) CSCI 1108 Lecture 16 1 / 11

Introduction to Experimental Robotics CSCI 1108 | …csci1108/202010/files/rob16...Binary Worked-out Example Let us see what is happening in the calculation: c = d * PI / PId d=80

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to Experimental Robotics CSCI 1108 | …csci1108/202010/files/rob16...Binary Worked-out Example Let us see what is happening in the calculation: c = d * PI / PId d=80

Introduction to Experimental RoboticsCSCI 1108 — Lecture 16Review (PID, binary rep. constraints)

CSCI 1108 Lecture 16 1 / 11

Page 2: Introduction to Experimental Robotics CSCI 1108 | …csci1108/202010/files/rob16...Binary Worked-out Example Let us see what is happening in the calculation: c = d * PI / PId d=80

PID Controller Review

PID Controller is not an exactly straightforwardsolution

It was developed by Nicolas Minorsky in 1922 forautomatic ship steering, by his analysis of behaviourof a helmsman (person steering a ship)Previous development is mostly P-control:

I Christiaan Huygens 17th century regulate gap inmillstones in windmills based on speed

I James Watt “conical pendulum” governor for steamengine, patented 1788

I etc.

CSCI 1108 Lecture 16 2 / 11

Page 3: Introduction to Experimental Robotics CSCI 1108 | …csci1108/202010/files/rob16...Binary Worked-out Example Let us see what is happening in the calculation: c = d * PI / PId d=80

PID in Hardware: Pneumatic PID controller

P, I, and D terms adjusted by the dials at the topBy Snip3r at Dutch Wikipedia, CC BY-SA 3.0, https:

//commons.wikimedia.org/w/index.php?curid=1942158

CSCI 1108 Lecture 16 3 / 11

Page 4: Introduction to Experimental Robotics CSCI 1108 | …csci1108/202010/files/rob16...Binary Worked-out Example Let us see what is happening in the calculation: c = d * PI / PId d=80

Some Control Examples

1. Thymio steering following a black tape

2. Car steering, particularly on a snowy road

3. Boat steering

4. Driving a car at a desired speed

5. Tap water temperature control (or roomthermostat)

Other examples: moving robotic arm, etc.

CSCI 1108 Lecture 16 4 / 11

Page 5: Introduction to Experimental Robotics CSCI 1108 | …csci1108/202010/files/rob16...Binary Worked-out Example Let us see what is happening in the calculation: c = d * PI / PId d=80

General Parameters in Controller Analysis

Process variable (PV , or p) — sensed value that wewant to control

SetPoint (SP , or s) — desired target value of the p

Error (e) — difference between p and s; e = p− sControl variable or manipulated variable (CV , MV ,or c) — input into the process that we can control

We also consider the variable of time t in theanalysis

Describe these variables in the five given examples.

CSCI 1108 Lecture 16 5 / 11

Page 6: Introduction to Experimental Robotics CSCI 1108 | …csci1108/202010/files/rob16...Binary Worked-out Example Let us see what is happening in the calculation: c = d * PI / PId d=80

Controllers: P, PI, PID, (PD)

What happens in each case if we use the Pcontroller?

When can I controller help P controller in PIcontroller?

How does D controller helps i PID controller?

How does PD controller operates?

CSCI 1108 Lecture 16 6 / 11

Page 7: Introduction to Experimental Robotics CSCI 1108 | …csci1108/202010/files/rob16...Binary Worked-out Example Let us see what is happening in the calculation: c = d * PI / PId d=80

PID Controller Formula

The general formula for PID control is:

c(t) = Kp · e(t) +Ki ·∫ t

0

e(t′)dt′ +Kd ·de(t)

dt

The controller depends on Kp, Ki and Kd

parameters, in the proportional, integral, andderivative partsOne way to look at the formula is:

I Proportional compensates for the error in thepresent—instantaneous deviation from setpoint,

I Integral compensates for the errors in the past—theaccumulated deviation from setpoint, and

I Derivative compensates for the rror in thefuture—treating the derivative as the “trend” in the error

CSCI 1108 Lecture 16 7 / 11

Page 8: Introduction to Experimental Robotics CSCI 1108 | …csci1108/202010/files/rob16...Binary Worked-out Example Let us see what is happening in the calculation: c = d * PI / PId d=80

Binary Representation Constraints Review

Let us look again at the example of calculatingcircumference of a circle of diameter d = 80mm

Formula c = π · d, and we know π ≈ 3.14159

Correct value: c ≈ 251.3274 ≈ 251mm

We can use a very coarse integer approximationπ ≈ 3 and get c ≈ 240

Other solution: represent π = PI /PId , wherePI = 31416 and PId = 10000

However, “c = d * PI / PId” does not work well

Why? How can we solve this problem?

CSCI 1108 Lecture 16 8 / 11

Page 9: Introduction to Experimental Robotics CSCI 1108 | …csci1108/202010/files/rob16...Binary Worked-out Example Let us see what is happening in the calculation: c = d * PI / PId d=80

Binary Worked-out Example

Let us see what is happening in the calculation:c = d * PI / PId

d=80 and PI=31416, which are in binary:d = 0101 0000 and PI = 0111 1010 1011 1000

When we multiply those numbers, d * PI we get:0010 0110 0101 1001 1000 0000

which is the exact value of2, 513, 280 = 80× 31416, but it needs 32 bits to berepresented (or at least 23)

What happens is that Aseba has to ‘clip’ the resultto the last 16 bits

CSCI 1108 Lecture 16 9 / 11

Page 10: Introduction to Experimental Robotics CSCI 1108 | …csci1108/202010/files/rob16...Binary Worked-out Example Let us see what is happening in the calculation: c = d * PI / PId d=80

Binary Worked-out Example (2)

When we clip the following number (d * PI

= 80× 31416 = 2, 513, 280):0010 0110 0101 1001 1000 0000

to the last 16 bits, we get:0101 1001 1000 0000

= 128 + 256 + 2048 + 4096 + 16384 = 22912which is indeed what Aseba shows if we make thecalculation.

This is why we get the final result ofc = d * PI / PId to be 22913/10000=2 in Aseba

CSCI 1108 Lecture 16 10 / 11

Page 11: Introduction to Experimental Robotics CSCI 1108 | …csci1108/202010/files/rob16...Binary Worked-out Example Let us see what is happening in the calculation: c = d * PI / PId d=80

Binary Worked-out Example (3)

If we use the native function call:call math.muldiv(c, d, PI, PId)

the complete calculation will be done on 32-bitprecision and we get the correct value:80*31416/10000=2,513,280/10000=251

Note: If you wonder how Aseba does division inbinary, you can try to divide 22913 by 10000 usingbinary representation:22913 = 0101 1001 1000 0000 and10000 = 0010 0111 0001 0000

CSCI 1108 Lecture 16 11 / 11