Code to run the microcontrollers on the R5 competition bot
Dependencies: LineSensors mbed
navcontroller.h@19:9f4510646c9e, 2015-04-18 (annotated)
- Committer:
- Hypna
- Date:
- Sat Apr 18 03:50:32 2015 +0000
- Revision:
- 19:9f4510646c9e
- Parent:
- 17:5046b27f5441
- Child:
- 20:0e6b7dce21c0
Updating navcontroller and r5map
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jmar11 | 17:5046b27f5441 | 1 | #ifndef NAVCONTROLLER_H |
jmar11 | 17:5046b27f5441 | 2 | #define NAVCONTROLLER_H |
jmar11 | 17:5046b27f5441 | 3 | |
jmar11 | 17:5046b27f5441 | 4 | #include "r5map.h" |
jmar11 | 17:5046b27f5441 | 5 | #include <stack> |
jmar11 | 17:5046b27f5441 | 6 | #include <vector> |
jmar11 | 17:5046b27f5441 | 7 | |
Hypna | 19:9f4510646c9e | 8 | namespace NavController |
Hypna | 19:9f4510646c9e | 9 | { |
jmar11 | 17:5046b27f5441 | 10 | |
jmar11 | 17:5046b27f5441 | 11 | class NavController |
jmar11 | 17:5046b27f5441 | 12 | { |
jmar11 | 17:5046b27f5441 | 13 | public: |
jmar11 | 17:5046b27f5441 | 14 | NavController(int mapSize = 5); |
Hypna | 19:9f4510646c9e | 15 | R5Map::direction nextExploreMove(); |
Hypna | 19:9f4510646c9e | 16 | R5Map::direction nextTraceMove(); |
jmar11 | 17:5046b27f5441 | 17 | |
jmar11 | 17:5046b27f5441 | 18 | private: |
Hypna | 19:9f4510646c9e | 19 | R5Map::position end; |
Hypna | 19:9f4510646c9e | 20 | R5Map::direction nextExploreMove(); //calculates the next move in maze exploration |
Hypna | 19:9f4510646c9e | 21 | void updateMap(); //records all the sensor information into the map object |
Hypna | 19:9f4510646c9e | 22 | bool readSensor(R5Map::direction wall); //returns true if there is a wall in direction "wall" |
Hypna | 19:9f4510646c9e | 23 | char readWall(R5Map::direction wall); //returns the character written on the wall in the direction of 'wall' |
Hypna | 19:9f4510646c9e | 24 | void prepReturn(); |
jmar11 | 17:5046b27f5441 | 25 | |
Hypna | 19:9f4510646c9e | 26 | R5Map::R5Map map; |
Hypna | 19:9f4510646c9e | 27 | R5Map::direction orient; //current orientation of the bot |
Hypna | 19:9f4510646c9e | 28 | stack<R5Map::direction> path; //a record of the bots path |
jmar11 | 17:5046b27f5441 | 29 | }; |
Hypna | 19:9f4510646c9e | 30 | } //end namespace |
jmar11 | 17:5046b27f5441 | 31 | #endif |