Chapter 4 Assessment: Questions, Exercises, and Projects

April 13, 2011 at 5:56 pm (Uncategorized)

Questions:

1) What direction does the left wheel have to turn to make the Boe-Bot go forward? What direction does the right wheel have to turn?

The left wheel has to move counterclockwise while the right wheel has to move clockwise because both wheels have to move at opposite directions.

2) When the Boe-Bot pivots to the left, what are the right and left wheels doing?

The left wheel is at the pulse width of 750 and isn’t moving while the right wheel is moving forward/clockwise. This makes the boe-bot start turning to the left.

3) If your Boe-Bot veers slightly to the left when you are running a program to make it go straight ahead? How do you correct this? What command needs to be adjusted and what kind of adjustment should you make?

The right wheel has to be slowed down because if the boe-bot veers to the left it means that the right wheel is not moving at the same speed as the left wheel, thus making the boe-bot move more to the left direction. The PULSOUT command is the command needed to be adjusted and to make the right wheel slower, it means that the PULSOUT for the right wheel has to be closer to 750.

4) If your Boe-Bot travels 11 in/s, how many pulses will it take to make it travel 36 inches?

The given is that the boe-bot travels at 11 in/s. The equation I have to work out is “pulses = boe-bot distance/boe-bot speed” multiplied by 40.65 pulses. The answer I got is that the boe-bot has to have 133 pulses.

5) What’s the relationship between a FOR…NEXT loop’s Counter argument and the PULSOUT command’s Duration argument that makes ramping possible?

The FOR…NEXT loop’s counter argument can be used in the PULSOUT command’s duration argument to¬†allow ramping by using the + or – signs in the PULSOUT command. For example, to allow ramping, the PULSOUT command can be “PULSOUT 13, 750 + pulseCount” and “PULSOUT 12, 750 – pulseCount”. 750 just means that the wheels are not moving and are at a complete stop.

6) What directive can you use to pre-store values in the BASIC Stamp’s EEPROM before running a program?

The DATA directive

7) What command can you use to retrieve a value stored in EEPROM and copy it to a variable?

The READ command

8) What code block can you use to select a particular variable and evaluate it on a case by case basis and execute a different code block for each case?

SELECT…CASE…ENDSELECT can be used to select a particular variable and evaluate it on a case by case basis used to execute a different code block for each case.

9) What are the different conditions that can be used with DO…LOOP?

The different conditions that can be used with DO…LOOP are UNTIL and WHILE.

Exercises:

1) Write a routine that makes the Boe-Bot back up for 350 pulses.

FOR counter = 1 to 350

PULSOUT 13, 708

PULSOUT 12, 880

PAUSE 20

NEXT

(For this exercise, I just had to make a FOR…NEXT command that contained the same PULSOUT values as the one I tested for the boe-bot to move backward in a straight line. For my boe-bot, the PULSOUT values were 708 for right and 880 for left.)

2) Let’s say that you tested your servos and discovered that it takes 48 pulses to make a 180 degree turn with right-rotate. With this information, write routines to make the Boe-Bot perform 30, 45, and 60 degree turns.

30 Degrees:

FOR counter = 1 to 8

PULSOUT 13, 850

PULSOUT 12, 850

PAUSE 20

NEXT

45 Degrees:

FOR counter = 1 to 12

PULSOUT 13, 850

PULSOUT 12, 850

PAUSE 20

NEXT

60 Degrees:

FOR counter = 1 to 16

PULSOUT 13, 850

PULSOUT 12, 850

PAUSE 20

NEXT

(For this exercise, I had to apply math to find out the amount of pulses needed for each degree turns. For example, for the 30 degree turns, I had to solve the proportion: 48/180 = x/30″. Since I knew that 48 pulses made a 180 degree turn, then I had to figure out x, which was the amount of pulses needed in a 30 degree turn. I got the approximate answer of 8.)

3) Write a routine that makes the Boe-Bot go straight forward, then ramp in and out of a pivoting turn, and then continue straight forward.

FOR counter = 1 to 66

PULSOUT 13, 802

