EasyManua.ls Logo

Evolution Robotics ER1 - Page 34

Default Icon
170 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 3 Behavior Programming Overview
3-6 ER1 User Guide
(sight, sound, time, or message receive conditions). In other words, a sequence has to
begin by some external trigger condition.
Consider the following example:
Behavior 1: If see teddy bear Then play a sound file:
teddy.wav.
Behavior 2: If hear the word email Then send an email to user@ISP.com
.
Behavior 3: If after Behavior 1 Then move forward 10 feet.
Behavior 4: If after Behavior 3 Then move backward 10 feet.
If the teddy bear is seen, the sequence of behaviors 1, 3, and 4 will commence. Even if the
word email is spoken and recognized when one of these behaviors is running, it will be
ignored and Behavior 2 will not run, because the sequence cannot be interrupted. The
sequence has to begin with Behavior 1, which has a non-sequence condition (sight).
If a behavior has both a sequence condition and a non-sequence condition, then it can be
triggered either way. For example, if Behavior 4, above, is rewritten as follows:
Behavior 4: If after behavior 3 or hear sound level 2, move backward 10 feet.
Then the robot may move backward 10 feet on a sound or move backward 10 feet as part
of the sequence starting with Behavior 1. However, it will only do one or the other, not
both, depending on which condition is satisfied first. If the robot sees the teddy bear
before hearing the sound, Behaviors 1, 3, and 4 will execute in order. Even if the sound
was heard during or after this execution, it will be ignored. If the sound was heard first,
Behavior 4 will execute. Then, if the teddy bear was seen, Behaviors 1 and 3 will execute
but not 4. (Assuming you’re using the default behavior settings. This is because behaviors
are set to run only once by default.)
All behaviors default to run once, meaning that once the behavior has executed, it will not
run again until you once again click on the Run it button.
A behavior can be set to run more than once, immediately or at specified intervals, in the
Run tab of the Behavior Settings menu. (Click on the Behavior Settings button at the
top right of the application.) When a behavior is set to run more than once, it will run
whenever its If condition is satisfied.
If Behaviors 1, 3, and 4, in the previous example above, are set to run more than once,
then the sequence will be run whenever the teddy bear is recognized. For example, in the
above example, the robot will end up roughly in the same position after each run of the
sequence, because it just moves forward and back 10 feet. If the teddy bear is stationary,
chances are it will be seen after each run, and the sequence will repeat indefinitely.
Sometimes this kind of repetition in undesirable, because some trigger conditions occur
more or less continually. Other times you may want this kind of a repetition.
Consider this example:
Behavior 1: If see teddy bear Then send email to user@ISP.com
.
If this behavior is allowed to run more than once, it will spam user@ISP.com
with several
emails per second, because it will see the teddy bear roughly at that rate and sending the
email takes even less time. Teddy’s mailbox will fill up with hundreds of emails after just
a few minutes. This is why in the Run tab of the behavior settings dialog, there is also a
Prevent starting for __ seconds setting. Once a behavior has executed, it will not run

Table of Contents