63
Control for Mobile Robots Christopher Batten

Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

  • Upload
    vutruc

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Control for Mobile Robots

Christopher Batten

Page 2: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Building a control system for

a mobile robot can be very challenging

Mechanical Electrical Software

Mobile robots are very complex and involve

many interacting components

Your control system must integrate these components

so that your robot can achieve the desired goal

Page 3: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Sistem Robot dan orientasi fungsi

Page 4: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Sistem robot dengan kontroler prosessor

Page 5: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Kontroler Berbasis Prosessor dengan UI

Page 6: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Building a control system for

a mobile robot can be very challenging

• How will you debug and test your robot?

• What are the performance requirements?

• Can you easily improve aspects of your robot?

• Can you easily integrate new functionality?

Just as you must carefully design your

robot chassis you must carefully design

your robot control system

Page 7: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Sistem Kontrol Robot

Turn right 90 Go forward until reach obstacle

Capture a ball Explore playing field

•Dasar dari sistem kontrol adalah perilaku

•Perilaku harus didefinisikan dengan baik

•Tiap perilaku harus dapat diuji secra independen

Page 8: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Sasaran utama menyusun perilaku-perilaku

shg tujuan yang diinginkan tercapai

Page 9: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Pendekatan Model-Plan-Act

1. Gunakan data sensor untuk membuat model

2. Gunakan model membentuk urutan perilaku yang akan

mencapai tujuan yang diinginkan

3. Jalankan rencana (menulis perilaku)

Model

ActuatorsSensors

Pla

n

Act

Environment

Page 10: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Exploring the playing field

using model-plan-act approach

Red dot is the mobile robot

while the blue line is the mousehole

Page 11: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Exploring the playing field

using model-plan-act approach

Robot uses sensors to create local map of the

world and identify unexplored areas

Page 12: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Exploring the playing field

using model-plan-act approach

Robot moves to midpoint of

unexplored boundary

Page 13: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Exploring the playing field

using model-plan-act approach

Robot performs a second sensor scan and

must align the new data with the global map

Page 14: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Exploring the playing field

using model-plan-act approach

Robot continues to explore

the playing field

Page 15: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Exploring the playing field

using model-plan-act approach

Robot must recognize when it starts to

see areas which it has already explored

Page 16: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Finding a mousehole

using model-plan-act approach

Given the global map,

the goal is to find the mousehole

Page 17: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Finding a mousehole

using model-plan-act approach

Transform world into configuration space

by convolving robot with all obstacles

Page 18: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Finding a mousehole

using model-plan-act approach

Decompose world into convex cells

Trajectory within any cell is free of obstacles

Page 19: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Finding a mousehole

using model-plan-act approach

Connect cell edge midpoints and centroids to

get graph of all possible paths

Page 20: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Finding a mousehole

using model-plan-act approach

Use an algorithm (such as the A*

algorithm) to find shortest path to goal

Page 21: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Finding a mousehole

using model-plan-act approach

The choice of cell decomposition can

greatly influence results

Page 22: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Advantages and disadvantages

of the model-plan-act approach

• Advantages

– Pengetahuan global dapat digunakan untuk

menentukan optimasi

– Dapat membuat rencana

• Disadvantages

– Harus mengimplementasikan semua unit fungsional

sebelum digunakan

– komputasi secara intensif

– Memerlukan data sensor yang sangat baik untuk

model yang akurat

– Bekerja buruk dalam lingkungan yang dinamis

Page 23: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Emergent Approach

Makhluk hidup seperti lebah madu mampu

mengeksplorasi lingkungan mereka dan

menemukan target (madu)

Is this bee using the

model-plan-act

approach?

Used with permission, © William Connolley

http://wnconnolley.ork.uk

Page 24: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Emergent Approach

Should we design our robots so they act less

like robots and more like honey bees?

Page 25: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Emergent Approach

ActuatorsSensors

Behavior C

