Programming the Pro-Bot

Pro-Bot is the latest in Logo technology. A turtle robot, cleverly disguised as a race car, Pro-Bot offers students an enticing, engaging, and hands-on experience with Logo programming as well as robotic controls. Pro-Bot commands are entered via a set of arrow and number keys mounted on the back. Plan a route for Pro-Bot and press the corresponding keypad controls. Press the GO button and send Pro-Bot on its way. Pro-Bot will follow the sequence of commands that were entered step by step.

The Pro-Bot connects to your PC with a special USB cable. Terrapin Logo contains commands to upload all procedures stored on the Pro-Bot to the Logo workspace, where you can edit these procedures, run them, and download them to the Pro-Bot again.

For the remaining text on this page, we assume you are familiar with Logo programming.

The product number should read "EL00449"

Please note that you need Pro-Bot revision 2 and the desktop version of Terrapin Logo. The Web version of Terrapin Logo cannot connect to Pro-Bots.

If you turn your Pro-Bot upside down, look for the product number right underneath the “TTS” logo. It should read “EL00449”. If you read “IBOT2”, you have an old version of Pro-Bot, and Terrapin Logo cannot talk to this version.

Connecting the Pro-Bot

A USB cable with two male type A connectors You need a few things before you can connect Pro-Bot to Terrapin Logo on your PC or Mac. Download and install a driver for the CP210x chip that is inside Pro-Bot from the Silicon Labs download page. You will need a USB cable with two male A-type connectors to connect Pro-Bot to your computer. These cables are available at many locations. Once you have installed the driver, use the USB cable to hook up the Pro-Bot to your PC or your Mac, launch Logo, turn on your Pro-Bot, and enter the command

PROBOT?

If Logo recognizes the Pro-Bot, the command reports TRUE; otherwise, Pro-Bot is not connected correctly, and the command reports FALSE.

Windows Troubleshooting

If the PC cannot see a Pro-Bot, make sure that the correct driver is installed. You need to connect Pro-Bot to the PC, because the driver is invisible if Pro-Bot is disconnected. On Windows, please open a DOS prompt, and enter the following command:

The Pro-Bot COM port

wmic path Win32_SerialPort Get Description

You should get an output like

Description
Silicon Labs CP210x USB to UART Bridge

If you do not get any output, or the output lists the wrong driver, you probably have an older version of Pro-Bot.

Alternatively, open the Device Manager, and check if there is a tab “Port (COM & LPT), and that one entry under the tab lists the driver “Silicon Labs CP210x USB to UART Bridge (COMx)”.

Talking to Pro-Bot

Pro-Bot is an autonomous robot that contains a number of Logo procedures along with a main Logo program. Terrapin Logo can load all Pro-Bot data into its workspace. The command PROBOT.READ does this for you; it loads all Pro-Bot procedures it can find into the Logo workspace:

PROBOT.READ
PROBOT.MAIN defined
PROC1 defined
PROC2 defined
ON.FRONT defined
HEXGN defined
DIAMND defined
FLOWER defined
Result: CM

The PROBOT.READ command reports the movement units with which Pro-Bot is configured; this is either CM for centimeters or PROBOT for its body length, which is approximately 30 centimeters.

Let us say that you have programmed the 5-Pointed Star example in the Pro-Bot manual. Pro-Bot displays the following code:

Main
Rpt 5 [
Fd 10
Rt 132
Fd 10
Lt 60
]

After entering the PROBOT.READ command, your workspace would contain the following procedure:

Run this procedure, and the Logo turtle draws a 5-pointed star just as the Pro-Bot would.

The command PROBOT.WRITE does the opposite: It collects all Pro-Bot procedures in Logo workspace and downloads them to the Pro-Bot. Procedure names must be exactly the names that Pro-Bot expects to find:

