Acceptance Test Subsets
iRobot High-Level Instruction Definition
Navigation
FORWARD, BACKWARD
Function Description:
Move forward or backward according to the given moving distance and time duration.
Corresponding Win Condition:
WC_3283: As an ESS, I can use navigation D&D modules to make the iRobot go forward, backward, turn left and right.
High Level Instruction:
MOVE [distance(mm)], [duration(s)]
Example
// FORWARD 300mm in 2s
MOVE 300, 2
// BACKWARD 300mm in 2s
MOVE -300, 2
LEFT, RIGHT
Function Description:
Rotate left or right according to the given angle.
Corresponding Win Condition:
WC_3283: As an ESS, I can use navigation D&D modules to make the iRobot go forward, backward, turn left and right.
High Level Instruction:
ROTATE [angle(degree)]
Example
// Left rotate 90 degree
ROTATE 90
// Right rotate 90 degree
ROTATE -90
DRIVE
Function Description:
Drive iRobot's wheels.
Corresponding Win Condition:
WC_3283: As an ESS, I can use navigation D&D modules to make the iRobot go forward, backward, turn left and right.
High Level Instruction:
DRIVE [velocity(mm/s)], [turn_radius(mm)]
Example
// Drive towards left on a curve with 9000mm radius and speed of 100mm/s
DRIVE 100,9000
DEMO
Function Description:
Play the built-in demo.
Corresponding Win Condition:
Test purpose instruction
Example
//Play demo 0 to cover the floor:
DEMO 0
DELAY
Function Description:
Drive iRobot's wheels.
Corresponding Win Condition:
WC_3296: As an ESS, I can drag and drop a wait condition in which I can further drag and drop the instructions/loop constructs.
High Level Instruction:
DELAY [duration(ms)]
Example
// Drive towards left on a curve with 9000mm radius and speed of 100mm/s
DRIVE 100,9000
LED
Function Description:
Control LEDs on iRobot.
Corresponding Win Condition:
WC_3291: As an ESS, I can use the sounds & light module so that I can turn the LEDs on and off.
High Level Instruction:
LED [LED_bits], [power_color], [power_intensity]
Example
// Turn off "Advance" and "Play" LEDs, and turn on "Power" LED in RED and
// highest intensity
LED 0,255,255
SONG
Function Description:
Use SONG_DEF to define a song and use SONG_PLAY to play the song you defined before.
Corresponding Win Condition:
WC_3290: As an ESS, I can drag & drop the musical notes from the sounds & light module so that I can create a song.
High Level Instruction:
SONG_DEF [No],[note1],[length1],[note2],[length2]...
SONG_PLAY [No]
Example
// Define song No.2 with three music notes and one second duration for each note.
SONG_DEF 2,72,64,74,64,76,64
// PLAY it.
SONG_PLAY 2
READ_SENSOR
Function Description:
Read all sensors' data
Corresponding Win Condition:
WC_3285: As an ESS, I can use sensing D&D module to detect cliffs/edges, speed, direction and elapsed time.
High Level Instruction:
READ_SENSOR
IF
Function Description:
IF contains IF, ELSE and END_IF. ELSE part cannot be ommited, even no sub-program is inside it. Execute [subprogram1] if [condition] is true, else execute [subprogram2].
Corresponding Win Condition:
WC_3295: As an ESS, I can drag and drop if-then-else and for/while construct in which I can further drag and drop the instructions/loop constructs.
High Level Instruction:
IF [condition]
[subprogram1]
ELSE
[subprogram1]
END_IF
subprogram: A HLProgram
condition: [sensor], [operator], [value]
operator: They are defined in HLProgram as follows
EQUAL 0
NOT_EQUAL 1
GREATER_THAN 2
GREATER_THAN_OR_EQUAL 3
LESS_THAN 4
LESS_THAN_OR_EQUAL 5
Example
// Cliff = 2, EQUAL = 0
IF 2,0,1
DELAY 200
ELSE
FORWARD 300, 2
END_IF
LOOP
Function Description:
Execute [subprogram] when [condition] is true or execute [subprogram] with assigned time.
Corresponding Win Condition:
WC_3295: As an ESS, I can drag and drop if-then-else and for/while construct in which I can further drag and drop the instructions/loop constructs.
High Level Instruction:
LOOP [condition]
[subprogram]
END_LOOP
Loop [time]
[subprogram]
END_LOOP
Example
// Bump = 0, NPT_EQUAL = 1
LOOP 0, 1, 1
LED 10, 255, 255
DELAY 1000
END_LOOP
// Execute MOVE and DELAY five times
LOOP5
MOVE 300,3
DELAY 1000
END_LOOP
Examples
Function Instruction:
Keep driving forward until a wall is met
Corresponding Win Condition:
Test purpose only.
High Level Instruction:
// Bump = 0, NOT_EQUAL = 1
LOOP 0, 1, 1
// SRAIGHT = 32768
DRIVE 300, 32768
DELAY 300
END_LOOP
DRIVE 0, 32768