Project

General

Profile

Statistics
| Branch: | Revision:

root / scout / libscout / src / behaviors / navigationMap.h @ ede03b64

History | View | Annotate | Download (1.13 KB)

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
typedef ros::Time Time;
29

    
30
class navigationMap : Behavior
31
{
32
    public:
33
        navigationMap(std::string scoutname);
34
        ~navigationMap();
35
        
36
        void run();
37
        
38
                State update_state(Turn turn_made);
39

    
40
                Time get_eta();
41
                Time get_time_remaining();
42
        
43
        State get_state();
44
        Turn* shortest_path(State target_state);
45

    
46
        Edge* get_outbound_edges(State state);        
47

    
48
    private:
49
        vector <Edge*> map;
50
        State curr_state;
51
                Time arrival_time;
52
};
53
#endif