[FC.7: Distance with Proportional Control]
I found this challenge very exciting because I was to use a proportional control onto the MotorCar. I liked the word "proportional" because it means that the mechanism adjusts itself to the desired output according to the given condition. We counted the number of rotations on each wheel, which we found to be approximately 3300. In a forever loop, we had it constantly update the error, which was to be used to control the power supply in each motor or "x". Our MotorCar did a pretty good job in going exactly 10 feet, although it did not really move straight. It was also interesting to see how the car behaved on carpets. We couldn't record it but, it would go for exactly ten feet on carpets as well. And this was something new because with distance-bang-bang control, we were only allowed to control the distance with timer.
Here is a video of our "Distance with Proportional Control."
[FC.8: Distance with Nudging]
Here is our code for nudging. The count+ of the Motors after traveling 10 feet was approximately 6300, so we set the error to be 3140 (half of count+) minus the average of the rotations on the two motors. At first, we had the last if condition (when error_ > 10) nested in a second forever loop, not realizing that the count+ gets initialized in the loop. So, our MotorCar wasn't really nudging but was stopping when error_ equaled to 600 (our first if condition). We had our gain set to 25 (a huge number for gain) to control the power supplied to each motors. We had a new variable called "x" which was a product of the gain and the error. However, with a large number for the gain, the "x" was decreasing so rapidly that no power was being supplied to the motors long before it could reach the target. So, we decided to set the gain to 3, a small number. With a small gain, the MotorCar would nudge when the wheels were in the air. But, when on the floor, because it was getting so little power by the time the error_ became so small that the car would not move forward. Therefore, we got rid of proportional power control, and manually set the power equal to 10,000 when not so near the target, and nudge when near the target.
Here is a video of our car nudging to the target.
[FC.9 All Together Now]
Above is our code for the challenge, "All Together Now." We simply incorporated the bang-bang-control into our nudging program for straightness. When we tried the code on the MotorCar, it would go straighter than when it was applied with the nudging program (FC.8), but still it was not perfectly straight. We later found out that the size of each wheel differs by a slight bit, which caused the car to bear a little bit left. We tried switching wheels to get the same sized wheels, but did not have any luck with it. So, we had to give a little push on the MotorCar to have it go really straight. It would have been nice to have the car go really straight without the push but we decided to stick with our wheels and work our way through our fire fighting robot!
Here is a video of our MotorCar on floor for the final challenge.
Here is a video of our MotorCar moving up the incline for 10 feet.
Here is a video of our MotorCar moving 10 feet on carpet.
No comments:
Post a Comment