Project

General

Profile

Revision faa11f08

IDfaa11f08b06bf7e31069ba66d6bd28a308a5b730
Parent 360e3b6c
Child c15f2677

Added by Priya about 11 years ago

Changed it so that all behaviors are not instantiated immediately. Also changed pause so it does not spam (0, 0) motor speeds.

View differences:

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