PROBOT.MAIN This is the main program.
PROC1 to PROC32 Pro-Bot can store up to 32 different procedures; these procedures must be named exactly this way.
ON.FRONT The name of the procedure that Pro-Bot runs if the front sensor is triggered.
ON.REAR The name of the procedure that Pro-Bot runs if the rear sensor is triggered.
ON.LIGHT The name of the procedure that Pro-Bot runs if the light sensor reports a brightness level of more than about 50 Lux.
ON.DARK The name of the procedure that Pro-Bot runs if the light sensor reports a brightness level dropping below 50 Lux.
ON.SOUND The name of the procedure that Pro-Bot runs if the sound sensor registers a sharp sound like the clapping of hands. Note that the sound sensor is only enabled if the motors do not run; you should use Pro-Bot's Pause command to make it wait for a sound.
HEXGN This is a predefined built-in procedure that draws a hexagon. It cannot be changed.
DIAMND This is a predefined built-in procedure that draws a diamond-like shape. It cannot be changed.
FLOWER This is a predefined built-in procedure that draws a flower. It cannot be changed.

Note that Pro-Bot does not check its sensors if a main program is not running. To make Pro-Bot check its sensors and nothing else, enter a single Pause command as the main program. You can let Pro-Bot wait almost forever, only listening to its sensors by entering the command Ps 499, which is 499 seconds or over 6 minutes.

The PROBOT.WRITE command has an optional input; if you supply either “CM or “PROBOT, it sets the movement units of Pro-Bot to the given value.

Pro-Bot Command Summary

PROBOT?, PROBOTP Checks if a Pro-Bot is connected, and reports either TRUE or FALSE.
PROBOT.READ Reads all procedures stored in the Pro-Bot and creates these procedures in your workspace. Reports Pro-Bot's movement units either as “CM or as “PROBOT.
PROBOT.WRITE Downloads all Pro-Bot procedures to the Pro-Bot. If either “CM or “PROBOT is supplied as an optional input, sets Pro-Bots movement units accordingly. Please note that this command is not available in the free-to-try version of Logo.
PROBOT.LIGHTS A placeholder procedure to turn Pro-Bot's headlights on or off. The command sets the shape of all active turtles to either the toolbox image PROBOTLIGHTS.PNG or PROBOT.PNG depending on the value of its inputs.
PROBOT.SOUND A placeholder procedure that plays one of Pro-Bot's built-in sounds. See below for further explanation.

Programming Pro-Bot

Programming Pro-Bot is easy. Check the manual that comes with Pro-Bot for a detailed programming guide. download Pro-Bot Robotics from the Downloads section for additional information.

Most of Pro-Bot's commands have a 1:1 relationship with Terrapin Logo commands. There are a few limitations that you need to keep in mind.

Pro-Bot memory is limited. The main program's capacity is 128 instructions while a sub-procedure can contain only 32 instructions. If procedures are too long to fit into Pro-Bot memory, PROBOT.WRITE fails to download your procedures. In that case, you should split up your procedure into smaller procedures.

The following table lists Pro-Bot's commands and the corresponding Terrapin Logo commands. You can use all of the Logo commands listed below inside Pro-Bot procedures. If you use any other Logo command, Logo cannot download the procedure to the Pro-Bot, and PROBOT.WRITE exits with an error message.

Please note that all procedures that Pro-Bot invokes when a sensor is triggered start with ON.. Pro-Bot calls these procedures only if a main program is executing. If Pro-Bot does not execute any program, it does not check its sensors, and does not invoke any procedure connected to a sensor.

