Friday, April 9, 2010

Final Challenge-2

For this challenge, Esther and I used Bang Bang control to make our MotorCar to move straighter. In class, Professor Berg showed us a visual example of Bang Bang control with a sensor, a candle, and a fan. The sensor was placed above the candle. In his program, he wanted the temperature to stay constant so when the sensor sensed that the temperature was a above a certain point, then the fan would start. When the temperature was a below a certain point, the fan would stop. The graph for the program oscillated and that is a characteristic of Bang Bang control.

We used the count difference (count b- count a) to determine whether the Motorcar should bear left or bear right and thereby constantly adjusting itself to move in straight line. We saw that when the count was positive, the Motocar drifted towards the right and we needed to add friction to the left wheel so that it would bear left. When the count was positive, the Motorcar drifted to the left and we needed to add friction to the right wheel so that it would bear right.
So we created a program "s-bb" that used the "if then else" blocks and the "bear left" and "bear right" blocks that we made in the previous challenge.
We added a print statement so that we could see the count difference and we could also see the oscillation because the count would vary from -3 to 3.
This is our program:
We had some difficulties writing this program because some of the blocks that we used, such as the "forward", "bear left", and "bear right" blocks, had forever loops in them. Since the forever loops never give up control, the program that we had written up above never worked. When we ran the program, the Motorcar would just move forward forever. So this was one of our major problems. We had another problem that made things a little bit confusing. We had our left wheel associated with count b and our right wheel associated with count a. We should have had it the other way, so in order to correct this we just switched the wires so that the right wheel would be connected to inputs 1 and 2 and the left wheel would be connected to inputs 3 and 4. By having these mixed up, we were not able to correctly use the count difference and had the wrong notion of what happened when the count difference was negative and positive. However, when we took away the forever loops and connected the wheels to the right inputs, our program worked really well.
We played around with the power settings hidden in the "bear left" and "bear right" blocks. We had previously had the power settings reduced to 9000 and when we ran the program, we could see a minor wobble in the Motorcar, hence the oscillation. So we decided to make the difference slightly smaller by have the the power settings reduced to 9700. When we ran that program, the Motorcar did not wobble and moved straight!

So we tried our program on different surfaces.

We first tried it on up on the ramp. Here is a quick video of it:



Then we tried it down on the ramp. We found that the MotorCar moved a lot straighter while it was going down the ramp and than up the ramp. As it was going up the ramp, it beared right a little bit and wasn't able to make it all the way to the top. However, the MotorCar was able to make it all the way down the ramp without falling off.
Here is a video of it:



When then just tried our program on the concrete floor along a tape line. Here is a video of it:

When we set our MotorCar on the carpet, it did not go as straight as it did on the concrete floor.
Here is a video of it:

We then tested out program under different conditions. We first set both wheels to have low friction. The result was that the MotorCar went fairly straight on the tape line but it beared right slightly in the end. Then we gave one wheel (the right wheel) higher friction and the result was that the MotoCar wobbled a lot more than before and this time it beared slightly to the left. Finally, we set both wheels to have a higher friction. This time the MotorCar moved the straightest along the tape line , even if was a bit wobbly.


No comments:

Post a Comment