navigation updated with completed dijkstra's algo
Dependents: R5 2016 Robotics Team 1
Diff: navigation.h
- Revision:
- 1:a53d97b74fab
- Parent:
- 0:fd72f6df078c
- Child:
- 2:17bd430aeca1
diff -r fd72f6df078c -r a53d97b74fab navigation.h --- a/navigation.h Fri Oct 30 15:48:48 2015 +0000 +++ b/navigation.h Sun Nov 22 19:32:45 2015 +0000 @@ -1,9 +1,10 @@ #ifndef NAVIGATION_H #define NAVIGATION_H +#include "StepperMotor.h" +#include "stdint.h" +#include "mbed.h" #include <vector> #include <stack> -#include "stdint.h" -#include "mbed.h" class Navigation { @@ -20,7 +21,7 @@ int loadMap(char* inputFile); void getShortestPath(uint16_t destination); uint16_t getMinDist(uint16_t target) { return minDistance[target]; } - std::stack<uint16_t> getRoute(uint16_t src, uint16_t target); + void executeRoute(StepperMotor &leftMotor, StepperMotor &rightMotor); // utility functions void printPrevious(Serial &pc); void printRoute(Serial &pc); @@ -31,14 +32,15 @@ static const uint16_t DEFAULT_VERTEX = 0; static const uint16_t DEFAULT_ANGLE = 0; static const int DEFAULT_SIZE = 1; + static const int STEPS_PER_INCH = 20; // per wheel diameter and stepper specs - uint16_t vertex; - uint16_t angle; + uint16_t vertex; // current vertex + uint16_t angle; // current angle struct graphNode { uint16_t neighbor; - uint16_t distance; + uint16_t distance; // in inches uint16_t angle; graphNode(uint16_t arg_neighbor = MAX_DIST, uint16_t arg_distance = MAX_DIST,