Code to run the microcontrollers on the R5 competition bot

Dependencies:   LineSensors mbed

Files at this revision

API Documentation at this revision

Comitter:
Hypna
Date:
Sat Apr 18 04:57:20 2015 +0000
Parent:
21:44d9b42c04a9
Commit message:
stuff

Changed in this revision

navcontroller.cpp Show annotated file Show diff for this revision Revisions of this file
navcontroller.h Show annotated file Show diff for this revision Revisions of this file
r5map.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 44d9b42c04a9 -r 8f726dc175cd navcontroller.cpp
--- a/navcontroller.cpp	Sat Apr 18 04:38:53 2015 +0000
+++ b/navcontroller.cpp	Sat Apr 18 04:57:20 2015 +0000
@@ -13,34 +13,7 @@
     end.y = mapSize-1; 
 }
 
-void NavController::explore()
-{
-     typename ::direction next;
-     typename ::position newPos;
-
-    while(map.getPosition() != end)
-    {
-        updateMap();
-        next = nextExploreMove();
-        sendMove(next);
-        newPos = map.getPosition();
-        
-        switch(next)
-        {
-            case NORTH : newPos.y++;
-                break;
-            case SOUTH : newPos.y--;
-                break;
-            case EAST : newPos.x++;
-                break;
-            case WEST : newPos.x--;
-        }
-        
-        map.setPosition(newPos);
-    }
-
-    saveMap();
-}
+bool NavController::isDone() { return map.getPosition() == map.getFinish(); } 
 
 void NavController::prepReturn()
 {
diff -r 44d9b42c04a9 -r 8f726dc175cd navcontroller.h
--- a/navcontroller.h	Sat Apr 18 04:38:53 2015 +0000
+++ b/navcontroller.h	Sat Apr 18 04:57:20 2015 +0000
@@ -14,7 +14,7 @@
     NavController(int mapSize = 5);
     R5Map::direction nextExploreMove();
     R5Map::direction nextTraceMove();
-    void nextPhase();
+    bool isDone();
 
     private:
     R5Map::position end;
diff -r 44d9b42c04a9 -r 8f726dc175cd r5map.cpp
--- a/r5map.cpp	Sat Apr 18 04:38:53 2015 +0000
+++ b/r5map.cpp	Sat Apr 18 04:57:20 2015 +0000
@@ -177,18 +177,6 @@
 
 bool R5Map::getCurVisited() const { return map[pos.x][pos.y].visited; }
 
-vector<char> R5Map::getSymbols(position cell) const 
-{
-    if(cell.x >= 0 && cell.y >= 0 && cell.x <= 6 && cell.y <= 6)
-        return map[cell.x][cell.y].symbols;
-    else
-    {
-        cerr<<"ERROR: Position selection in R5Map::getSymbols(position) outside of map bounds!"<<endl;
-        vector<char> empty;
-        return empty;
-    }
-}
-
 int R5Map::getSize() const { return size; }
 
 void R5Map::printMap() const