|
Code Design
Our code goal was to create a sort of new programming environment for
our anticipated strategy. By creating a complex backend complete
with an event model, we are able to supply strategies as such:
while (!goTo(ZONE_Y)) {
// Something went wrong
if (pollState(COLLISION)) {
yellWildly();
}
if (pollState(WALL_COLLISION)) {
break;
}
}
Events were handled by an additional thread which ran in the background
of our code, listening for sensor input, and combining results to make
informed decisions. For instance, motors were checked to make
sure that they were actually driving wheels and not locked. If
wheels locked, we could assume that something had either gone terribly
wrong (gear train damage), or more likely, that we had hit something
pretty seriously.
Our code is fully documented using Doxygen. This documentation can be accessed by click HERE.
The code is available for browsing HERE
|