commit 9c0008d04908747e904f4af7a5819eba03b9f7f1
Author: Leon <leon@leon-VirtualBox.(none)>
Date:   Tue Jan 24 21:36:55 2012 -0500

    Fixed CliffsensorControl, now actually part of Behaviors

diff --git a/scout/libscout/CMakeLists.txt b/scout/libscout/CMakeLists.txt
index 7e2d1cb..9257467 100644
--- a/scout/libscout/CMakeLists.txt
+++ b/scout/libscout/CMakeLists.txt
@@ -29,4 +29,4 @@ set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
 #rosbuild_add_executable(example examples/example.cpp)
 #target_link_libraries(example ${PROJECT_NAME})
 
-rosbuild_add_executable(libscout src/Behavior.cpp src/behaviors/draw_cw_circle.cpp src/behaviors/draw_ccw_circle.cpp src/BehaviorList.cpp src/BehaviorProcess.cpp src/MotorControl.cpp src/SonarControl.cpp src/HeadlightControl.cpp src/ButtonControl.cpp)
+rosbuild_add_executable(libscout src/Behavior.cpp src/behaviors/draw_cw_circle.cpp src/behaviors/draw_ccw_circle.cpp src/BehaviorList.cpp src/BehaviorProcess.cpp src/MotorControl.cpp src/SonarControl.cpp src/HeadlightControl.cpp src/ButtonControl.cpp src/CliffsensorControl.cpp)
diff --git a/scout/libscout/manifest.xml b/scout/libscout/manifest.xml
index 7f8f947..1525ce4 100644
--- a/scout/libscout/manifest.xml
+++ b/scout/libscout/manifest.xml
@@ -14,6 +14,7 @@
   <depend package="headlights"/>
   <depend package="buttons"/>
   <depend package="sonar"/>
+  <depend package="cliffsensor"/>
 
 </package>
 
diff --git a/scout/libscout/src/Behavior.cpp b/scout/libscout/src/Behavior.cpp
index 4bde10f..54022fa 100644
--- a/scout/libscout/src/Behavior.cpp
+++ b/scout/libscout/src/Behavior.cpp
@@ -53,6 +53,7 @@ Behavior::Behavior(string scoutname)
     motors = new MotorControl(node, scoutname);
     buttons = new ButtonControl(node, scoutname);
     sonar = new SonarControl(node, scoutname);
+    cliffsensor = new CliffsensorControl(node, scoutname);
 
     loop_rate = new ros::Rate(10);
 }
diff --git a/scout/libscout/src/Behavior.h b/scout/libscout/src/Behavior.h
index 432018f..0c5dc5f 100644
--- a/scout/libscout/src/Behavior.h
+++ b/scout/libscout/src/Behavior.h
@@ -43,6 +43,7 @@
 #include "HeadlightControl.h"
 #include "ButtonControl.h"
 #include "SonarControl.h"
+#include "CliffsensorControl.h"
 #include "constants.h"
 
 class Behavior
@@ -64,6 +65,7 @@ class Behavior
         MotorControl * motors;
         ButtonControl * buttons;
         SonarControl * sonar;
+        CliffsensorControl * cliffsensor;
 
         // Wrappers for ROS functions
         bool ok();
diff --git a/scout/libscout/src/CliffsensorControl.cpp b/scout/libscout/src/CliffsensorControl.cpp
index 37c1880..bf14ac9 100644
--- a/scout/libscout/src/CliffsensorControl.cpp
+++ b/scout/libscout/src/CliffsensorControl.cpp
@@ -52,11 +52,12 @@
  * starts and initializes the cliffsensors. It then subscribes to the
  * cliff_status_changed topics
  **/
-CliffsensorControl::CliffsensorControl(const ros::NodeHandle& libscout_node) : node(libscout_node)
+CliffsensorControl::CliffsensorControl(const ros::NodeHandle& libscout_node,
+                                  std::string scoutname) : node(libscout_node)
 {
     /* Subscribe to the cliff_status_changed topic */
     cliff_status_changed_sub = node.subscribe("cliff_status_changed", 
-                                        QUEUE_SIZE, changed_cliff_status);
+                             QUEUE_SIZE, &CliffsensorControl::changed_cliff_status, this);
 
     ros::spin();
 }
@@ -72,9 +73,9 @@ CliffsensorControl::CliffsensorControl(const ros::NodeHandle& libscout_node) : n
  */
 void CliffsensorControl::changed_cliff_status(const cliffsensor::cliff_status_changed::ConstPtr& msg)
 {
-    front_raw = msg.front_raw;
-    left_raw = msg.left_raw;
-    right_raw = msg.right_raw;
+    front_raw = msg->front_raw;
+    left_raw = msg->left_raw;
+    right_raw = msg->right_raw;
     return;
 }
 
diff --git a/scout/libscout/src/CliffsensorControl.h b/scout/libscout/src/CliffsensorControl.h
index 5d0b5bf..43c8897 100644
--- a/scout/libscout/src/CliffsensorControl.h
+++ b/scout/libscout/src/CliffsensorControl.h
@@ -38,8 +38,9 @@
 #ifndef _CLIFFSENSOR_H_
 #define _CLIFFSENSOR_H_
 
-#include "cliffsensor/query_cliff.h"
-#include "cliffsensor/cliff_status_changed.h"
+#include <cliffsensor/query_cliff.h>
+#include <cliffsensor/cliff_status_changed.h>
+#include "constants.h"
 
 #define CLIFF_DETECTED 0x0
 #define NO_CLIFF 0x1
@@ -47,10 +48,11 @@
 class CliffsensorControl
 {
     public:
-        CliffsensorControl::CliffsensorControl(const ros::NodeHandle& libscout_node) ;
+        CliffsensorControl(const ros::NodeHandle& libscout_node, std::string scoutname);
 
         /** @brief Responds to topic to change cliff sensor status. **/
-        void changed_cliff_status(const cliffsensor::cliff_status_changed::ConstPtr& msg);
+        void changed_cliff_status(
+                        const cliffsensor::cliff_status_changed::ConstPtr& msg);
 
         int get_front_raw();
         int get_left_raw();
@@ -60,12 +62,15 @@ class CliffsensorControl
     private:
         /* Cliffsensor state variables
          */
-        int front_raw; /**< The current raw value data of the front cliffsensor. */
-        int left_raw; /**< The current raw value data of the left cliffsensor. */
-        int right_raw; /**< The current raw value data of the right cliffsensor. */
+        int front_raw; /**< The current raw value 
+                        data of the front cliffsensor. */
+        int left_raw; /**< The current raw value data of 
+                        the left cliffsensor. */
+        int right_raw; /**< The current raw value data of 
+                        the right cliffsensor. */
 
         ros::Subscriber cliff_status_changed_sub;
-
-}
+        ros::NodeHandle node; 
+};
 
 #endif
