THE COMMAND BLOCK FACTORY
PRIORITY ORDER AND INTERRUPTS
42
41
Often-Used Commands
Basic Movements
The basic movements are those from "Stop" to "Rotate from right to
left" on the command table. The extent of the movement is expressed
in numbers of steps, for example, "Go forward 3 steps" and "Rotate 6
steps to the right". In the case of the "Stop" command, the robot
does not move, but instead of the number of steps, the numerical
parameter for this command gives the number of seconds for which the
robot must stand still.
Switching panels
The purpose of switching panels is to switch to a program on another
panel. Commands such as "Switch to Panel 2" can be used. When the
sensor assigned to this command reacts, control switches to the
program on Panel 2.
Stop
Robot halts for period specified.
time(sec)
Name
Movement
time(sec)
Icon
Override
Speed
Go
forward
Robot advances specified number of steps.
Steps
Go
backward
Robot retreats specified number of steps.
Steps
Rotate to
the right
Robot moves left and right legs in opposite
directions, and rotates to the right, on
the spot.
Steps
Rotate to
the Left
Robot moves left and right legs in opposite
directions, and rotates to the left, on
the spot.
Steps
Turn right
Robot turns to the right like a car, by
moving its legs forward on one side only.
Steps
Turn left
Robot turns to the left like a car, by
moving its legs forward on one side only.
Steps
Back Up
right
Robot turns back to the right like a car,
by moving its legs backward on one
side only.
Steps
Back Up
left
Robot turns back to the left like a car,
by moving its legs backward on one
side only.
Steps
Rotate to
the right
or left
Robot turns randomly either to the right
or to the left.
Steps
Sound
Robot emits a call - one of the four calls
from 1 to 4 - for the number of times
specified.
Times
Call a
fellow
WonderBorg
While calling, the robot emits the infrared
signal used for calling to another WonderBorg.
Time(s)
Threaten
fellow
WonderBorg
While calling, the robot emits the infrared
signal used for threatening another
WonderBorg.
Time(s)
Dance
Robot rotates rhythmically to the left and
right.
Time(s)
Option ON
Motor or other device connected to Option
Connector is turned ON for specified period.
Period(sec)
Switch
panel
Control jumps to the panel number specified
after the icon (1 to 8).
Panel no
1 to 8
Tone
(1 to 8)
Robot emits specified tone, which is one
of the 8.
Tone no
1 to 8
Command Table
This table lists the basic commands, plus other commands, and describes
what they do.
3. Robot immediately executes "Go Forward 5
Steps" command. ("Go Forward Command"
overrides the other command.)
Priority Order
When two sensor blocks react at the same time, the sensor block on the higher line of
the program takes priority, and the WonderBorg executes the command linked to that
sensor. If the WonderBorg does not behave as you expect it to, check the priority order.
Interrupt
When you click the "Interrupt" button on the Command Block Factory screen, the selected
block will turn green and its corners will become rounded. When a block is red, other
sensors will be ignored until this block’s command has completed (e.g. until the robot
has advanced 5 steps). When the block is green, however, in the event of a reaction by
a sensor with a higher priority (i.e. a sensor higher up on the Panel screen than the
sensor linked to this command) while this command is being executed, control will switch
to the command assigned to the prioritized sensor. In other words, the green block is
"interruptable". This is explained in the diagram below.
When you use an interrupt, the WonderBorg will react more swiftly to the sensors, and
will break off smoothly in the middle of a series of actions when an interrupt is
triggered.
How an Interrupt Works
Interruptable block
If a sensor with a higher priority
reacts while action in progress,
control will switch to the command
linked to the prioritized sensor
If the WonderBorg is programmed to rotate (30 Steps Left), then change position
slightly (go 2 Steps forward).....
1. While the robot is rotating left (for instance,
when it has walked 3 steps).....
2. IF "Light" Sensor reacts, robot does not
have to rotate for remaining number of
steps (nor does it have to take 2 steps
forward in 2nd part of instruction).
The "Light" sensor is higher up in the
program than "Nothing Here". The first
takes priority.
Example: If you want to make the WonderBorg walk towards the brightest
direction....
"Light" Sensor react!!!