Revision faa11f08
Changed it so that all behaviors are not instantiated immediately. Also changed pause so it does not spam (0, 0) motor speeds.
scout/libscout/src/BehaviorList.h | ||
---|---|---|
3 | 3 |
|
4 | 4 |
#include "Behavior.h" |
5 | 5 |
#include "behaviors/line_follow.h" |
6 |
#include "behaviors/priya_draw_name.h" |
|
6 | 7 |
#include "behaviors/draw_cw_circle.h" |
7 | 8 |
#include "behaviors/draw_ccw_circle.h" |
8 | 9 |
#include "behaviors/Odometry.h" |
... | ... | |
14 | 15 |
#include "behaviors/maze_solve.h" |
15 | 16 |
#include "Sensors.h" |
16 | 17 |
|
18 |
template<typename T> Behavior* behavior(std::string scoutname, Sensors* sensors){ return (Behavior*)new T(scoutname, sensors); } |
|
19 |
|
|
20 |
typedef Behavior* (* behavior_func)(std::string, Sensors*); |
|
21 |
|
|
17 | 22 |
class BehaviorList |
18 | 23 |
{ |
19 | 24 |
public: |
20 |
std::vector<Behavior*> behavior_list;
|
|
25 |
std::vector<behavior_func> behavior_list;
|
|
21 | 26 |
|
22 | 27 |
//Constructor. Initializes behavior_list |
23 |
BehaviorList(std::string scoutname, Sensors* sensor);
|
|
28 |
BehaviorList(); |
|
24 | 29 |
//Destructor. Frees behavior_list; |
25 | 30 |
~BehaviorList(); |
26 | 31 |
}; |
Also available in: Unified diff