Robot's source code
Dependencies: mbed
Map/Map.h@123:55e5e9acc541, 2015-05-11 (annotated)
- Committer:
- Jagang
- Date:
- Mon May 11 20:32:11 2015 +0000
- Revision:
- 123:55e5e9acc541
- Parent:
- 120:06643cbec98a
Maj AI; Repositionnement du d?part (1000,177); Ajout de l'action sur les claps
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 | 120:06643cbec98a | 13 | #define LOG_LEVEL 2 //4 debug(very slow) - 3 errors/warnings/infos - 2 errors/warnings - 1 errors - 0 none |
Jagang | 109:53918ba98306 | 14 | #define LOG_ASTAR 1 |
Jagang | 120:06643cbec98a | 15 | #define LOG_TENDEUR 1 |
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 | 123:55e5e9acc541 | 44 | std::vector<Obstacle*> obstacles; |
Jagang | 13:ae5718ac8511 | 45 | private: |
Jagang | 12:235b5545ff41 | 46 | }; |
Jagang | 12:235b5545ff41 | 47 | |
Jagang | 13:ae5718ac8511 | 48 | |
Jagang | 13:ae5718ac8511 | 49 | #endif |