Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Robot2016_2-0 by
Map/Map.h@11:9c70a7f4d7aa, 2016-01-05 (annotated)
- Committer:
- IceTeam
- Date:
- Tue Jan 05 15:48:25 2016 +0100
- Revision:
- 11:9c70a7f4d7aa
- Child:
- 31:8bcc3a0bfa8a
Ajout du fichier parent
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| IceTeam | 11:9c70a7f4d7aa | 1 | #ifndef MAP_H |
| IceTeam | 11:9c70a7f4d7aa | 2 | #define MAP_H |
| IceTeam | 11:9c70a7f4d7aa | 3 | |
| IceTeam | 11:9c70a7f4d7aa | 4 | #include "defines.h" |
| IceTeam | 11:9c70a7f4d7aa | 5 | |
| IceTeam | 11:9c70a7f4d7aa | 6 | #include "Obstacle.h" |
| IceTeam | 11:9c70a7f4d7aa | 7 | #include "Point.h" |
| IceTeam | 11:9c70a7f4d7aa | 8 | #include <vector> |
| IceTeam | 11:9c70a7f4d7aa | 9 | |
| IceTeam | 11:9c70a7f4d7aa | 10 | #define DIAG_COST 0.7071067/2 |
| IceTeam | 11:9c70a7f4d7aa | 11 | #define NDIAG_COST 0.5/2 |
| IceTeam | 11:9c70a7f4d7aa | 12 | |
| IceTeam | 11:9c70a7f4d7aa | 13 | #define LOG_LEVEL 2 //4 debug(very slow) - 3 errors/warnings/infos - 2 errors/warnings - 1 errors - 0 none |
| IceTeam | 11:9c70a7f4d7aa | 14 | #define LOG_ASTAR 1 |
| IceTeam | 11:9c70a7f4d7aa | 15 | #define LOG_TENDEUR 1 |
| IceTeam | 11:9c70a7f4d7aa | 16 | |
| IceTeam | 11:9c70a7f4d7aa | 17 | |
| IceTeam | 11:9c70a7f4d7aa | 18 | |
| IceTeam | 11:9c70a7f4d7aa | 19 | class SimplePoint |
| IceTeam | 11:9c70a7f4d7aa | 20 | { |
| IceTeam | 11:9c70a7f4d7aa | 21 | public: |
| IceTeam | 11:9c70a7f4d7aa | 22 | SimplePoint(float x, float y) : x(x),y(y) {} |
| IceTeam | 11:9c70a7f4d7aa | 23 | SimplePoint(const SimplePoint &p) : x(p.x),y(p.y) {} |
| IceTeam | 11:9c70a7f4d7aa | 24 | bool operator!=(SimplePoint& p) {return x!=p.x||y!=p.y;} |
| IceTeam | 11:9c70a7f4d7aa | 25 | virtual ~SimplePoint() {} |
| IceTeam | 11:9c70a7f4d7aa | 26 | float x,y; |
| IceTeam | 11:9c70a7f4d7aa | 27 | }; |
| IceTeam | 11:9c70a7f4d7aa | 28 | |
| IceTeam | 11:9c70a7f4d7aa | 29 | class Map |
| IceTeam | 11:9c70a7f4d7aa | 30 | { |
| IceTeam | 11:9c70a7f4d7aa | 31 | public: |
| IceTeam | 11:9c70a7f4d7aa | 32 | Map(); |
| IceTeam | 11:9c70a7f4d7aa | 33 | ~Map(); |
| IceTeam | 11:9c70a7f4d7aa | 34 | void build(); |
| IceTeam | 11:9c70a7f4d7aa | 35 | |
| IceTeam | 11:9c70a7f4d7aa | 36 | int getHeight(float x, float y); |
| IceTeam | 11:9c70a7f4d7aa | 37 | |
| IceTeam | 11:9c70a7f4d7aa | 38 | // mpc : metre par case, par defaut chaque case fait 10cm |
| IceTeam | 11:9c70a7f4d7aa | 39 | // Position en mm !! |
| IceTeam | 11:9c70a7f4d7aa | 40 | char AStar(float x, float y, float goal_x, float goal_y, float mpc=100); |
| IceTeam | 11:9c70a7f4d7aa | 41 | |
| IceTeam | 11:9c70a7f4d7aa | 42 | |
| IceTeam | 11:9c70a7f4d7aa | 43 | std::vector<SimplePoint> path; |
| IceTeam | 11:9c70a7f4d7aa | 44 | std::vector<Obstacle*> obstacles; |
| IceTeam | 11:9c70a7f4d7aa | 45 | private: |
| IceTeam | 11:9c70a7f4d7aa | 46 | }; |
| IceTeam | 11:9c70a7f4d7aa | 47 | |
| IceTeam | 11:9c70a7f4d7aa | 48 | |
| IceTeam | 11:9c70a7f4d7aa | 49 | #endif |
