commit faa11f08b06bf7e31069ba66d6bd28a308a5b730
Author: Priya <pdeo@Phlegethon.(none)>
Date:   Sun Feb 3 16:54:03 2013 -0500

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

diff --git a/scout/libscout/src/Behavior.cpp b/scout/libscout/src/Behavior.cpp
index ee1fbfd..5bed745 100644
--- a/scout/libscout/src/Behavior.cpp
+++ b/scout/libscout/src/Behavior.cpp
@@ -66,6 +66,9 @@ Behavior::Behavior(string scoutname, string my_name, Sensors * sensors)
 Behavior::~Behavior()
 {
   motors->set_sides(0, 0, MOTOR_ABSOLUTE);
+  ROS_INFO("I get called");
+  spinOnce();
+  loop_rate->sleep();
   delete wl_receiver;
   delete loop_rate;
 }
diff --git a/scout/libscout/src/BehaviorList.cpp b/scout/libscout/src/BehaviorList.cpp
index a39a298..9b31faf 100644
--- a/scout/libscout/src/BehaviorList.cpp
+++ b/scout/libscout/src/BehaviorList.cpp
@@ -1,18 +1,18 @@
 #include "BehaviorList.h"
 
 
-BehaviorList::BehaviorList(std::string scoutname, Sensors * sensor)
+BehaviorList::BehaviorList()
 {
-  behavior_list.push_back((Behavior*)new pause_scout(scoutname, sensor));
-  behavior_list.push_back((Behavior*)new draw_cw_circle(scoutname,sensor));
-  behavior_list.push_back((Behavior*)new draw_ccw_circle(scoutname, sensor));
-  behavior_list.push_back((Behavior*)new Odometry(scoutname, sensor));
-  behavior_list.push_back((Behavior*)new navigationMap(scoutname, sensor));
-  behavior_list.push_back((Behavior*)new Scheduler(scoutname, sensor));
-  behavior_list.push_back((Behavior*)new WH_Robot(scoutname, sensor));
-  behavior_list.push_back((Behavior*)new line_follow(scoutname, sensor));
-  behavior_list.push_back((Behavior*)new wl_test(scoutname, sensor));
-  behavior_list.push_back((Behavior*)new maze_solve(scoutname, sensor));
+  behavior_list.push_back(behavior<pause_scout>);
+  behavior_list.push_back(behavior<draw_cw_circle>);
+  behavior_list.push_back(behavior<draw_ccw_circle>);
+  behavior_list.push_back(behavior<Odometry>);
+  behavior_list.push_back(behavior<navigationMap>);
+  behavior_list.push_back(behavior<Scheduler>);
+  behavior_list.push_back(behavior<WH_Robot>);
+  behavior_list.push_back(behavior<line_follow>);
+  behavior_list.push_back(behavior<wl_test>);
+  behavior_list.push_back(behavior<maze_solve>);
   return;
 }
 
diff --git a/scout/libscout/src/BehaviorList.h b/scout/libscout/src/BehaviorList.h
index a27e9bd..95254ca 100644
--- a/scout/libscout/src/BehaviorList.h
+++ b/scout/libscout/src/BehaviorList.h
@@ -3,6 +3,7 @@
 
 #include "Behavior.h"
 #include "behaviors/line_follow.h"
+#include "behaviors/priya_draw_name.h"
 #include "behaviors/draw_cw_circle.h"
 #include "behaviors/draw_ccw_circle.h"
 #include "behaviors/Odometry.h"
@@ -14,13 +15,17 @@
 #include "behaviors/maze_solve.h"
 #include "Sensors.h"
 
+template<typename T> Behavior* behavior(std::string scoutname, Sensors* sensors){ return (Behavior*)new T(scoutname, sensors); } 
+
+typedef Behavior* (* behavior_func)(std::string, Sensors*);
+
 class BehaviorList
 {
   public:
-  std::vector<Behavior*> behavior_list;
+  std::vector<behavior_func> behavior_list;
 
   //Constructor. Initializes behavior_list
-  BehaviorList(std::string scoutname, Sensors* sensor);
+  BehaviorList();
   //Destructor. Frees behavior_list;
   ~BehaviorList();
 };
diff --git a/scout/libscout/src/BehaviorProcess.cpp b/scout/libscout/src/BehaviorProcess.cpp
index 4abe992..311f87a 100644
--- a/scout/libscout/src/BehaviorProcess.cpp
+++ b/scout/libscout/src/BehaviorProcess.cpp
@@ -61,11 +61,12 @@ int main (int argc, char **argv)
         ros::init(argc, argv, scoutname + "_behavior");
         // one Sensor instance per-class
         Sensors* sensors = new Sensors(scoutname);
-        BehaviorList* list = new BehaviorList(scoutname, sensors);
-        vector<Behavior*> behavior_list = list->behavior_list;
+        BehaviorList* list = new BehaviorList();
+        vector<behavior_func> behavior_list = list->behavior_list;
         if (behavior_num < (int)behavior_list.size())
         {
-            (behavior_list[behavior_num])->run();
+            Behavior* b = behavior_list[behavior_num](scoutname, sensors);
+            b->run();
         }
         else
         {
diff --git a/scout/libscout/src/behaviors/pause_scout.cpp b/scout/libscout/src/behaviors/pause_scout.cpp
index 55aa67a..b3a5ecc 100644
--- a/scout/libscout/src/behaviors/pause_scout.cpp
+++ b/scout/libscout/src/behaviors/pause_scout.cpp
@@ -27,7 +27,7 @@
 
 void pause_scout::run()
 {
-  while(ok()){
-	  motors->set_sides(0, 0, MOTOR_ABSOLUTE);
-  }
+  motors->set_sides(0, 0, MOTOR_ABSOLUTE);
+  spinOnce();
+  loop_rate->sleep();
 }
