Professional Documents
Culture Documents
003 - Tmkusuma2013 - IT-012276 - ROBOTIKA (Sistem Kendali Mobile Robot) PDF
003 - Tmkusuma2013 - IT-012276 - ROBOTIKA (Sistem Kendali Mobile Robot) PDF
Sensors Actuators
Sensors are far from perfect Actuators are far from perfect
Camera white balance = bad colors Motor velocity changes over time
Ultrasound reflections Wheels and gears slip
Infrared sensors can be noisy Servos get stuck
… and many more! … and many more!
Even if the world was perfect, the sheer
complexity of a robot can be daunting
Mechanical Electrical Software
Don’t just code a control system,
design a control system!
}
}
An example of how not to design your
robot control system
void moveForward( int time ) {
}
}
An example of how not to design your
robot control system
void moveForward( int time ) {
}
}
An example of how not to design your
robot control system
void moveForward( int time ) {
}
}
An example of how not to design your
robot control system
void moveForward( int time ) {
. . .
while ( t < time ) {
// Need to find some goals
// Drive forward a bit --------------------------------------
-------------------------------------- --------------------------------------
--------------------------------------
// What if there are no goals visible?
// Check ir sensor and stop if necessary --------------------------------------
-------------------------------------- --------------------------------------
--------------------------------------
// Drop off some balls
// Rotate if there is an obstacle --------------------------------------
-------------------------------------- --------------------------------------
--------------------------------------
// Find more balls I guess
// Need to find some balls --------------------------------------
-------------------------------------- --------------------------------------
--------------------------------------
// Make sure to ignore balls in goal
// Somehow pick up a ball --------------------------------------
-------------------------------------- --------------------------------------
--------------------------------------
// Try to go somewhere new
// What if there is more than one ball? --------------------------------------
-------------------------------------- --------------------------------------
--------------------------------------
}
. . . }
An example of how not to design your
robot control system
void moveForward( int time )
void moveForward( int time ) {
. . .
Model
Plan
Act
Sensors Actuators
Environment
http://www.cs.columbia.edu/~pblaer/projects/path_planner
Advantages and disadvantages
of the model-plan-act approach
• Advantages
– Global knowledge in the model enables optimization
– Can make provable guarantees about the plan
• Disadvantages
– Must implement all functional units before any testing
– Computationally intensive
– Requires very good sensor data for accurate models
– Models are inherently an approximation
– Works poorly in dynamic environments
Emergent Approach
Living creatures like honey bees are
able to explore their surroundings
and locate a target (honey)
Is this bee using the
model-plan-act
approach?
Behavior B
Behavior A
Sensors Actuators
Environment
Ball Gate
Bump Switches
Infrared Rangefinders
Camera
Layering simple behaviors can create
much more complex emergent behavior
Cruise Motors
Infrared Avoid
Cruise
Arbiter Motors
Bump Escape
Infrared Avoid
Cruise
Arbiter Motors
Bump Escape
Infrared Avoid
Cruise
Arbiter Motors
Ball
Switch Hold Ball Ball Gate
Bump Escape
Infrared Avoid
Cruise
Arbiter Motors
Track Goal
Ball Arb
Switch Hold Ball
Bump Escape
Infrared Avoid
Cruise
Arbiter Motors
Cruise
Arbiter Motors
Controller architecture for
collection simulation
From “Robot Programming: A Practical Guide to Behavior Based Robotics”, Joseph Jones
Advantages and disadvantages
of the behavioral approach
• Advantages
– Incremental development is very natural
– Modularity makes experimentation easier
– Cleanly handles dynamic environments
• Disadvantages
– Difficult to judge what robot will actually do
– No performance or completeness guarantees
– Debugging can be very difficult
Model-plan-act fuses sensor data,
while emergent fuses behaviors
Model Behavior C
Plan
Act
Behavior B
Behavior A
Environment Environment
Model-Plan-Act Emergent
Lots of internal state Very little internal state
Lots of preliminary planning No preliminary planning
Fixed plan of behaviors Layered behaviors
Finite State Machines offer another
alternative for combining behaviors
Fwd
(2ft)
TurnR
(90)
Fwd
(2ft)
TurnR
(90)
Fwd
(2ft)
TurnR
(90)
Fwd
(2ft)
TurnR
(90)
Fwd
(2ft)
TurnR
(90)
Fwd
(1ft)
Obstacle
Within 2ft
No
Obstacle
TurnR Closed loop finite state machines use
(45) sensor data as feedback to make
state transitions
Obstacle
Within 2ft
Finite State Machines offer another
alternative for combining behaviors
No Obstacle
Fwd
(1ft)
Obstacle
Within 2ft
No
Obstacle
TurnR Closed loop finite state machines use
(45) sensor data as feedback to make
state transitions
Obstacle
Within 2ft
Finite State Machines offer another
alternative for combining behaviors
No Obstacle
Fwd
(1ft)
Obstacle
Within 2ft
No
Obstacle
TurnR Closed loop finite state machines use
(45) sensor data as feedback to make
state transitions
Obstacle
Within 2ft
Finite State Machines offer another
alternative for combining behaviors
No Obstacle
Fwd
(1ft)
Obstacle
Within 2ft
No
Obstacle
TurnR Closed loop finite state machines use
(45) sensor data as feedback to make
state transitions
Obstacle
Within 2ft
Finite State Machines offer another
alternative for combining behaviors
No Obstacle
Fwd
(1ft)
Obstacle
Within 2ft
No
Obstacle
TurnR Closed loop finite state machines use
(45) sensor data as feedback to make
state transitions
Obstacle
Within 2ft
Implementing a
Finite State Machine in Java
No Obstacle
switch ( state ) {
case States.TurnR_45 :
turnRight(45);
if ( distanceToObstacle() >= 2 )
state = Fwd_1;
TurnR break;
(45) }
Obstacle
Within 2ft
Implementing a
FSM in Java
• Implement
switch ( state ) {
behaviors as
parameterized case States.Fwd_1 :
moveFoward(1);
functions if ( distanceToObstacle() < 2 )
state = TurnR_45;
• Each case break;
statement includes
case States.TurnR_45 :
behavior instance turnRight(45);
and state transition if ( distanceToObstacle() >= 2 )
state = Fwd_1;
• Use enums for break;
state variables }
Finite State Machines offer another
alternative for combining behaviors
Fwd
Until
Obs
Turn
Can also fold closed loop feedback
To
Open into the behaviors themselves
Simple finite state machine
to locate red balls
Found
Wander Scan
Ball
TurnR
(20sec) 360
No Balls
Lost
Ball
Ball
Align < 1ft
Stop
Does this FSM work? Ball
Ball
> 1ft
Fwd
(1ft)
Simple finite state machine
to locate red balls
Found
Wander Scan
Ball
TurnR
(20sec) 360
No Balls
Lost
Ball
Ball
Align < 1ft
Stop
Does this FSM work? Ball
Ball
> 1ft
Fwd
(1ft)
Simple finite state machine
to locate red balls
Found
Wander Scan
Ball
TurnR
(20sec) 360
No Balls
Lost
Ball
Ball
Align < 1ft
Stop
Does this FSM work? Ball
Ball
> 1ft
Fwd
(1ft)
Simple finite state machine
to locate red balls
Found
Wander Scan
Ball
TurnR
(20sec) 360
No Balls
Lost
Ball
Ball
Align < 1ft
Stop
Does this FSM work? Ball
Ball
> 1ft
Fwd
(1ft)
Simple finite state machine
to locate red balls
Found
Wander Scan
Ball
TurnR
(20sec) 360
No Balls
Lost
Ball
Ball
Align < 1ft
Stop
Ball
Ball
> 1ft
No Balls
Lost
Ball
Ball
Align < 1ft
Stop
Ball
What if robot Ball
has trouble > 1ft
correctly
approaching
Obstacle < 2ft Fwd
(1ft)
the ball?
To debug a FSM control system
verify behaviors and state transitions
Found
Wander Scan
Ball
TurnR
(20sec) 360
No Balls
Lost
Ball
Ball
Align < 1ft
Stop
Ball
Ball
Independently > 1ft
verify Align
Ball and Fwd
Obstacle < 2ft Fwd
behaviors (1ft)
Improve FSM control system by replacing
a state with a better implementation
Found
Wander Scan
Ball
TurnR
(20sec) 360
No Balls
Lost
Ball
Ball
Align < 1ft
Stop
Ball
Obstacle Image
Sensors Compute
Thread Thread
Controller
FSM
Drive Motors
Multi-threaded
finite state machine control systems
Short IR
+ Bump Camera
Obstacle Image
Sensors Compute
Thread Thread
Controller
FSM
Drive Motors
Multi-threaded
finite state machine control systems
Short IR Stalk
+ Bump Camera Sensors
Controller
FSM
Drive Motors
Multi-threaded
finite state machine control systems
Short IR Stalk
+ Bump Camera Sensors
Controller
FSM
Mapping
Thread
Drive Motors
Outline
• High-level control system paradigms
– Model-Plan-Act Approach
– Emergent Approach
– Finite State Machine Approach
Desired Actual
Controller Motor
Velocity err Adjusted Velocity
Voltage
Step response
with no controller
Velocity
several differential
equations
• Slow rise time
• Stead-state offset
Time (sec)
Step response
with proportional controller
Desired
Actual
Velocity
Controller Motor Velocity
(Vdes) err Adjusted (Vact)
Volts (X)
Velocity
• Big error big = big adj
• Faster rise time
• Overshoot
• Stead-state offset
(there is still an error
but it is not changing!) Time (sec)
Step response
with proportional-derivative controller
Desired
Actual
Velocity
Controller Motor Velocity
(Vdes) err Adjusted (Vact)
Volts (X)
de(t )
X Vdes K P e(t ) K D
dt
Velocity
• When approaching desired
velocity quickly, de/dt term
counteracts proportional
term slowing adjustment
• Faster rise time
• Reduces overshoot Time (sec)
Step response
with proportional-integral controller
Desired
Actual
Velocity
Controller Motor Velocity
(Vdes) err Adjusted (Vact)
Volts (X)
Velocity
• Integral term eliminates
accumulated error
• Increases overshoot
Time (sec)
Step response
with PID controller
Desired
Actual
Velocity
Controller Motor Velocity
(Vdes) err Adjusted (Vact)
Volts (X)
X Vdes K P e(t )
Velocity
K I e(t ) dt
de(t )
KD
dt
Time (sec)
Choosing and tuning
a controller
Desired
Actual
Velocity
Controller Motor Velocity
(Vdes) err Adjusted (Vact)
Volts (X)
Derivative ~ Decrease ~
Desired Actual
Adjusted
Servo
Shaft Controller Shaft
Position err Volts Motor Position
Camera
Camera
Desired Actual
Angle to Differential
Controller Adjusted Angle to
Red Ball err Differential Drive Red Ball
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
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
Actual
Left Left
Left
err Controller Motor Velocity
Actual
err Right Right Right
Controller Motor Velocity