root / scout / libscout / src / behaviors / navigationMap.h @ d8caf546
History | View | Annotate | Download (1.01 KB)
1 |
#ifndef _NAVIGATION_MAP_
|
---|---|
2 |
#define _NAVIGATION_MAP_
|
3 |
|
4 |
#include <cstdlib> |
5 |
#include "linieDrive.h" // Get turn Macros |
6 |
|
7 |
#define START_STATE 1 |
8 |
|
9 |
#define DEADEND -1 |
10 |
#define ARRAY_SIZE 3 |
11 |
|
12 |
#define GET_EDGE_DIR(edge) ((edge)&0x3) |
13 |
#define GET_EDGE_STATE(edge) (((edge)>>2)&0xFF) |
14 |
#define GET_EDGE_DIST(edge) (((edge)>>10)&0x3FFFFF) |
15 |
|
16 |
#define SET_EDGE_DIR(dir) ((dir)&0x3) |
17 |
#define SET_EDGE_STATE(state) (((state)&0xFF)<<2) |
18 |
#define SET_EDGE_DIST(dist) (((dist)&0x3FFFFF)<<10) |
19 |
|
20 |
#define MAKE_EDGE(dir, state, dist) \
|
21 |
SET_EDGE_DIR(dir)+SET_EDGE_STATE(state)+SET_EDGE_DIST(dist) |
22 |
|
23 |
typedef int Edge; |
24 |
typedef int State; |
25 |
typedef int Turn; |
26 |
|
27 |
class navigationMap : Behavior |
28 |
{ |
29 |
public:
|
30 |
navigationMap(std::string scoutname); |
31 |
~navigationMap(); |
32 |
|
33 |
void run();
|
34 |
|
35 |
State get_state(); |
36 |
Turn* shortest_path(State target_state); |
37 |
|
38 |
Edge* get_outbound_edges(); |
39 |
|
40 |
private:
|
41 |
vector <Edge*> map; |
42 |
State curr_state; |
43 |
|
44 |
Edge* make_edge(Turn dir, State state, int dist);
|
45 |
|
46 |
}; |
47 |
#endif
|