Behavior B

Behavior A

Environment

As in biological systems, the emergent approach uses

simple behaviors to directly couple sensors and actuators

Higher level behaviors are layered

on top of lower level behaviors

Page 26: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

To illustrate the emergent approach

we will consider a simple mobile robot

Bump Switches

Infrared Rangefinders

Ball Detector Switch

Camera

Ball Gate

Page 27: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Layering simple behaviors can create

much more complex emergent behavior

Jelajah Motors

Cruise behavior simply moves robot forward

Page 28: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Layering simple behaviors can create

much more complex emergent behavior

Jelajah

MenghindarInfrared

S Motors

Left motor speed inversely proportional to left IR range

Right motor speed inversely proportional to right IR range

If both IR < threshold stop and turn right 120 degrees

Subsumption

Page 29: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Layering simple behaviors can create

much more complex emergent behavior

Jelajah

Menghindar

Mundur dan belok

Infrared

Bump

S

S

Motors

Escape behavior stops motors,

backs up a few inches, and turns right 90 degrees

Page 30: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Layering simple behaviors can create

much more complex emergent behavior

Jelajah

menghindar

Mundur dan belok

mencari

Infrared

Bump

Camera

S S

S

Motors

The track ball behavior adjusts the

motor differential to steer the robot towards the ball

Page 31: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Layering simple behaviors can create

much more complex emergent behavior

jelajah

menhindar

Mundur dan belok

Mencari bola

Memgang bola

Infrared

Bump

Camera

Detektor

sentuh

S S

S

Motors

Ball

Gate

Hold ball behavior simply closes ball gate

when ball switch is depressed

Page 32: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Layering simple behaviors can create

much more complex emergent behavior

Jelajah

mengindar

Mundur dan belok

Mencari bola

Memgang bola

Mencari gol

Infrared

Bump

Camera

Detektor

sentuh

S S S

S

S

Motors

Ball

Gate

The track goal behavior opens the ball gate and

adjusts the motor differential to steer the robot

towards the goal

Page 33: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Layering simple behaviors can create

much more complex emergent behavior

All behaviors are always running in parallel and an

arbiter is responsible for picking which behavior can

access the actuators

Jelajah

mengindar

Mundur dan belok

Mencari bola

Memgang bola

Mencari gol

Infrared

Bump

Camera

Ball

Switch

S S S

S

S

Motors

Ball

Gate

Page 34: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Advantages and disadvantages

of the behavioral approach

• keuntungan

– Pengembangan bertahap sangat alami

– Modularitas membuat eksperimen mudah

– Dapat menangani lingkungan yang dinamis

• kekurangan

– Sulit untuk menilai apa robot benar-benar akan

melakukan

– Tidak ada kinerja atau kelengkapan jaminan

– Debugging bisa sangat sulit

Page 35: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Model-plan-act fuses sensor data,

while emergent fuses behaviors

Model

Pla

n

Act

Environment

Behavior C

Behavior B

Behavior A

Model-Plan-Act Emergent

Environment

Fixed plan of behaviors Layered behaviors

Lots of preliminary planning No preliminary planning

Lots of internal state Very little internal state

Page 36: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Finite State Machines offer another

alternative for combining behaviors

Fwd

(dist)

TurnR

(deg)

Fwd behavior moves robot

straight forward a given distance

TurnR behavior turns robot to the

right a given number of degrees

FSMs have some preliminary planning and some state.

Some transitions between behaviors are decided

statically while others are decided dynamically.

Page 37: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

TurnR

(90)

Finite State Machines offer another

alternative for combining behaviors

Fwd

(2ft)

Fwd

(2ft)

Each state is just a specific behavior

instance - link them together to create

an open loop control system

Page 38: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

TurnR

(90)

Finite State Machines offer another

alternative for combining behaviors

Fwd

(2ft)

Fwd

(2ft)

Each state is just a specific behavior

instance - link them together to create

