CS 1020 - Lab 1 - The Sciborg

Part 1: Build a Sciborg

Build a Sciborg with worm gear drive and a front bump sensor. Here are step-by-step instructions for a model. This is just an example, so feel free to build a more interesting (and nicer) Sciborg. Test your Sciborg with the program simple.txt, which we have already downloaded to your Handy Board. Make sure the Sciborg can correctly perform "fwd-until-bump", "left-until-bump", and "right-until-bump" as commanded.

Part 2: Connect your computer to your Handy Board

To get ready to download other programs to your Handy Board, download the file code_downloader.zip and save the folder code_downloader to your Desktop (either by draggin it there or by selecting "Extract all files". Once saved, open the code_downloader folder and double-click on the file "HandyLogo.jar". This will open the program "LogoChip Logo" which will let you interact with your Handy Board. If you see the message "can't open serial port", close all "LogoChip Logo" windows, check that your Handy Board is connected and turned on, and try again. If you still have trouble, get our help.

Next, download code_day1.zip. For now, save the code_day1 folder on your desktop. Note, however, that the files on your Desktop do not move from computer to computer and could get erased, so once you start writing your own programs be sure to save them in your middfiles account.

To download one of the programs in the code_day1 folder to your Handy board, go to your Logo window, click on the button labeled "...", select the code_day1 folder and within it one of the programs. Then click on "download". The Handy board will beep if it worked correctly.

Part 3: Experiment with light sensors and follow-line

Once you've got the hang of downloading new programs to your Handy board the final thing will be to see if you can get your Sciborg to follow a black line. To do this, we're going to use the light sensors. Plug them into ports 0 and 1 of the Handy board and select the analog display mode by turning the user knob past option (7). See how the values change as you move the light sensors around.

Once you have a good understanding of what the sensor should read, download the program sensortest.txt from the "code_day1" folder onto the Handy Board, and experiment some more. Try to find a good distance and a good value for the threshold "black" so that the sensors can detect a black line reliably.

Next, attach the light sensors to the front of your Sciborg (you may have to rebuild it first...). Download the program sciborg.txt. There are a couple of programs you can run on here. Look at the different ones by scrolling through the menu. The important program is the first one called "follow-line".

The follow-line program is very simple, but it's effective. If the left sensor is over black (more specifically thinks it's over black based on the black threshold) then it turns the sciborg left. If the right sensor is over black then it turns the sciborg right. This behavior causes the sciborg to inch its way forward back moving back and forth between the two sensors. When it gets to the end, it does a nice 180 (without actually any additional coding... thing about why).

In order to get your Sciborg to correctly follow a line, you'll have to experiment with the blackness threshold and with the height of the light sensors. Change the blackness threshold using the black+10 and black-10 menu options. Experiment to find a suitable value. Work with your Sciborg and the placement of the light sensors until the Sciborg can follow a line.

Some questions for thought and experimentation

Discuss the following questions in your group and check your answers using experimentation. (Nothing to be handed in.)
  1. What do you think would happen if the ports of the two analog sensors were reversed? Try it out. Were you right?
  2. What should happen if the motor ports are reversed? Try it out. Were you right?
  3. Reorienting the way the motors are plugged in will turn the wheels in the opposite direction. Would the Sciborg follow the line going backwards? Try it out. Were you right?
  4. Improving follow-line:
    Sciborg's follow-line program produces an awkward, jerky motion that succeeds in following the line, but does so without much elegance. Discuss theoretical ways of improving the line-following behavior, either by modifying the program or by modifying the robot. We'll come back to this question in the next homework!