Statistics
| Branch: | Revision:

scoutos / scout / libscout / src / behaviors / Scheduler.h @ d140fd71

History | View | Annotate | Download (853 Bytes)

1
#ifndef _SCHEDULER_
2
#define _SCHEDULER_
3

    
4
#include "../helper_classes/PQWrapper.h"
5
#include "../helper_classes/Order.h"
6
#include "../Behavior.h"
7

    
8
#define NUM_TASKS 5
9
#define WAITING_ROBOT 1
10
#define NEW_ROBOT 2
11
#define ORDERED_ROBOT 3
12

    
13
typedef struct{
14
  std::string name;
15
  ros::Publisher topic;
16
  int sched_status;
17
} Robot;
18

    
19
class Scheduler : Behavior {
20
  std::vector<Robot> robots;
21
        std::queue<Robot> waitingRobots;
22

    
23
  PQWrapper* unassignedOrders;
24
        std::vector<Order> assignedOrders;
25

    
26
        void create_orders();
27

    
28
        void waiting_dance();
29

    
30
  void msg_callback(const std_msgs::String::ConstPtr& msg);
31

    
32
public:
33
  Scheduler(std::string scoutname, Sensors* sensors);
34
        ~Scheduler();
35
        
36
        void get_task(int robot);
37
        
38
        void task_complete(Order o);
39
        void task_failed(Order o);
40
        
41
        
42
        Order get_next_item();
43
        
44
        void run();
45

    
46
  ros::Subscriber robot_to_sched;
47
    
48
};
49
#endif