General Programming Strategy



Program Hierarchy


In the interest of maximizing programming efficiency, we use subroutines whenever possible. Subroutines are used for typical robot movements, like line following, squaring to a line, error-corrected movements, etc., as well as for entire missions. The use of subroutines allows us to re-use programming code and enjoy the benefits of an efficient mission selection program. This diagram to the left illustrates the great extent to which Ctrl-Z re-uses programming code.


Function Examples


Main Selection Program

This selection program allows us to quickly and efficiently switch programs/missions during the two-and-a-half minute match. Our selection program contains functions, each containing one of our missions. The user of the robot simply starts the selection program and clicks the centre button to start the first mission. Then, when the mission finishes, the robot automatically advances to the next mission and waits for the user to click the centre button to run the appropriate mission. In case one needs to go backwards or forwards through the list of missions, the program accommodates that by allowing the user to navigate with the left and right arrow buttons.


Square Up

We have created a function that makes the robot completely perpendicular to the edge of a black line. Each light sensor corresponds with a motor. The robot drives up to the line and has the light sensor check the reflected light values. If the light sensor sees a value of less than 50 (black), it will tell the motor to move towards a value greater than 50 (white). It does this for both motors while for a set amount of time while slowly decreasing in power, until the robot becomes completely perpendicular to the edge of the line.


Full Programming Documentation (Click to See Full Code!)