After some explanation from Chris, we found that this could be accomplished by creating a relatively simple mathematical equation, and after learning how to add, subtract, and multiply on LabView, we set to work.
Instead of having two light values as we had in our original line follower equation, one for the tape and one for the floor, we took the average of the two and made it our optimal light value—i.e. if the LED sensor recorded this ideal value, our robot would be on the line,and would therefore start to follow the line more closely. We originally found this optimal value to be 34.
Our first attempt at a proportional line follower: Optimal Light (34), Gain (1), Base motor speed (25) |
Gain: Factor of multiplication—larger gain means the speed difference between the two motors will be proportionally larger as the error increases. We started with a gain of 1, because we wanted to see how our robot moved without the added effect of the gain.
Our equation multiplied the error by the gain, and then added the resulting value to the base speed of one wheel while subtracting it from the base speed of the other wheel. The end result of this equation is that, the larger the error, the greater the difference in speed of the two wheels will be, and therefore the bigger the robot’s sweeps will be. This means that ideally, when the LED sensor reads the target value, the error would be zero and the robot would move in a straight line, since multiplying the error by the gain would result in zero difference between the speeds of the two motors.
The factors we needed to play with were the gain, the base power values for each gear, and the exact optimal light value.
We went through a lot of trial and error as we attempted to find the best combination of gain, base power, and optimal light value. We found that a gain of 1 was over-damped (not enough sweeping occurred when the robot was not on the line), and that a gain of 4 was under-damped (the sweeps were too large). Gains of both 2 and 3 worked, but we found that 3 was better because with that gain the robot more reliably made all of its turns. We experimented with base speeds for the two motors, and found that 25 was too fast (missed turns due to delayed light readings), 15 unnecessarily slow, and 20 just right. For light values, we found that 34 was too low (the robot barely reached the line before jumping quickly off of it), 36 too high (it took too long for the robot to start moving in the other direction when it did find the line), and 35 just right.
Gain of 1--Over-damped:
Gain of 4--Under-damped:
Final code for floor tapeline:
Gain (3), Optimal Light Value (35), Base motor speed (20) |
Although these seemed to be the best values we could find using our program and the line of tape on the floor, as you can see from the above movie, our proportional line follower had the potential to be much better. Lyn suggested that we move from the floor to the table, since the white to black contrast of the electrical tape on the table was much more stark than the white to gray contrast of the masking tape on the floor. We took his advice, and after some quick readings and trial and error, found our new optimal light value to be 39. We played with the base speed, and found that 15 was too slow, 20 too fast, and 17 seemed just right. We knew the gain needed to be smaller, since the error had become bigger due to the larger light value difference between the white table and the black tape, but some trial and error was needed to figure out the exact value. .5 was over-damped, 1 was under-damped, and .8 seemed just right.
New and improved program:
Optimal light value (39), Gain (0.8), Base motor speed (17) |
In action:
We were very happy with our proportional line follower, and its much-improved ability to follow a line. I feel like I learned a lot during this project. One key point that I took from the project was about compromising and sacrifice. We had to make many choices when programming our line follower, and these choices reflected the specific goals we had set for it. It became clear that focusing on one feature could sacrifice another. For example, creating a robot that follows lines very closely would also mean creating a robot that would not have the ability to successfully make sharper turns, and vice versa. We had to strike a balance that we were happy with, and I feel that we did this with our final product. Our robot follows the line closely, but not so closely that it cannot make relatively sharp turns--it easily made the required 45 degree turns, and could successfully make much larger turns (from the outside of the track). Our robot did a good job of going straight when it found the line, and sweeping back and forth enough to make large turns. To improve our robot, I might try to alter the program so it could function both on the inside and the outside of a line (at the moment it only functions on the outside, which was our initial objective). Currently, it functions on the inside of the track, but cannot make many of the sharper turns. I would also improve the way the small front wheel is attached to make it more stable, because every few runs it came loose and needed to be reattached. One more improvement could be to try to reduce the amount of sweeping that occurs right before and right after a turn, but this change would probably reduce the size of the turns our robot is able to make.
No comments:
Post a Comment