6.270 Robotics Competition
Team 24
Home | Strategy | Code | Results

Code Design

Our code consisted of four main parts: the main robot startup initialization, angle calculation and related math, code related to the gyroscrope, and code dealing with all the other sensors.

Our general design was to calibrate the various sensors we were using, then once the match began and the robot could begin moving, we determined the side of the board we were on and which rf values our robot corresponded to. Then the robot would orient itself by facing outward along the y axis, move forward until it hit the black line, then turn right or left and generally follow the line toward the other side of the board, picking up any balls it encounters along the way. If time permitted, the robot would continue along the black line to the side of the board it first started on, then finally deposit its collected balls in the appropriate scoring areas when 15 seconds remained.

We ran the code controlling ball pick up and sorting in a separate thread from the main movement thread, as well as code checking for bumping into walls and attempting to avoid the other robot if our robot got too near to it.

We wrote code for the gyroscope to use it entirely for moving in a straight line, as well as determining orientation angles using some trig, and turning to a specified angle. We used three ir light sensors to determine the side of the board our robot began on, and two bump sensors for bumping into walls. We had to rely on the RF data mostly for figuring out where the robot was and how far it had moved, as well as for avoiding the other team's robot.