Pro-Bot Logo Comments
Fd FORWARD The Fd command expects an input value between 1 and 499 units to move. If no input value is given, Pro-Bot assumes 25 units, so Fd is the same as FORWARD 25 in Terrapin Logo.
Bk BACK The Bk command expects an input value between 1 and 499 units to move. If no input value is given, the Pro-Bot assumes 25 units, so Bk is the same as BACK 25 in Terrapin Logo.
Lt LEFT The Lt command expects an input value between 1 and 499 units as the number of degrees to rotate. If no input value is given, Pro-Bot assumes 90 degrees, so Lt is the same as LEFT 90 in Terrapin Logo.
Rt RIGHT The Rt command expects an input value between 1 and 499 units as the number of degrees to rotate. If no input value is given, Pro-Bot assumes 90 degrees, so Rt is the same as RIGHT 90 in Terrapin Logo.
Ps WAIT The Ps command expects an input value between 1 and 499 units as the number seconds to wait. If no input value is given, Pro-Bot assumes one second. Logo's WAIT command expects its input as milliseconds; therefore, Logo multiplies the number of seconds to wait by 1000 when reading from the Pro-Bot, and divides the input to WAIT by 1000 when writing to the Pro-Bot; Ps is the same as WAIT 1000 in Terrapin Logo.
Rpt[ and ] REPEAT The Rpt[ command expects an input value between 0 and 255 units as the number of times to repeat. Rpt [ becomes REPEAT 255 in Logo, and REPEAT 255 in Logo becomes Rpt [ for the Pro-Bot. Any instance of “Rpt nnn [” becomes REPEAT' nnn [ in Logo and REPEAT nnn [ in Logo becomes Rpt nnn [ for the Pro-Bot.
Light On PROBOT.LIGHTS TRUE Turn on Pro-Bot's headlights.
LightOff PROBOT.LIGHTS FALSE Turn off Pro-Bot's headlights.
Sound 1 to Sound 7 PROBOT.SOUND 1 to 7 Play a sound. The Logo command would attempt to play one of the sound files ~home/Sounds/Probot1.wav through Probot7.wav, which are samples of Pro-Bot's sounds:
PROBOT.SOUND 1 - Switch on
PROBOT.SOUND 2 - Button click
PROBOT.SOUND 3 - Car horn
PROBOT.SOUND 4 - Data transfer
PROBOT.SOUND 5 - Transfer complete
PROBOT.SOUND 6 - Error
PROBOT.SOUND 7 - Go to standby
Pen Up and Pen Down PENUP and PENDOWN These commands control the pen on the screen turtle but do nothing on Pro-Bot; its pen holder can only be moved manually.
SETPC Use this command to set the color of the line that Pro-Bot draws on Logo's screen; Pro-Bot cannot change pens, so the command is ignored and removed by Pro-Bot. SETPC is no longer present in procedures reloaded from Pro-Bot.
Proc 1 to Proc 32 PROC1 to PROC32 Pro-Bot uses commands Proc 1 through Proc 37 to call its procedures, where procedures 33 to 37 are the special procedures that it invokes when a sensor is triggered. THe command Proc without a number is meaningless, and Pro-Bot ignores such a command.
33 FRONT ON.FRONT This is the procedure that Pro-Bot triggers when its front sensor is activated.
34 REAR ON.REAR This is the procedure that Pro-Bot triggers when its rear sensor is activated.
35 DARK ON.DARK This is the procedure that Pro-Bot triggers when its light sensor drops below about 50 Lux.
36 LIGHT ON.LIGHT This is the procedure that Pro-Bot triggers when its light sensor rises above about 50 Lux.
37 SOUND ON.SOUND This is the procedure that Pro-Bot triggers when its sound sensor reports a sharp sound. Note that the sound sensor is only active when motors are stopped.
HEXGN HEXGN This is a predefined built-in procedure that draws a hexagon. It cannot be changed.
DIAMND DIAMND This is a predefined built-in procedure that draws a diamond-like shape. It cannot be changed.
FLOWER FLOWER This is a predefined built-in procedure that draws a flower. It cannot be changed.

How to Create a Pro-Bot Turtle

You would like to play with Pro-Bot on the screen, and perhaps run PROBOT.MAIN? Then you need a Pro-Bot on screen. Here's how:

  • Tell turtle #0 and make sure that it is visible: TELL 0 SHOWTURTLE.
  • Set its shape to the Pro-Bot image stored in the Toolbox: LOADSHAPE ”~HOME/TOOLBOX/ROBOTS/PROBOT.PNG.
  • You do not want the turtle to race, so slow it down with SETSPEED 0.5.
  • One Pro-Bot step is approximately one Pro-Bot length, so set the step size to the PROBOT turtle's image size: SETSTEPSIZE LAST GPROP “PROBOT “SIZE - the image height is 80 pxiels, so SETSTEPSIZE 80 will also do.
  • If you use CM as the Pro-Bot's step size, you should select a smaller step size; The actual size of a Pro-Bot is about 25 cm, so do a SETSTEPSIZE 80 / 25

Now, you have a slow turtle that steps about as far as Pro-Bot does!