Robot's source code
Dependencies: mbed
Map/Map.h@119:c45efcd706d9, 2015-05-06 (annotated)
- Committer:
- Jagang
- Date:
- Wed May 06 15:17:16 2015 +0000
- Revision:
- 119:c45efcd706d9
- Parent:
- 109:53918ba98306
- Child:
- 120:06643cbec98a
Modif asserv B; Impl?mentation de l'IA et des objectifs (Ramasser PC et d?poser)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jagang | 109:53918ba98306 | 1 | #ifndef MAP_H |
Jagang | 109:53918ba98306 | 2 | #define MAP_H |
Jagang | 13:ae5718ac8511 | 3 | |
Jagang | 109:53918ba98306 | 4 | #include "defines.h" |
Jagang | 13:ae5718ac8511 | 5 | |
Jagang | 13:ae5718ac8511 | 6 | #include "Obstacle.h" |
Jagang | 109:53918ba98306 | 7 | #include "Point.h" |
Jagang | 109:53918ba98306 | 8 | #include <vector> |
Jagang | 12:235b5545ff41 | 9 | |
Jagang | 109:53918ba98306 | 10 | #define DIAG_COST 0.7071067/2 |
Jagang | 109:53918ba98306 | 11 | #define NDIAG_COST 0.5/2 |
Jagang | 109:53918ba98306 | 12 | |
Jagang | 119:c45efcd706d9 | 13 | #define LOG_LEVEL 4 //4 debug(very slow) - 3 errors/warnings/infos - 2 errors/warnings - 1 errors - 0 none |
Jagang | 109:53918ba98306 | 14 | #define LOG_ASTAR 1 |
Jagang | 119:c45efcd706d9 | 15 | #define LOG_TENDEUR 0 |
Jagang | 109:53918ba98306 | 16 | |
Jagang | 109:53918ba98306 | 17 | |
Jagang | 109:53918ba98306 | 18 | |
Jagang | 109:53918ba98306 | 19 | class SimplePoint |
Jagang | 109:53918ba98306 | 20 | { |
Jagang | 109:53918ba98306 | 21 | public: |
Jagang | 109:53918ba98306 | 22 | SimplePoint(float x, float y) : x(x),y(y) {} |
Jagang | 109:53918ba98306 | 23 | SimplePoint(const SimplePoint &p) : x(p.x),y(p.y) {} |
Jagang | 109:53918ba98306 | 24 | bool operator!=(SimplePoint& p) {return x!=p.x||y!=p.y;} |
Jagang | 109:53918ba98306 | 25 | virtual ~SimplePoint() {} |
Jagang | 109:53918ba98306 | 26 | float x,y; |
Jagang | 109:53918ba98306 | 27 | }; |
Jagang | 12:235b5545ff41 | 28 | |
Jagang | 12:235b5545ff41 | 29 | class Map |
Jagang | 12:235b5545ff41 | 30 | { |
Jagang | 12:235b5545ff41 | 31 | public: |
Jagang | 13:ae5718ac8511 | 32 | Map(); |
Jagang | 109:53918ba98306 | 33 | ~Map(); |
Jagang | 109:53918ba98306 | 34 | void build(); |
Jagang | 109:53918ba98306 | 35 | |
Jagang | 109:53918ba98306 | 36 | int getHeight(float x, float y); |
Jagang | 109:53918ba98306 | 37 | |
Jagang | 109:53918ba98306 | 38 | // mpc : metre par case, par defaut chaque case fait 10cm |
Jagang | 109:53918ba98306 | 39 | // Position en mm !! |
Jagang | 109:53918ba98306 | 40 | char AStar(float x, float y, float goal_x, float goal_y, float mpc=100); |
Jagang | 109:53918ba98306 | 41 | |
Jagang | 109:53918ba98306 | 42 | |
Jagang | 109:53918ba98306 | 43 | std::vector<SimplePoint> path; |
Jagang | 13:ae5718ac8511 | 44 | private: |
Jagang | 109:53918ba98306 | 45 | std::vector<Obstacle*> obstacles; |
Jagang | 12:235b5545ff41 | 46 | }; |
Jagang | 12:235b5545ff41 | 47 | |
Jagang | 13:ae5718ac8511 | 48 | |
Jagang | 13:ae5718ac8511 | 49 | #endif |