Project

General

Profile

Statistics
| Branch: | Revision:

root / scout / libscout / src / behaviors / navigationMap.h @ 93210a92

History | View | Annotate | Download (1.04 KB)

1 d8caf546 Priya
#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 93210a92 Leon
#define MAX_NODES 12
12 d8caf546 Priya
13
#define GET_EDGE_DIR(edge) ((edge)&0x3)
14
#define GET_EDGE_STATE(edge) (((edge)>>2)&0xFF)
15
#define GET_EDGE_DIST(edge) (((edge)>>10)&0x3FFFFF)
16
17
#define SET_EDGE_DIR(dir) ((dir)&0x3)
18
#define SET_EDGE_STATE(state) (((state)&0xFF)<<2)
19
#define SET_EDGE_DIST(dist) (((dist)&0x3FFFFF)<<10)
20
21
#define MAKE_EDGE(dir, state, dist) \
22
SET_EDGE_DIR(dir)+SET_EDGE_STATE(state)+SET_EDGE_DIST(dist)
23
24
typedef int Edge;
25
typedef int State;
26
typedef int Turn;
27
28
class navigationMap : Behavior
29
{
30
    public:
31
        navigationMap(std::string scoutname);
32
        ~navigationMap();
33
        
34
        void run();
35
        
36
        State get_state();
37
        Turn* shortest_path(State target_state);
38
39 93210a92 Leon
        Edge* get_outbound_edges(State state);        
40 d8caf546 Priya
41
    private:
42
        vector <Edge*> map;
43
        State curr_state;
44
45
        Edge* make_edge(Turn dir, State state, int dist);
46
        
47
};
48
#endif