Team Six/Final Paper

From Maslab 2011

Jump to: navigation, search


Overall Strategy

Our initial overall strategy was as follows:

Robot algorithm: The algorithm runs as long as the timer is noted less than 3 minutes (180 seconds). The first ball seen will have its color noted and be saved in a variable called our_color. As soon as this is established, search the map for goals, the goals are determined as follows: if a yellow wall is seen, drive up to it and use the ir sensor to determine whether or not the depth of the wall varies along its length. If the wall does vary, save the location of the goal in a list called goals_loc[]. When the number of goals is greater than 2 (or if more than 30 seconds have elapsed), then begin to look for balls. Whenever a ball is found, look for the nearest goal and transfer the ball to that goal. Do this as long as the timer has not gone over 2 minutes. After two minutes, whenever a ball is found, if the distance between the ball and the nearest known wall to the opponents side is less than the distance to the nearest known goal, then save the distance and calculate a random number between 0 and 1 and save it to rand_n. Should rand_n > e ^ -(d_togoal-d_towall), throw the ball over the wall, else, throw the ball into the goal. Stop after 3 minutes.

Robot strategy: We decided that we are stronger on the course 6 side of the spectrum than the course 2 side of the spectrum. We're going to keep our robot design relatively simple, with a conveyor belt and accompanying pinball-machine-like doors to pull balls into the robot and drop them into a compartment. On the side, we will have a door that opens when told so that we can drop all our balls into the goal. We decided not to drop balls onto the other side in order to keep our robot simple so that we can focus on our code.

Time-allotment strategy:

   * Michael - Since Maslab is his main IAP commitment, he'll code in the evenings and possibly during the day.
   * Shawn - Work until 4pm every day, code at night with Michael.
   * Piper - Work on building between lecture (or late mornings when lecture isn't happening) and 7pm daily.
   * Xavier - Work on building between lecture (or late mornings when lecture isn't happening) and 7pm daily. 

Mechanical Design and Sensors

We came to realize that our original robot design was problematic. The conveyor belt roller would have to be very small so that the ball would be pulled up it rather than pulled away, and the doors pushing the ball onto the roller would have to be well synchronized. We decided to start from scratch, and came up with something we believe will work much better. Our new design was not only easier to build and more predictably function, but it also allowed us to score over the wall.

We have a scoop with a slanted arm leading down, lined with teeth to scoop up a ball when the robot drives into the ball. Two motors will raise the scoop so that the ball rolls back into our collection box. We had some issues with not having enough torque before, so we added long metal bars sticking out from our scoop to provide us with the leverage needed to raise it. Under our collection box, we'll keep our motor, orc board, and computer. The collection box itself will be slanted towards an escape hatch in the back. This hatch was initially designed to be a drawbridge, but this design became harder when we decided to use a servo to open and close it, so it is just a slate of metal. Since the escape hatch is over the wall, our balls will be able to fall into the other team's field. We will do this with all our balls instead of scoring in goals.

We have two bump sensors at the back of our robot (that is, where the escape hatch is, not the side with the scoop and teeth). This way, when our robot backs up, it will be able to detect when it hits the wall. Our camera faces front, through our scoop (which is composed of plexiglass). On each side, we have two IR sensors that are used to detect the robot's angle to the wall.

Software Design

In general, our software was fairly simplistic. The software consisted primarily of two threads, one carrying out the process of image-processing, and the other carrying out the actual motion of the robot. Apart from both threads was a class (public class Commander) which contained code to actually execute the movements of the robot. That is to say, Commander contained the lowest level code on how the robot moves.

The image processing thread worked with the class ImageScanner. As the name implies, ImageScanner scans the image and makes available to the other thread the positions of various points of interests. The method ImageScanner.analyze() is at the heart of the class and contains four different submethods that all work in the same way. These methods find_red_blob() , find_blue_blob() etc identify the regions of the image that contain the respective colors. When the regions are found, their center of mass and extremities are recorded to be made available to the other thread. In the event that we wanted to see the output of the method in a visual sense, we can uncomment the name method ImageScanner.proc() and then forward the result to a BotClient.

The finite state machine that comprises the main navigation thread is fairly simplistic. It starts off in a state called "SCAN" and essentially takes several scans of the course in front of it. On the occasion that it might see a red ball, it changes to the state "FOLLOW__FOOBALL" (FOO being either RED or GREEN). In this state, it uses a simplistic proportional controller to try to zero in on the ball. As such whenever the ball is on the left, the robot moves left slightly and the same on the right. Upon having the ball centered, the robot then charges forward at full speed and attempts to pick it up using the state "PICKUP_BALL". The state involves two smaller threads originating in Commander that allow the robot to move backwards slightly while lifting the scoop as well. The actual scoring mechanism was never really implemented, but similar methods to "SCAN" and "FOLLOW_REDBALL" were hypothesized for the search and approach to goals.

Overall Performance

Our robot's final performance was non-ideal (we were one of the first groups knocked out). We ended up having scoop/code problems that didn't pop up until the night before the competition, and we weren't able to fix it in time. Overall, we had a physical robot prepared, but it was too late to get our code working with it.


Our team came in with the purpose of learning more about building and coding, having lot of fun and sleep deprivation doing it, and not worrying about being the most competitive team. For the most part, this worked out really well (other than a couple of panicked moments where we were behind on a checkpoint or two and wondered if we should drop out - the staff helped get us up to speed and this ended up not being a problem). Overall, we walked away with what we wanted to get out of MASlab, which is really awesome.

We ended up deviating from our original scheduling plan quite a bit. Instead of having our strongest coders (Michael and Shawn) code and our builders (Wings and Xavier) build, we had a fuzzy division of labor that arose naturally. After discussing designs, Xavier would go build, and Wings would maintain the journal and keep a to-do list for our robot. Wings and Shawn would also solder and construct other parts (ie, at the Edgerton Center). Michael worked on the code. With both the code and the building, we constantly sanity-checked each other and proposed alternative ideas, coming to a group agreement every step of the way.

However, we ended up not being effective at this with our code. Michael spent a lot of time coding, but not being able to build the robot fast enough and not being absolutely clear on how the code and robot should interact meant that we ran into a lot of problems when we were trying to tie everything together. With more time, we would've been able to debug enough to have our robot work as intended. In the end, however, we weren't able to do this, and defaulted to the plan of just having the robot drive around and scoop up balls instead of using our scoring mechanism.

But as stated before, we are very happy with what we got out of MASlab. We learned to build, code, and work as a team. No doubt we'll carry on the awesome lessons we learned here :)

Suggestions for future teams

When forming a team, make sure that everyone is on the same page as far as what they want to get out of MASlab, how competitive they want to be, and what their time commitments are expected to be. Also, there's absolutely no harm in thinking about ideas over winter break! It certainly means building can start earlier. Which brings us to...

Build early, build often, and allot more time for this than you think you need! Our main problem was that we were all very new to building, and things tended to go wrong often. You never know when the laser cutter will stop working, you'll probably have to remachine parts several times over, you will find tons wrong with your robot that you didn't even think about. Building early means that you can make more mistakes, and don't have to be afraid of them. Having a physical robot is very useful to debugging, so having that early for your coders is incredibly useful.

Personal tools