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