Skip to content.

Sections
Personal tools
You are here: Home Assignments Assignment 7
Document Actions

Assignment 7

by Max Chang last modified 2007-02-27 09:09 AM

Bit Bot

due Monday, March 5

original version by Anjum Gupta

Part 1

Before you try to make your robot perform correctly, make sure you can do the assignment yourself! Read through this entire assignment, and then take a look at the barcodes your robots will be interpreting. See if you can interpret the barcodes by hand, before you start writing code. For instance, can you tell what program is listed below if you read it left to right? And right to left?

Part 2

The ‘1’ bit is encoded with a thick solid black bar, and a ‘0’ bit is encoded as a thin black bar. E.g. the bit pattern 10110010, represented as a bar code is:

http://www.cogsci.ucsd.edu/Plone/classes/WI07/COGS008/Members/mchang/barcode.png

As binary is usually written, the rightmost bar is the least significant bit. As far as your robot is concerned, the least significant bit is just the first one you read.

Your robot will need a light sensor pointing down to read this code. It should be programmed to drive over a surface on which such codes have been drawn, interpreting the changing light sensor readings as either 0 or 1 bit value. We have attempted to draw the bar codes with uniform sizes and spaces, but your code should be robust to minor variations in spacing between bars, or bar widths.

You can either use rotation sensors or a timer function to keep track of how long you sensed a black mark to figure out whether you read a 0 or a 1.

Your robot should also beep in two different ways – a higher pitched sound for a ‘1’ and a lower pitched one for a ‘0’. This auditory feedback will help you debug as bits are being read.

After reading all 8 bits your robot should remain idle for 5 seconds before “executing” the instruction it has read. During this time it should display on it's LCD the decimal interpretation of the barcode it just read.

Part 3

Your robot should be capable of executing four different functions, according to the bit pattern it reads. They are defined as follows:

Operation Semantics OPCODE Details
Forward Move forward T seconds 0ttttttt t: time encoded in 7 bits.
Halt Beep twice and stop 100xxxxx x: ignored
MazePath Make a series of left/right turns corresponding to D 101ddddd

starting with LSB

d=0 -> left turn

d=1 -> right turn

go forward one second between turns

Figures Execute one of three figures 111ffccc
Function Semantics Fn code (ff) Details
Pivot Spins either counter/clockwise 00

c=0 -> clockwise turn

c=1 -> counter-clockwise turn

Square make square 10 c: edge size in inches encoded in 3 bits
Go-Come go forward, then return 11 c: distance in inches encoded in 3 bits

Assignment submission details

  1. Place all of your code in a file called BitBot_<UCID>_<UCID>.nqc
  2. Write a very brief set of comments at the top of the file documenting your progress (e.g. showing experiments you did to show the code working), and anything else you want to communicate about the assignment.
  3. Attach this file to an Email message, with the subject the same as the name of the file attached, and send this email to cg8w1@icogsci1.ucsd.edu no later than Monday, March 5 at 11:59 pm.

Demonstrations

For this assignment, you will need to demonstrate the performance of your robot on Tuesday between 3:30 and 5:00. Only one of the team members is required to demonstrate your robot's performance. If no one can make it to any of these times, contact cg8w1@icogsci1.ucsd.edu to make other arrangements.

Hints/recommendations

  • Use all that you've learned in previous assignments to make accurate movements!
  • Accomplish earlier steps before attempting later ones.
 

Powered by Plone, the Open Source Content Management System