teaching children proportional control using robolab 2 · 2007-03-18 · le conf 2007 make robotics...

32
Teaching Children Teaching Children Proportional Control using Proportional Control using ROBOLAB 2.9 ROBOLAB 2.9 By Dr C S Soh [email protected]

Upload: others

Post on 23-Mar-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

Teaching ChildrenTeaching ChildrenProportional Control usingProportional Control using

ROBOLAB 2.9ROBOLAB 2.9

By Dr C S [email protected]

Page 2: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 2

Objective

• Using ROBOLAB 2.9, children canexperiment with proportional controlthe same way as undergraduates inMIT and other learned institutionsare doing.

Page 3: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 3

Inspiration

• Fred G. Martin “Robotic Explorations - AHands-On Introduction to Engineering”.

• Using mobile robotics systems tointroduce undergraduates toengineering design and problemsolving.

• Chap 5.2.1 - Proportional Control.

Page 4: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

Bang-bang Bang-bang vsvsProportional ControlProportional Control

Power is no good without control

Page 5: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 5

Bang-bang (on/off, all ornothing) control

• Go full speed, then abrupt stop!

Page 6: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 6

Bang-bang Line Following

• Waggles about the line

Page 7: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 7

Feedback Control

We need to know where we arein relation to where we want to be

Page 8: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 8

Proportional Control

• Response of the control algorithm isproportional to the amount of the error.

• Example: a motorist approaching atraffic light that has just turned red.

• He/she would slow down gradually ashe/she gets near to the traffic light.

•• Warning:Warning: some motorists are bang-bang!

Page 9: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

InvestigatingInvestigatingProportional ControlProportional Control

Doing it like MIT

Page 10: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 10

MIT vs Kids

MIT• LEGO parts• Handyboard micro-

controller• Interactive C

software• C language

Kids• LEGO parts• RCX micro-

controller• ROBOLAB 2.9

software• Graphical language

based on LabView

Page 11: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 11

MIT Setup

The proportional-derivative controltest system includes a dc motordriving a two-stage gear reduction,and a large LEGO wheel whichgives the system a fair bit ofmomentum (load on the system).

At the middle stage of the gearing, aquadrature-based shaft encoderkeeps track of the shaft position.

Yep, they useLEGO at MIT, too

Page 12: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 12

Kids’ Setup

• A LEGO 9v gearedmotor is connecteddirectly to a rotationsensor.

• Two of the largemotor-cycle wheelswith tyres were usedas the load.

Page 13: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 13

Using ROBOLAB 2.9Advanced Features

• ROBOLAB 2.9 uses new firmware that allowssetting 100 motor power levels in bothforward and reverse direction.

• Furthermore, it is possible to set PWM to usebrake instead of float in between pulses.

• This provides a very linear relationshipbetween motor power and resultant motorspeed which is necessary for proportionalcontrol to be successful.

Page 14: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 14

Motor Linearity withROBOLAB 2.9

This chart showsclearly the advantageof braking in betweenPWM pulses toachieve a more linearresponse betweenmotor power andspeed.

Brown = brakeGreen = float

Page 15: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 15

Method• The aim is to get to a rotational position of 160 ticks

corresponding to 10 revolutions of the wheels.• Proportional gain was adjusted from 1, 5, 10, 20 and

50.• Motor power was clipped to between -100 and 100.• Sample time of 0.05 sec was used.• Position (ticks) and motor power were data logged for

100 sample points.

Page 16: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 16

Program in words

• Find the error between the target andactual position (in rotation sensor clicks)

• Multiply the error term by the gain factor• Keep the resulting number between

-100 and 100• Set the motor power accordingly

Page 17: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 17

Program in ROBOLAB 2.9

Page 18: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 18

Results: Gain=1• Note that full power is

applied at the start.• Motor power is reduced as it

gets closer to the targetposition.

• But the wheel fallsconsiderably short of thetarget position of 160 ticks.

• If this were a car, it will neverreach its destination! Thinkof that.

Page 19: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 19

Results: Gain=5• This is much better.• The wheel is close to but not

exactly on target.• The slight difference is

known as the offset.

Page 20: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 20

Results: Gain=10• OK, the wheel comes to rest

at the target position.• Note that there is a slight

overshoot before reachingthe target position.

• So the motor had actually toreverse direction to get backon target.

Page 21: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 21

Results: Gain=20• At this stage, the kids want

to rack up the gain!• But as the gain gets larger,

oscillations has crept in.

Page 22: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 22

Results: Gain=50• This is what you get when

you are too greedy!• The system has become

unstable.• This is something engineers

what to avoid.• LEGO Engineers should do

likewise!

Page 23: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 23

Validation: MIT Gain=10

Page 24: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 24

Validation: MIT Gain=20

Page 25: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 25

Validation: MIT Gain=50

Page 26: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 26

Extension

• After the wheel has come to rest butwhile data is being logged, try to turnthe wheel by hand.

• What do you feel?• What do you notice as the proportional

gain is increased?

Page 27: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 27

Next Lesson...

• In the next assignment, we will try toinclude the other components of PIDcontrol, namely derivative and integralelements.

• Now you know why you have to studyall that differentiation and integrationstuff.

Page 28: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 28

Car using proportionalcontrol

Page 29: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 29

Proportional Line Follower

Page 30: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 30

Balancing Bot

Page 31: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

LE Conf 2007 Make robotics the Fifth R 31

Proportional Control -Other Applications

• Wall following• Robot arm• Inverted pendulum• etc.

Page 32: Teaching Children Proportional Control using ROBOLAB 2 · 2007-03-18 · LE Conf 2007 Make robotics the Fifth R 2 Objective • Using ROBOLAB 2.9, children can experiment with proportional

Q & AQ & A

By Dr C S [email protected]