Statistics
| Branch: | Revision:

root / scout / libscout / src / test_behaviors / Scheduler.h @ 6350051e

History | View | Annotate | Download (853 Bytes)

1 97b6298e unknown
#ifndef _SCHEDULER_
2
#define _SCHEDULER_
3
4 76cefba1 Priya
#include "../helper_classes/PQWrapper.h"
5
#include "../helper_classes/Order.h"
6
#include "../Behavior.h"
7 97b6298e unknown
8 2f025967 Priya
#define NUM_TASKS 5
9 ad5b5826 Priya
#define WAITING_ROBOT 1
10
#define NEW_ROBOT 2
11
#define ORDERED_ROBOT 3
12 2f025967 Priya
13 3f72678f Priya
typedef struct{
14
  std::string name;
15 7ac5e9bc Priya
  ros::Publisher topic;
16 ad5b5826 Priya
  int sched_status;
17 3f72678f Priya
} Robot;
18
19 76cefba1 Priya
class Scheduler : Behavior {
20 3f72678f Priya
  std::vector<Robot> robots;
21 ad5b5826 Priya
        std::queue<Robot> waitingRobots;
22
23 2f025967 Priya
  PQWrapper* unassignedOrders;
24 97b6298e unknown
        std::vector<Order> assignedOrders;
25 76cefba1 Priya
26
        void create_orders();
27
28
        void waiting_dance();
29
30 3f72678f Priya
  void msg_callback(const std_msgs::String::ConstPtr& msg);
31
32 97b6298e unknown
public:
33 d140fd71 Yuyang
  Scheduler(std::string scoutname, Sensors* sensors);
34 97b6298e unknown
        ~Scheduler();
35
        
36 3f72678f Priya
        void get_task(int robot);
37 97b6298e unknown
        
38
        void task_complete(Order o);
39
        void task_failed(Order o);
40
        
41
        
42
        Order get_next_item();
43
        
44
        void run();
45 3f72678f Priya
46 7ac5e9bc Priya
  ros::Subscriber robot_to_sched;
47 97b6298e unknown
    
48
};
49 76cefba1 Priya
#endif