PULSOUT 12, 650

PAUSE 20

NEXT

FOR counter = 1 to 22

PULSOUT 13, 750 + pulseCount

PULSOUT 12, 750

PAUSE 20

NEXT

FOR counter = 22 to 1

PULSOUT 13, 750 + counter

PULSOUT 12, 750

PAUSE 20

NEXT

FOR counter = 1 to 66

PULSOUT 13, 802

PULSOUT 12, 650

PAUSE 20

NEXT

(For this exercise, I had to make multiple FOR…NEXT commands. First, I had to write a FOR…NEXT command for the boe-bot to go straight forward, then ramping in a pivoting turn and then straight forward again. For the FOR…NEXT command for the boe-bot to go straight forward, I used the same PULSOUT values that I tested that made the boe-bot go in a straight line in one of the earlier activities. For the ramping for the pivoting turn, I had to use + pulseCount and do 1 to 22 for the FOR counter value to start the ramping and 22 to 1 in the next FOR counter value to make the boe-bot slow down.)

Projects:

1) It is time to fill in column 3 of Table 2-1: PULSOUT Duration Combinations on page 81. To do this, modify the PULSOUT DURATION arguments in the program BoeBotForwardThreeSeconds.bs2 using each pair of values from column 1. Record your Boe-Bot’s resultant behavior for each pair in column 3. Once completed, this table will serve as a reference guide when you design your own custom Boe-Bot manuevers.

(For this project, I didn’t need to experiment for every PULSOUT value because some of them were the standard PULSOUT values for the basic manuevers. For example, 750 for both wheels meant that the boe-bot would be at a full stop because both wheels wouldn’t be moving, so I didn’t take long for this project.)

2) Figure-9 shows two simple obstacle courses. Write a program that will make your Boe-Bot navigate along each figure. Assume straight line distances (including the diameter of the circle) to be either 1 yd or 1 m.

The program I wrote for the circle was the one in the answer at the back of the chapter assessment because I couldn’t figure out how to write the program. For this project, I worked on it with my seatmate Christine, and the first thing we did was to take a yard stick and put it on the floor. We ran the program and noticed that the boe-bot moved in a circle that had a bigger diameter than 1 yard. We experimented with different PULSOUT values for the right wheel. We ended up with the PULSOUT value 717, which was the closest we could get to a 1 yard meter, even though the boe-bot went over the ruler since the circle was smaller than the length of the ruler. At first, I didn’t understand why the boe-bot kept on going over the ruler and we couldn’t find the right PULSOUT value because the boe-bot either moved way too far from the ruler or it kept on going over the ruler, until I finished Project 2 and realized that the yard stick was in fact about 2 inches longer than an actual yard, which is about 36 inches, so that was the reason the boe-bot made a circle that was smaller than the ruler because it wasn’t the right measurement.


For this project, I also used the program at the back of the chapter assessment and I also worked with Christine. The first thing we needed to do was to make a triangle with a side length of 1 yard on the floor using masking tape. Once we finished the triangle, we had to calculate the FOR counter for the forward. To do this, we had to use the equation “pulses=boe-bot distance/boe-bot speed x 40.65″. Christine’s boe-bot runs at about 8.6 inches per second while my boe-bot ran at about 7 inches per second, so our FOR counter values were different. When we ran the program, however, we found out that the boe-bot didn’t go the full distance of the masking tape we made and we figured out that the yard stick wasn’t 36 inches, but 38 inches, so we had to redo our triangle by taking off the extra two inches from each piece of tape. We also experimented on the FOR counter values for the rotating right 120 degrees, but the boe-bot ended up doing a trapezoid type of shape instead of a triangle, so we decided to use the same value as in the book.

One thing I found odd during class was that when I needed help on the projects part of the chapter assessment, the other people who already finished the chapter assessments said that they didn’t remember how to do it, so I had a hard time trying to figure it out myself, which resulted in me and Christine working together for both projects. I didn’t really understand how the other people finished their chapter assessment projects without using a ruler and making a masking tape in a figure of a triangle on the floor.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: