Team 54: Mean Mr. Mustard

Team Members: Kelly Chang, Michael Fleder


Mean Mr. Mustard (de-handyboarded)

Strategy:

Mean Mr. Mustard (also known as Mr. Mustard) was characterized by avarice; he would attempt to collect as many red and green balls as possible while never caring about their color. Mr. Mustard realized that if he could collect all 22 balls on his side of the table (11 green and 11 red) and place them in his scoring area, he would receive a score of 11, because at the end of the match he would have 11 balls of the winning color and 11 of the losing. Since balls of the winning color are worth +2 and those of the losing are worth -1, having 11 of the winning and 11 of the losing would yield a final score of 2*11 + (-1)*11 = 11. Mr. Mustard went about this ball gathering by collecting balls in the following order:

1. 2 balls closest to the wall
2. 4 balls directly behind the starting area (these would be pushed into the scoring area rather than trapped by the gate)
3. 8 balls to his right (while facing the wall)
4. 8 to his left

Mr. Mustard's strategy worked well when Mr. Mustard decided to cooperate, but when he didn't...

Design:

Mr. Mustard had a servo-controlled mustard-green gate at the front. The gate allowed him to capture balls by lifting the gate and to keep balls from escaping by closing the gate. The gate worked well when the robot was properly aligned. However, since the gate was just wide enough to capture balls spaced 7 inches apart, any deviations in Mr. Mustard¡¦s charted course would result in the capture of less than four balls. The robot used a differential drive powered by 4 motors (2 on the left, 2 on the right). Each side of the robot had a 125:1 gear box. This system worked well, but since the wheels were not exactly centered, the robot could not perfectly spin in place (but he came close). The robot moved so quickly that we only ran it at 20% of its maximum speed. The robot also used 6 line sensors: three at the front used for line-following, and three for initial orientation and some navigation (one on Mr. Mustard¡¦s far left, one on his far right, and one on the back left). The robot used a gyroscope for turning but required no other sensors. The robot was well braced, and so collisions with other robots and/or people did not present a problem (for the robot).

Code:

We wrote the code for orienting the robot (assignment 5) and for line following separately. Orienting the robot involved reading three sensors positioned over three different starting squares and comparing them to cases in an array, which returned the correct turn angle. We had three other sensors for line following that used conditionals. Both worked well, and we were able to write a couple functions using the line following to get the robot to various places on the board. Unfortunately, we had problems with the threads from start_machine() and from the gyroscope, so when we tried putting all the code together, the gyroscope didn't work properly. By the time we figured out (meaning an organizer figured out) the problem, we weren't left with much time to work out the details (such as getting the robot in the right position to line follow.) We settled for pushing the first four balls into the scoring area and then dead reckoning with gyroscope (which usually failed to drive straight) to get to the lines. Then we decided to let the robot run around the board for the remaining time with the rest of our haphazardly written, untested code.

Results:

Looking back, it seems clear that there were two things we should have started on earlier: getting the robot to drive straight with something like shaft encoding and writing/testing our code. Sadly, we made the mistake of taking out all of our sleeps at the last second without testing, which resulted in almost never being able to push those first four balls into the scoring area. The robot was also almost never able to get the sensors in the right position to start line following (at least one sensor needed to start on the line.) In our first round, the robot veered off course and crashed into the middle wall and stayed there. In the second round, the robot drove not-straight off of the line and then spun hopelessly around in circles in search of it. In the third round, miraculously, the robot found the line and followed it perfectly, driving down the length of the board. Then it collided head-on with the opposing robot but was successful in continuing its line following, pushing the other robot down the board into our scoring area. Unfortunately, the robot held many negative balls, and we got -14 points or some other such ridiculous number. However, we were always able to orient correctly, and the gyroscope turned the robot beautifully, even though it couldn't seem to drive the robot straight.