Sunday, April 11, 2010

Final Challenge-5

For this part of the challenge, we wrote a procedure that would make our car travel approximately 2 feet, then reverse and return to where it started from. For this challenge, we copied the program for the previous challenge. Since we know that the distance per count is about the same for the left and right wheel, we were able to find how many counts was needed to travel 2 feet. We multiplied 2 feet by 12 to get 24 inches and then divided that amount by .037 inches/count to get a value of 648 counts. We first tested that value on the program that we created earlier and the car did in fact travel 2 feet.
In order to create this procedure, we made two programs (one for the forward directionand the other for the reverse direction). This a picture of these two programs, entitled "2ftfor" and "2ftback":
We then combined them under our "bandf" program (back and forth). We remembered to add a wait of .2 seconds in between the two directions. We also remembered to put a "stopstack" block at the end of both our programs so that they would hand over the control.
This is a picture of our final program:



This is a video of our "bandf" program.

We saw that when the car reversed and went towards its original location, it didn't quite make it. It about an inch to go before it attained its original starting position. To fix that, we can alter the count on our"2ftback" program.
We then test our program with the car starting uphill on the ramp. As the car moved up, it didn't make reach the 2 feet mark. As the car reversed, it went passed its original location by a couple of inches.
When we started the car going downhill, the car passed the 2 feet mark and as it tried to reverse, its skidded for a couple of seconds and proceeded to travel back up, but it did not reach its original location.

After that, we created a program that would repeat this process 3 times. This is what our program looked like:

We first tried it on the concrete floor. The car ended ip being much further from the starting line ( by a couple of inches). When we tried it on the ramp, with the car first travelling up, the car went further back from the starting line by a couple of inches.

No comments:

Post a Comment