Step 3: Reacting to Sensor Input : Make Your Robot Say gOuch!h
This step shows you how you can react to sensor input. Letfs use a touch sensor here.
1. Open the file created in the previous step (Step1.dlgxml)
2. Add a new dialogue to the file and configure it for sensor input.
Click on the New button.
A new dialogue appears left to the Delete button as Dialog 2.
Click the Sensor radio button in the yellow dialog box to indicate that you want to react to
sensor input instead of speech input.
3. Choose the touch sensor
In the command window, select the touch sensor.
The icons are identical to those in Mindstorms software so you can recognize easily.
Configure the conditions under which the speech output should be triggered.
The configuration of the sensors is identical to the Lego Mindstorm software
and is not further explained here.
Please refer to the help text of the Lego Mindstorm software for sensor configuration.
The image below shows a configuration for the touch sensor on channel 1 that
will trigger the spoken output whenever the touch sensor is pressed.
Letfs add Robotfs speech output in the way described in Step 2.
Step 3: Exercise
Try making your robot says all of gouchh, ghey, itfs hurth and gstop it!h In this interaction,
you imagine your robot gets hurt by being touched the sensor.
If you donft want to hurt it, assume the touch to the sensor
is a gentle pat and make it say gwe shake hands!h or gitfs tickles!h or more.
Now you know how to program interactions with sensors.
Next is
Step4
for controlling motors and robot actions.
|