an open loop control system

Page 39: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

TurnR

(90)

Finite State Machines offer another

alternative for combining behaviors

Fwd

(2ft)

Fwd

(2ft)

Each state is just a specific behavior

instance - link them together to create

an open loop control system

Page 40: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

TurnR

(90)

Finite State Machines offer another

alternative for combining behaviors

Fwd

(2ft)

Fwd

(2ft)

Each state is just a specific behavior

instance - link them together to create

an open loop control system

Page 41: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

TurnR

(90)

Finite State Machines offer another

alternative for combining behaviors

Fwd

(2ft)

Fwd

(2ft)

Since the Maslab playing field is

unknown, open loop control systems

have no hope of success!

Page 42: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

TurnR

(45)

Finite State Machines offer another

alternative for combining behaviors

Fwd

(1ft)

Closed loop finite state machines use

sensor data as feedback to make

state transitions

No Obstacle

Obstacle

Within 2ft

No

Obstacle

Obstacle

Within 2ft

Page 43: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

TurnR

(45)

Finite State Machines offer another

alternative for combining behaviors

Fwd

(1ft)

No Obstacle

Obstacle

Within 2ft

No

Obstacle

Obstacle

Within 2ft

Closed loop finite state machines use

sensor data as feedback to make

state transitions

Page 44: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

TurnR

(45)

Finite State Machines offer another

alternative for combining behaviors

Fwd

(1ft)

No Obstacle

Obstacle

Within 2ft

No

Obstacle

Obstacle

Within 2ft

Closed loop finite state machines use

sensor data as feedback to make

state transitions

Page 45: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

TurnR

(45)

Finite State Machines offer another

alternative for combining behaviors

Fwd

(1ft)

No Obstacle

Obstacle

Within 2ft

No

Obstacle

Obstacle

Within 2ft

Closed loop finite state machines use

sensor data as feedback to make

state transitions

Page 46: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

TurnR

(45)

Finite State Machines offer another

alternative for combining behaviors

Fwd

(1ft)

No Obstacle

Obstacle

Within 2ft

No

Obstacle

Obstacle

Within 2ft

Closed loop finite state machines use

sensor data as feedback to make

state transitions

Page 47: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Implementing a

Finite State Machine in Java

switch ( state ) {

case States.Fwd_1 :

moveFoward(1);

if ( distanceToObstacle() < 2 )

state = TurnR_45;

break;

case States.TurnR_45 :

turnRight(45);

if ( distanceToObstacle() >= 2 )

state = Fwd_1;

break;

}

TurnR

(45)

Fwd

(1ft)

No Obstacle

Obstacle

Within 2ft

Obstacle

Within 2ft

Page 48: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

• Implement

behaviors as

parameterized

functions

• Each case

statement includes

behavior instance

and state transition

• Use enums for

state variables

Implementing a

FSM in Java

switch ( state ) {

case States.Fwd_1 :

moveFoward(1);

if ( distanceToObstacle() < 2 )

state = TurnR_45;

break;

case States.TurnR_45 :

turnRight(45);

if ( distanceToObstacle() >= 2 )

state = Fwd_1;

break;

}

Page 49: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Turn

To

Open

Finite State Machines offer another

alternative for combining behaviors

Fwd

Until

Obs

Can also fold closed loop feedback

into the behaviors themselves

Page 50: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Simple finite state machine

to locate red balls

Scan

360

Wander

(20sec)

Fwd

(1ft)

Align

Ball

TurnR

Stop

No Balls

Found

Ball

Lost

BallBall

< 1ft

Ball

> 1ft

Page 51: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Simple finite state machine

to locate red balls

Scan

360

Wander

(20sec)

Fwd

(1ft)

Align

Ball

TurnR

Stop

No Balls

Found

Ball

Lost

BallBall

< 1ft

Ball

> 1ft

Obstacle < 2ft

Page 52: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Outline

