MR-9132E USER’S MANUAL II =SAMPLE PROGRAMS=

IconWorks-web-_01E
20060803
Exclusive software for autonomous robot KIROBO
MR-9132E
USER’S MANUAL II
=SAMPLE PROGRAMS=
Copyright© 2006 EK JAPAN CO.,LTD.
-1(C)EK JAPAN 2006
IconWorks-web-_01E
TABLE OF CONTENTS
[1] STARTING FROM SAMPLE PROGRAMS
[2] START UP A SAMPLE PROGRAM
[3] STEP-1 MOVE
GO FORWARD FOR 5 SECONDS
GO FORWARD FOR 20 SECONDS
CHANGE DIRECTION AND COME BACK
[4] STEP-2 USING TOUCH SENSORS
GO BACKWARD USING A TOUCH SENSOR
USE 2 TOUCH SENSORS (1)
USE 2 TOUCH SENSORS (2)
[5] STEP-3 USING LIGHT SENSORS
BUZZER SOUNDS WHEN DARK
MOVE WHEN SENSING LIGHT
[6] STEP-4 USING VARIABLES
COUTDOWN BUZZER (1)
COUNTDOWN BUZZER (2)
[7] STEP-5 COMPETITION
LINE TRACING
FIND A WAY OUT OF A MAZE
CHASE A LED BALL
[8] SUPPORT INFORMATION
Line tracing
3
4
5
6
10
12
13
16
Chasing a LED ball
-2(C)EK JAPAN 2006
IconWorks-web-_01E
[1] STARTING FROM SAMPLE PROGRAMS
Various sample programs are included in IconWorks so that you can master
the concept of programming quickly. There are even programs with which
you can make the robot move without knowing any basic programming, so it
is possible for you to learn how to program by actually moving the robot.
For a detailed explanation for each icon and program transfer, please refer to
“USER’S MANUAL I, ALPHABET OF KIROBO”.
First of all, let’s open a sample program, transfer it, and move the robot!
* For detailed explanation for program transfer, please refer to Page 27 “Program Transfer” of “USER’S MANUAL I,
ALPHABET OF KIROBO”.
Some sample programs require modifications to be made to the robot assembly. Please read the manual carefully and
apply the modifications before sending or executing the program.
■ There are 5 topics covered by the sample programs.
Step #
Topic
Move
Step 1
Using touch sensors
Step 2
Step 3
Step 4
Using light sensors
Using variables
Competition
Step 5
Description
Robot Modification
Goes forward for 5 seconds
Not required
Goes forward for 20 seconds
Not required
Goes, turns around and comes back
Not required
Goes backward using a touch sensor
Not required
Uses 2 touch sensors (1)
Not required
Uses 2 touch sensors (2)
Not required
Buzzer sounds when dark
Not required
Moves when sensing light
Required
Countdown buzzer (1)
Not required
Countdown buzzer (2)
Not required
Line tracing
Not required
Finds a way out of a maze
Not required
Chases a LED ball
Required
Now, let’s get ready for the program transfer!
-3(C)EK JAPAN 2006
IconWorks-web-_01E
[2] START UP A SAMPLE PROGRAM
Start up [TRY] … A screen for selecting a sample program appears.
Left-click [TRY] icon.
The screen below appears.
Select a step from the screen, and click [OK]. The selected sample program appears.
Left-click [Any step] and then [OK].
The program screen with the selected sample
program appears.
z
[Program Editor Screen] Check the name in the editor screen and usage of the icons and buttons before starting.
Program Editor Screen
Ref. “ALPHABET OF KIROBO” Page 12
Names of the sample programs are
indicated in the program selection tab.
Click the tab to display the sample program
you want to use.
Editorial buttons
Ref. “ALPHABET OF KIROBO” Page 22
MOVE
COPY
ERASE
CLEAR
UNDO
SYNTAX
-CHECK
NEXT
SEND
-4(C)EK JAPAN 2006
IconWorks-web-_01E
(Notice) The page numbers indicated in the below table are all referenced from “USER’S MANUAL I, ALPHABET OF KIROBO”.
[3] STEP-1 MOVE
Step 1-1
Move
KIROBO goes forward for 5 seconds, and stops using “Brake”.
Robot modification:
Not required
Let’s practice the basic operation of IconWorks. Try various movements with the robot!
Icon for use
Page
BEGIN
19
FORWARD
Programs always start with “BEGIN” and finish with “END”.
For details about each icon function, refer to “USER’S MANUAL I, ALPHABET OF KIROBO”
at the pages indicated on the right columns.
19
WAIT
20
BRAKE
20
<Practice>
MOTOR
(1) Change the speed of going forward.
(2) Replace the movement icon with a different movement icon.
20
OFF
END
(3) Change the duration property of “WAIT”.
19
(4) Try removing and replacing “BRAKE” to see how the robot movement changes.
(5) Now, try removing and replacing “MOTOR OFF” to see how the robot movement changes.
Step 1-2
Move
KIROBO goes forward for 20 seconds, and stop by brake.
Robot modification:
Not required
New Icon
REPEAT
“REPEAT” and “REPEAT END” icons are added to the Step 1-1 program. Insert the program you
want to repeat in between “REPEAT” and “REPEAT END”.
REPEAT
END
Page
20
20
In the Step 1-1 program, the command ‘KIROBO goes forward at low speed for 5 seconds’, is
repeated 4 times, therefore, the movement continues for 20 seconds.
<Practice>
Change the number repetitions and see how the movement changes.
-5(C)EK JAPAN 2006
IconWorks-web-_01E
Step 1-3
Move
KIROBO goes forward, makes a turn (changes direction), and
Robot modification:
comes back.
Not required
You can verify the basic movements with this program. Adjust the speed and time settings of “RIGHT TURN” and “WAIT” so that
KIROBO makes a smooth turn.
Adjust this time setting
Does your KIROBO come back
to the original position? If not,
START
■Change the icons and try various
movements!
adjust the “WAIT” period for
the “RIGHT TURN” action.
GOAL!
[4] STEP-2 USING TOUCH SENSORS
By using the touch sensors we can learn about making conditional judgment programs. First, let’s practice the use of touch
sensors with a simple program which alters how the robot should move when Touch sensor1 is activated.
Step 2-1
Using touch sensors
KIROBO goes backward for 1 second when Touch sensor1
Robot modification:
is pressed, and goes forward when not pressed.
Let’s try a program with “BRANCH” and “MERGE”.
Not required
New Icon
For a detailed explanation of the touch sensors, please refer to the “USER’S MANUAL I,
LOOP
ALPHABET OF KIROBO” on the pages indicated in the right-hand column.
LOOP END
The program branches here.
TOUCH
Is the touch sensor sensing something?
BRANCH
Page
20
20
21
YES
21
NO
21
MERGE
21
NOP
A branched program must merge!
21
-6(C)EK JAPAN 2006
IconWorks-web-_01E
Change the locations of Touch sensor1 and 2 or “FORWARD” and “BACKWARD”, and see how the
robot movement changes.
Touch
In addition, remove "LOOP"
and "LOOP END"
, then send and execute the program.
How did the robot move?
The program is executed and ends very quickly. The forward movement remains ON because
there is no instruction to BRAKE or MOTOR OFF. Also because the program has ended (even
though the robot is still moving) pressing the touch sensor has no effect.
Turn the robot on and off and then run the program again but keep the touch sensor pressed as
you start the execution. What happens now?
To have the robot keep checking the status of the touch sensor and making a decision, the
program needs to be inserted in between "LOOP"
between "LOOP"
and "LOOP END"
and "LOOP END"
. The program
will be repeated over and over once the START button
is pressed.
Remove icons and put them back, and see how the movement
changes.
[LOOP]
Repeat endlessly
-7(C)EK JAPAN 2006
IconWorks-web-_01E
Using touch sensors
Step 2-2
Makes a right turn when Touch sensor1 is pressed, and
makes a sound when Touch sensor2 is pressed. No action
Robot modification:
Not required
when neither Touch sensor is pressed.
Let’s try a program using 2 touch sensors.
New Icon
BEEP
The program branches here.
(BUZZER)
Page
22
The program branches again after
the first branch.
Now, let’s try making a program with more than 2 “BRANCH” icons.
Consider how the condition changes. The basic idea is the same as that shown by the previous
branching program.
Touch
Touch
-8(C)EK JAPAN 2006
IconWorks-web-_01E
Using touch sensors
Step 2-3
KIROBO goes backward when Touch sensor1 turns ON,
forward when Touch sensor2 turns ON, and makes a sound
Robot modification:
Not required
and stops the motor when both Touch sensors turn ON.
Let’s try a program which uses 2 Touch sensors.
4 conditions can occur.
Consider how you should build your program and which icon should come after the “BRANCH” icon.
Case
Touch sensor1
Touch sensor2
(1)
ON
ON
(2)
ON
OFF
(3)
OFF
ON
(4)
OFF
OFF
Action program
Stop the motor and make Buzzer sound 4
Go backward
Go forward
No movement
Touch
Touch
Now it’s your turn! Create a program to avoid obstacles using the above sample program as a guide. Tip: The 2 Touch sensors
that are now installed to the front and back should both be mounted to the front as shown below.
Mount them at the front.
-9(C)EK JAPAN 2006
IconWorks-web-_01E
[5] STEP-3 USING LIGHT SENSORS
Step 3-1
Using light sensors
KIROBO has Light sensors installed and will make a sound
when it gets dark.
Robot modification:
Not required
Let’s try a program using Light sensors and the “BRANCH” icon.
New Icon
You should also practice adjusting the sensitivity of the sensor.
LIGHT
BRANCH
Page
20
<How to adjust the Light sensor>
The sensor sensitivity needs to be adjusted according to the light in the current surroundings.
Turn VR1 or VR2 on the motherboard carefully with a +screwdriver to adjust the
sensitivity.
The LED below turns ON when the sensor detects the light.
[Not sensing]
[Sensing]
[Adjust sensitivity]
Send this sample program to the robot, and execute the program.
Cover the Light sensor with a finger as shown below and check if the Light sensor reacts or not.
If no sound is emitted, adjust the sensitivity again and re-check whether the sensor is detecting the light or not.
No reaction when Light sensor1 detects light.
A sound is made when Light sensor1 is covered with a finger.
- 10 (C)EK JAPAN 2006
IconWorks-web-_01E
Step 3-2
Using light sensors
KIROBO goes forward when Light sensor senses the light.
Robot modification:
Required
Preparation: Modify the robot as shown below.
Use C set [6], screw x 2pcs, and nut x 2pcs, and mount 2 Light
sensors at the front of the robot. Make sure not to switch the
positions of the 2 sensors when setting them at the front.
C set [6]
Set them as shown above.
Preparation2: Prepare something that emits light.
Ex) Flashlight, Infrared ball (RCJ-04), etc
A program using Light sensors and “BRANCH” icons.
The basic idea for the program is the same as in Step 3-1.
Learn how to adjust the Light sensors when the sensors are
mounted to the front of the robot.
When you finish the robot modification, open the sample
program and send it to the robot.
Prepare a light source, such as a flashlight, and execute the
program. (Refer to the photos below.)
Put the light in front of the
Flashlight
Hey, wait!
robot.
The robot will come
toward the light.
Infrared ball
The robot can follow the
light of an infrared ball.
Although invisible to
human eyes, the robot
can see the infrared light.
- 11 (C)EK JAPAN 2006
IconWorks-web-_01E
[6] STEP-4 USING VARIABLES
For a detailed explanation of variables, refer to Page 46 of the “USER’S MANUAL I, ALPHABET OF KIROBO”.
Using variables
KIROBO makes a buzzer sound 4 when Touch sensor1 is
pressed and makes a buzzer sound 1 when pressed more
Step 4-1
Robot modification:
Not required
than 10 times. The buzzer sound 1 is emitted also if
Touch sensor1 is pressed for more than 2 seconds.
Variable property
New Icon
“VARIABLE
Page
21
BRANCH”
“VARIABLE
21
CALCULATION”
<Practice>
(1) Change the condition for branching by variables.
(2) Change the variable calculation value and see how the behaviour changes.
Using variables
Step 4-2
This sample program is the modified version of the program in Step 4-1. KIROBO waits
until Touch sensor1 turns OFF. The count does not go on even when Touch sensor1 is
kept pressed.
One more condition is added to Step 4-1.
See how the behaviour changes.
At this point, the program does not proceed until Touch sensor1
is released. When released (Touch (1) changes to “NO”), it then
proceeds to the next step.
- 12 (C)EK JAPAN 2006
IconWorks-web-_01E
[7] STEP-5 COMPETITION
An advanced program using sensors is introduced in this section. Utilize a sample program and make fine adjustment moving the
robot.
Competition
Step 5-1
A program which can make KIROBO move along a line.
* The light sensor sensitivity needs to be adjusted to detect the
Robot modification:
Not required
black line.
Preparation for the competition
Prepare a white paper or board, and draw or
paint a black line of 2-3cm in width as shown.
- 13 (C)EK JAPAN 2006
IconWorks-web-_01E
Light sensor
of KIROBO
Red LED
Phototransistor
The principal of the program in Step2-3 is applied to the below program. Consider how both light sensors sense the black line.
The existence of a black line is recognized when the
phototransistor (PT) does not detect the light emitted from
the red LED of the light sensor.
PT detects light -> Light reflects -> White
Absorb light -> Black
(1)
PT detects no light -> Light does not reflect -> Black
Reflect light ->White
Right, sensor1
Left, sensor2
ON
ON
Condition
Out of the line
Action program
Right-turn and look for
the line.
(2)
(3)
(4)
(1)
ON
OFF
OFF
ON
OFF
OFF
Left sensor detects the line
Left-turn and look for
and the right detects white.
the line.
Right sensor detects the line
Right-turn and look for
and the left detects white.
the line.
Both sense the black line.
Go forward.
(2)
(3)
(4)
- 14 (C)EK JAPAN 2006
IconWorks-web-_01E
Competition
Step 5-2
KIROBO goes backward a little and changes direction 90 degrees
when Touch sensor1 turns ON. It goes forward when Touch
Robot modification:
Not required
sensor1 does not turn ON.
Preparation for the competition.
Prepare a wall-like object, or place the robot near to a wall.
Wall
<Practice>
Adjust here.
Adjust the time setting so that the robot can turn 90 degrees.
Turn 90 degrees.
Competition
Step 5-3
KIROBO goes forward when Light sensor detects the light from the
Robot modification:
ball. KIROBO makes a right-turn and searches for the ball when it does
Required
not detect the light coming from it.
Preparation1: Modify the robot as shown.
Preparation2: Prepare for the competition.
Modify the robot as
Prepare an infrared ball (RCJ-04).
Step 3-2.
<Practice>
Let’s practice the adjustment of the light sensors.
- 15 (C)EK JAPAN 2006
IconWorks-web-_01E
We hope the sample programs helped you learn how to program various movements in a small amount of time.
Now you are ready to modify the robot using the remaining parts to make your own KIROBO!
Plan a robot competition using KIROBO with your friends!
[8] SUPPORT INFORMATION
For any questions about the software, its updates, suggestions or requests for updated
information, please send an inquiry to:
<Company Name> EK JAPAN Co., Ltd.
<Address> 2-19-30 Tofuro-Minami, Dazaifu-shi, Fukuoka 818-0105 Japan
<Phone> +81-92-923-8235
<FAX> +81-92-923-8237
<E-mail> [email protected]
<Homepage> http://www.elekit.co.jp
or your local distributor (please ask for contact information).
- 16 (C)EK JAPAN 2006