|
[DPRG] Robot Code: subsumption
Subject: [DPRG] Robot Code: subsumption
From: David P. Anderson
dpa at io.isem.smu.edu
Date: Thu Mar 15 14:58:48 CDT 2007
Howdy,
I ran across an older posting that gives a sort of blow-by-blow
account of two different subsumption behaviors, an IR obstacle
avoidance behavior and a Bumper ballastic behavior, which I thought
might shed some more light on how the arbitration works.
Here it is edited a bit for this discussion:
----------------
Let me try two simple examples, an IR avoidance behavior and a
bumper behavior, one "servo" and one "ballastic" behavior. Assume
a subsumption looping running at 20hz for this example.
An IR avoidance detector "sees" a detection on the right, so it
outputs a command to turn left and sets its subsumption flag
to active, to signal the arbitrater. Because it is the highest
priority flag for that 1/20th of a second, the arbitrater sends its
command to the motors, and that is what the motors do
(ignoring any PID slewing,etc) for the next 50 millisecs, until
the next time through the subsumption loop. But that's
all, just for the next 50 millieconds.
Now, 1/20 second later as the loop executes again, the robot has
hardly moved at all, and the IR avoidance detector still "sees" the
detection on the right, and again outputs a command to turn left,
and again sets its subsumption flag to active to signal the
arbitrater. Again it is the highest priority layer signalling and
the arbitrater again passes its command to the motors to turn
left, and that's what they do for the next 50 milliseconds. But
only for the next 50 milliseconds.
This processes contiinues each time through the subsumption
loop, with the IR avoidance winning the priority contest in little,
50 millisecond chunks, and passing its command to turn left
to the motors each time 20 times a second. After, lets say,
2 seconds (40 times through the loop, 40 turn left commands
to the motors) the robot has finally turned left far enough that
the next time through loop, the IR avoidance detector no longer
"sees" a detection on the right. So on that pass through the
loop, the IR avoidance behavior's flag becones FALSE (no
detection) and some other lower priority behavior gets to pass
its commands to the motors.
The output from the IR avoidance behavior goes away as soon
as the trigger goes away.
Now the second example, a ballastic bumper behavior. The
bumper gets a press on the right, and triggers the start of
a ballastic behavior. The first segment outputs a command to
backup and sets its subsumption flag to active, to signal the
arbitrater, and also sets an internal TIMER to, lets say one
second. Because it is the highest priority layer asserting
its flag, the backup command is passed by the arbitrater to
the motors. So for the next 50 milliseconds, that's what the
motors do.
Now, 1/20 second later as the loop executes again, but the
layer does _not_ test the trigger condition again, as in the
case of the IR avoidance behavior, but rather tests the
TIMER to see if it has timed out. That is why it is a
ballastic behavior. Its termination depends on an internal
timer, rather than the absence of an external trigger. When
it tests the timer it sees that it has not timed out, so the layer
leaves the output command = backup, and leaves the
subsumption flag = active. And for the next 50
milliseconds, the robot continues to backup.
This continues for another 18 times though the subsumption
loop. On the 21st time through the loop, the timer has
expired, and the layer sequences to the next state, which
is a turn left command. It leaves the subsumption flag
as active, and resets the internal TIMER to, say, half a
second, and sets its output command = turn left.
And it does that for the next 10 times through the loop,
each time testing the TIMER, not the trigger condition.
Finally, the TIMER times out, the ballastic behavior is
finished, and its subsumption flag is set to FALSE.
At that time, any lower priority tasks that have flags = true
will regain control of the robot.
----------------
regards,
dpa
More information about the DPRG mailing list
|