commit a38fa86943157d18d03b6bb508d695076dfa7d97
Author: Yuyang Guo <yuyang@yuyang-VirtualBox.(none)>
Date:   Sun Apr 14 14:30:44 2013 -0400

    wrote metal detector class and messages. Untested.

diff --git a/scout/libscout/CMakeLists.txt b/scout/libscout/CMakeLists.txt
index 9482a40..50cd3cf 100644
--- a/scout/libscout/CMakeLists.txt
+++ b/scout/libscout/CMakeLists.txt
@@ -37,7 +37,7 @@ FILE(GLOB BEHAVIOR_FILES "${PROJECT_SOURCE_DIR}/src/behaviors/*.cpp")
 FILE(GLOB TEST_BEHAVIOR_FILES "${PROJECT_SOURCE_DIR}/src/test_behaviors/*.cpp")
 FILE(GLOB HELPER_FILES "${PROJECT_SOURCE_DIR}/src/helper_classes/*.cpp")
 
-set(CONTROL_CLASSES src/MotorControl.cpp src/SonarControl.cpp src/HeadlightControl.cpp src/ButtonControl.cpp src/WirelessSender.cpp src/WirelessReceiver.cpp src/EncodersControl.cpp src/LinesensorControl.cpp)
+set(CONTROL_CLASSES src/MotorControl.cpp src/SonarControl.cpp src/HeadlightControl.cpp src/ButtonControl.cpp src/WirelessSender.cpp src/WirelessReceiver.cpp src/EncodersControl.cpp src/LinesensorControl.cpp src/MetalDetectorControl.cpp)
 
 rosbuild_add_executable(libscout ${MAIN_FILES} ${BEHAVIOR_FILES} ${TEST_BEHAVIOR_FILES} ${CONTROL_CLASSES} ${HELPER_FILES})
 rosbuild_add_compile_flags(libscout -std=c++0x)
diff --git a/scout/libscout/src/MetalDetectorControl.cpp b/scout/libscout/src/MetalDetectorControl.cpp
new file mode 100644
index 0000000..2bb7996
--- /dev/null
+++ b/scout/libscout/src/MetalDetectorControl.cpp
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2011 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * @file EncodersControl.cpp
+ * @brief Contains encoder function implementation
+ * 
+ * @author Colony Project, CMU Robotics Club
+ * @author Yuyang Guo
+ */
+
+#include "MetalDetectorControl.h"
+
+using namespace std;
+
+/**
+ * @brief Initialize the Metal Detector module of libscout
+ */
+MetalDetectorControl::MetalDetectorControl(const ros::NodeHandle& libscout_node,
+                string scoutname)
+    : node(libscout_node)
+{
+    query_client = 
+            node.serviceClient< ::messages::query_metal_detector>(
+                    scoutname+"/query_metal_detector");
+}
+
+/**
+ * @brief query the metal detector and return the value
+ */
+bool MetalDetectorControl::query()
+{
+    ::messages::query_metal_detector srv;
+    bool metal;
+
+    if (!query_client.call(srv))
+    {
+        ROS_ERROR("MetalDetectorControl query failed.");
+    }
+    metal = srv.response.metal;
+
+    return metal;
+}
diff --git a/scout/libscout/src/MetalDetectorControl.h b/scout/libscout/src/MetalDetectorControl.h
new file mode 100644
index 0000000..55d0408
--- /dev/null
+++ b/scout/libscout/src/MetalDetectorControl.h
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2011 Colony Project
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * @file MetalDetectorControl.h
+ * @brief Contains metal detector declarations and functions
+ *
+ * @author Colony Project, CMU Robotics Club
+ * @author Yuyang Guo
+ **/
+
+#ifndef _METALDETECTOR_CONTROL_H_
+#define _METALDETECTOR_CONTROL_H_
+
+#include <ros/ros.h>
+#include <messages/query_metal_detector.h>
+class MetalDetectorControl
+{
+    public:
+        /** Set up the metal detector class and prepare to 
+            communicate over ROS*/
+        MetalDetectorControl(const ros::NodeHandle& libscout_node,
+                            std::string scoutname);
+        
+        /** Get MetalDetector reading through ROS */
+        bool query();
+    
+    private:
+        
+        /* ROS publisher and client declaration */
+        ros::ServiceClient query_client;
+        ros::NodeHandle node;
+
+};
+
+#endif
diff --git a/scout/messages/srv/query_metal_detector.srv b/scout/messages/srv/query_metal_detector.srv
new file mode 100644
index 0000000..2055552
--- /dev/null
+++ b/scout/messages/srv/query_metal_detector.srv
@@ -0,0 +1,3 @@
+---
+#true if metal is detected
+bool metal
