commit 751d4f4fca7ad338301c065f7b3ad680c3570e6c
Author: Alex <azirbel@andrew.cmu.edu>
Date:   Sun Apr 28 14:58:23 2013 -0400

    Made danger_marking depend on Odometry correctly

diff --git a/scout/libscout/src/behaviors/Odometry.cpp b/scout/libscout/src/behaviors/Odometry.cpp
index 06fbd32..0c2f3e2 100644
--- a/scout/libscout/src/behaviors/Odometry.cpp
+++ b/scout/libscout/src/behaviors/Odometry.cpp
@@ -4,8 +4,17 @@
 using namespace std;
 
 /** Set up the odometry node and prepare communcations over ROS */
-Odometry::Odometry(string scoutname, Sensors* sensors):Behavior(scoutname, 
-                                                "odometry", sensors)
+Odometry::Odometry(string scoutname, Sensors* sensors)
+    : Behavior(scoutname, "odometry", sensors)
+{
+  name = scoutname;
+  scout_pos = new pos;
+  motor_fl_ticks = motor_fr_ticks = motor_bl_ticks = motor_br_ticks = 0;
+}
+
+/** Set up the odometry node and prepare communcations over ROS */
+Odometry::Odometry(string scoutname, string behavior_name, Sensors* sensors)
+    : Behavior(scoutname, behavior_name, sensors)
 {
   name = scoutname;
   scout_pos = new pos;
diff --git a/scout/libscout/src/behaviors/Odometry.h b/scout/libscout/src/behaviors/Odometry.h
index 5346e6b..526dbdb 100644
--- a/scout/libscout/src/behaviors/Odometry.h
+++ b/scout/libscout/src/behaviors/Odometry.h
@@ -12,43 +12,48 @@
 #define ENCODER_COUNT (2*WHEEL_RADIUS*350*M_PI/WHEEL_BASE)
 #define DIST_PER_TICK (WHEEL_CIRCUM/ENCODER_COUNT)
 
-class Odometry : Behavior{
+class Odometry : public Behavior {
 
-  public:
+    public:
 
-  /** Set up the odometry node and prepare communcations over ROS */
-  Odometry(std::string scoutname, Sensors* sensors);
+        /** Set up the odometry node and prepare communcations over ROS */
+        Odometry(std::string scoutname, Sensors* sensors);
 
-  /** Query encoders and estimate position based on encoder reading */
-  void get_position();
+        /** Set up the odometry node and prepare communcations over ROS */
+        Odometry(std::string scoutname, std::string behavior_name, Sensors* sensors);
 
-  /** Gets scout position and prints to screen */
-  void run();
-  
-  private:
+        /** Query encoders and estimate position based on encoder reading */
+        void get_position();
 
-    /** ROS publisher and client declaration */
-    ros::NodeHandle node;
-    ros::Publisher scout_position;
-    ros::ServiceClient query_encoders_client;
-    messages::ScoutPosition position;
+        /** Gets scout position and prints to screen */
+        void run();
 
-    std::string name;
+    protected:
 
-    float msg_time_in;
+        pos* scout_pos;
 
-    int motor_fl_dist;
-    int motor_fr_dist;
-    int motor_bl_dist;
-    int motor_br_dist;
+    private:
 
-    unsigned int motor_fl_ticks;
-    unsigned int motor_fr_ticks;
-    unsigned int motor_bl_ticks;
-    unsigned int motor_br_ticks;
-    float scout_theta;
+        /** ROS publisher and client declaration */
+        ros::NodeHandle node;
+        ros::Publisher scout_position;
+        ros::ServiceClient query_encoders_client;
+        messages::ScoutPosition position;
 
-    pos* scout_pos;
+        std::string name;
+
+        float msg_time_in;
+
+        int motor_fl_dist;
+        int motor_fr_dist;
+        int motor_bl_dist;
+        int motor_br_dist;
+
+        unsigned int motor_fl_ticks;
+        unsigned int motor_fr_ticks;
+        unsigned int motor_bl_ticks;
+        unsigned int motor_br_ticks;
+        float scout_theta;
 };
 
 #endif
diff --git a/scout/libscout/src/test_behaviors/danger_marking.cpp b/scout/libscout/src/test_behaviors/danger_marking.cpp
index d7f1d61..e39687c 100644
--- a/scout/libscout/src/test_behaviors/danger_marking.cpp
+++ b/scout/libscout/src/test_behaviors/danger_marking.cpp
@@ -37,7 +37,7 @@ void danger_marking::run()
     // Turn the sonar on.
     sonar->set_on();
     wait(1.5);
-    sonar->set_single(36);
+    sonar->set_range(35, 37);
 
     motors->set_sides(-20, -20);
 
@@ -45,6 +45,10 @@ void danger_marking::run()
 
     while (true)
     {
+        get_position();
+        ROS_INFO("Position: (%f, %f, %f).",
+            scout_pos->x, scout_pos->y, scout_pos->theta);
+
         int *readings = sonar->get_sonar_readings();
         dist = min(readings[35], min(readings[36], readings[37]));
 
diff --git a/scout/libscout/src/test_behaviors/danger_marking.h b/scout/libscout/src/test_behaviors/danger_marking.h
index 3bd09b3..d411486 100644
--- a/scout/libscout/src/test_behaviors/danger_marking.h
+++ b/scout/libscout/src/test_behaviors/danger_marking.h
@@ -27,17 +27,16 @@
 #define _DANGER_MARKING_H_
 
 #include <stdio.h>
-#include "../Behavior.h"
-#include "../Sensors.h"
+#include "../behaviors/Odometry.h"
 
 /**
  * A very simple maze solver that always turns right.
  */
-class danger_marking : public Behavior
+class danger_marking : public Odometry
 {
     public:
         danger_marking(std::string scoutname, Sensors* sensors):
-            Behavior(scoutname, "danger_marking", sensors) {};
+            Odometry(scoutname, "danger_marking", sensors) {};
         void run();
 };
 #endif