• High-level control system paradigms

– Model-Plan-Act Approach

– Behavioral Approach

– Finite State Machine Approach

• Low-level control loops

– PID controller for motor velocity

– PID controller for robot drive system

Page 53: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Problem: How do we set

a motor to a given velocity?

Open Loop Controller

– Use trial and error to create

some kind of relationship

between velocity and voltage

– Changing supply voltage or

drive surface could result in

incorrect velocity

MotorVelocity

To Volts

Desired

VelocityActual

Velocity

Page 54: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Controller

Problem: How do we set

a motor to a given velocity?

Closed Loop Controller

– Feedback is used to adjust the

voltage sent to the motor so

that the actual velocity equals

the desired velocity

– Can use an optical encoder to

measure actual velocity

MotorDesired

Velocity

Actual

VelocityAdjusted

Voltage

err

Page 55: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Step response

with no controller

Time (sec)

Velo

city

• Slow rise time

• Stead-state offset

MotorVelocity

To Volts

Desired

VelocityActual

Velocity

Page 56: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Step response

with proportional controller

Time (sec)

Velo

city

actdesPdes VVKVX

• Big error big = big adj

• Faster rise time

• Overshoot

• Stead-state offset

(there is still an error

but it is not changing!)

Controller Motor

Desired

Velocity

(Vdes)

Actual

Velocity

(Vact)Adjusted

Volts (X)

err

Page 57: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Step response

with proportional-derivative controller

Time (sec)

Velo

city

dt

tdeKteKVX DPdes

)()(

• When approaching desired

velocity quickly, de/dt term

counteracts proportional

term slowing adjustment

• Faster rise time (waktu

naik lebih cepat)

• Reduces overshoot

Controller Motor

Desired

Velocity

(Vdes)

Actual

Velocity

(Vact)Adjusted

Volts (X)

err

Page 58: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Step response

with proportional-integral controller

Time (sec)

Velo

city

dtteKteKVX IPdes )()(

• Integral menghilangkan

akumulasi error

• Meningkatkan overshoot

Controller Motor

Desired

Velocity

(Vdes)

Actual

Velocity

(Vact)Adjusted

Volts (X)

err

Page 59: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Step response

with PID controller

Time (sec)

Velo

city

dt

tdeK

dtteK

teKVX

D

I

Pdes

)(

)(

)(

Controller Motor

Desired

Velocity

(Vdes)

Actual

Velocity

(Vact)Adjusted

Volts (X)

err

Page 60: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Choosing and tuning

a controller

Rise Time Overshoot Error

Proportional Decrease Increase Decrease

Integral Decrease Increase Eliminate

Derivative ~ Decrease ~

© 1996 Regents of UMich -- http://www.engin.umich.edu/group.ctm

Controller Motor

Desired

Velocity

(Vdes)

Actual

Velocity

(Vact)Adjusted

Volts (X)

err

Page 61: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

Choosing and tuning

a controller

• Gunakan kontroler yg sederhana

untuk mencapai yang diinginkan

• Tuning PID constants is very tricky,

especially for integral constants

Controller Motor

Desired

Velocity

(Vdes)

Actual

Velocity

(Vact)Adjusted

Volts (X)

err

Page 62: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

The digital camera is a powerful sensor

for estimating error in our control loops

– Track wall ticks to see

how they move

through the image

– Use analytical model

of projection to

determine an error

between where they

are and where they

should be if robot is

going straight

– Push error through

PID controller

Page 63: Control for Mobile Robots - Universitas · PDF fileBuilding a control system for a mobile robot can be very challenging Mechanical Electrical Software Mobile robots are very complex

The digital camera is a powerful sensor

for estimating error in our control loops

– Track how far ball

center is from center of

image

– Use analytical model of

projection to determine

an orientation error

– Push error through

PID controller

What if we just used a simple proportional

controller? Could lead to steady-state error if

motors are not perfectly matched!