Advanced Floor Robots
This chapter covers advanced floor robots that are tightly coupled to a screen turtle. Such a floor robot repeats every movement that the screen turtle does. There are a few extra commands that each floor robot interprets differently.
The InO-Bot is the latest addition to our expanding family of floor robots. This robot does not have any buttons like Bee-Bot or Blue-Bot. Instead, Logo controls the robot directly. This is our first true Logo floor turtle!
The InO-Bot comes with a pen holder and a large collection of built-in sensors. Like a bat, it has an ultrasound emitter and receiver that makes it able to measure the distance to an obstacle. It also has an infrared emitter and a corresponding sensor. Whenever an InO-Bot switches on its infrared beam, other InO-Bots can sense that beam.
Furthermore, it has two headlights, and set of 8 full-color LEDs. Finally, it has an extra jack where you could connect a small motor, a fan, a light, or the like.
Did we mention that it can play sounds and even play music?
Connecting via Bluetooth
All of these floor robots have a Bluetooth radio built in so your computer or tablet can connect. Logo can only communicate with floor robots when connected. Therefore, you need to connect your robot first.
Click the Bluetooth button in the icon bar to select the robot device to connect to. Please keep in mind that your browser needs to understand Web Bluetooth to connect. The desktop version connects to Bluetooth just fine. The dialog lists all devices known to Logo.
Once Logo has connected to a robot, it flashes and beeps, and Logo creates a special turtle for you and sets the TELL list to the name of that turtle so commands like FORWARD or RIGHT work with that turtle. The special turtle forwards all commands it knows to the floor robot.
The name of the turtle corresponds to the Bluetooth name of the device.
You should not create more than one special screen turtle. If you need to re-create the turtle, erase it first with the ERASE command.
The Special Turtle
At first sight, the special turtle is just another turtle with the shape of the floor robot, but there are quite a few subtle differences.
- When you move or turn the turtle, the robot moves and turns in exactly the same way. Also, the PENUP and PENDOWN commands makes the robot raise and lower its pen.
- The SETSPEED command affects the robot’s speed.
- Several additional properties have been added to the turtle’s proeprty list.
- Some commands like SETWIDTH to set the pen’s width affect the screen turtle, but not the robot.
- The screen turtle silently ignores all commands that the robot cannot execute. It cannot, for example, fill an area, or draw an ellipsis with STAMPOVAL.
If you want to process sensor input, it is a great idea to issue a WHEN command to handle ths input.
Robots usually begin to send input to Logo as soon as the robot has been connected, so your program should be prepared to process the data if required. This example checks the status of InO-Bot’s left front obstacle sensor. When triggered, Logo prints “OUCH”, backs up and turns right.
WHEN [INOBOT FRONTLEFT = TRUE] [ PRINT "OUCH BK 10 RT 45 ]
See the page WHEN Something Changes page for more details.
The InO-Bot in Depth
This section explains all special commands and properties available for InO-Bot.
InO-Bot moves in units of centimeters (cm). the command
would cause InO-Bot to move forward 10 cm. The maximum distance that
InO-Bot can move is 127 cm. If you need InO-Bot to move farther, you
need to issue multiple movement commands.
InO-Bot can turn in degrees. Each unit is a single degree, so the
RIGHT 20 turns InO-Bot right by 20 degrees. The maximum
turn is 180 degrees in either direction.
InO-Bot has 8 full-color LEDs that you can program either individually or together.
Please refer to the LED command for details.
Sounds and Music
You can make InO-Bot play simple melodies. Its note range is limited, and the accuracy of the notes is not very good, but sufficient. It can also play a number of predefined sounds.
If you want to process sensor input, it is a great idea to use the WHEN command to monitor these properties - see below.
|BATTERY||Reports the battery level in Volts.||0-9|
|CALIBRATION||Movement calibration, see below.|
|CONNECTOR||Controls the external connector.||FORWARD, BACK, STOP|
|DISTANCE||Reports the distance to an obstacle.||0-255 cm|
|INFRARED||Controls the infrared emitter and receiver.||0-1|
|LIGHT||Reports the value of the ambient light sensor.||0-1|
|LIGHTS||Controls the brightness of the headlights.||0-1|
|LINELEFT||Reports the status of the left line sensor.||TRUE/FALSE|
|LINERIGHT||Reports the status of the right line sensor.||TRUE/FALSE|
|NOISELEVEL||Reports the noise level that InO-Bot’s microphone records.||0-255|
|FRONTLEFT||Reports the status of the front left obstacle sensor.||TRUE/FALSE|
|FRONTRIGHT||Reports the status of the front right obstacle sensor.||TRUE/FALSE|
|REARRIGHT||Reports the status of the rear left obstacle sensor.||TRUE/FALSE|
|FRONTLEFT||Reports the status of the rear right obstacle sensor.||TRUE/FALSE|
For a detailed description, please see the InO-Bot properties page.
Do not expect InO-Bot to do exact movements, though! Most often, Ino-Bot needs to be calibrated somewhat. You can use InO-Bot’s CALIBRATION property to make the bot’s movements and turns more accurate. This property is a two-element list. The first element is a turn adjustment factor, and the second element is a movement adjustment factor. Initially, both values are set to 1.
Now, tell InO-Bot to turn right 90 degrees, and measure the number of degrees that InO-Bot actually turned. Let us say that InO-Bot actually turned 95 degrees. In that case, you would issue the following command:
PPROP “INOBOT “CALIBRATION [90/95 1] Error: 90 is not between -5 and 5
Oops! What happened? Well, Logo treats everything inside square
brackets literally; it does not calculate the expression “90/95”.
Instead, Logo created a list with 4 elements:
[90 / 95 1]. If you want
Logo to calculate the expression, use the
LIST command to have Logo construct the
PPROP "INOBOT "CALIBRATION LIST 90/95 1
Now, try again, and see if InO-Bot turns 90 degrees. You may need to repeat the procedure a few times.
Try to send InO-Bot forward 10 cm, and measure the actual distance. If InO-Bot actually moved 9.5 cm, for example, you enter this command:
PPROP "INOBOT "CALIBRATION LIST 90/95 10/9.5
Does InO-Bot advance 10 cm now?
If you measure in inches instead of cm, you can use the same method. 10 cm are 3.937 inches; now, measure the actual distance (9.5 cm would in this example be 3.74 inches), and enter this command:
PPROP "INOBOT "CALIBRATION LIST 90/95 3.937/3.74