Revision d140fd71
ID | d140fd71ddd19ef38a0124cbbea1165874a5474d |
Added Sensors class that abstracts away sensors from behaviors. Stops creating
duplicated sensors for each scout.
scout/libscout/src/BehaviorProcess.cpp | ||
---|---|---|
1 |
|
|
1 | 2 |
/** |
2 | 3 |
* Copyright (c) 2011 Colony Project |
3 | 4 |
* |
... | ... | |
34 | 35 |
*/ |
35 | 36 |
|
36 | 37 |
#include "BehaviorProcess.h" |
38 |
#include "Sensors.h" |
|
39 |
#include "assert.h" |
|
37 | 40 |
|
38 | 41 |
int main (int argc, char **argv) |
39 | 42 |
{ |
... | ... | |
56 | 59 |
behavior_num = atoi(argv[2]); |
57 | 60 |
|
58 | 61 |
ros::init(argc, argv, scoutname + "_behavior"); |
59 |
|
|
60 |
BehaviorList* list = new BehaviorList(scoutname); |
|
62 |
// one Sensor instance per-class |
|
63 |
Sensors* sensors = new Sensors(scoutname); |
|
64 |
BehaviorList* list = new BehaviorList(scoutname, sensors); |
|
61 | 65 |
vector<Behavior*> behavior_list = list->behavior_list; |
62 |
|
|
63 | 66 |
if (behavior_num < (int)behavior_list.size()) |
64 | 67 |
{ |
65 | 68 |
(behavior_list[behavior_num])->run(); |
Also available in: Unified diff