Project

General

Profile

Statistics
| Branch: | Revision:

root / scout / libscout / src / behaviors / navigationMap.h @ 738e44fb

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
typedef struct{
31
  int len;
32
  Turn* path;
33
} Path;
34

    
35
class navigationMap : Behavior
36
{
37
  public:
38
    navigationMap(std::string scoutname);
39
    ~navigationMap();
40

    
41
    void run();
42

    
43
    State update_state(Turn turn_made);
44

    
45
    Time get_eta();
46
    Time get_time_remaining();
47

    
48
    State get_state();
49
    Path shortest_path(State target_state);
50

    
51
    Edge* get_outbound_edges(State state);        
52

    
53
  private:
54
    vector <Edge*> map;
55
    State curr_state;
56
    Time arrival_time;
57
};
58
#endif