commit cad1ab0c981f4f0719e919c0e4e3ef7d103835aa
Author: Ben Wasserman <bwasserm@andrew.cmu.edu>
Date:   Thu Nov 10 16:56:36 2011 -0500

    Created ROS skeleton for Headlights node. Currently has functionality for getting headlights set via a message and setting some variables to the message contents, but doesn't write to hardware. Also does not include code in libscout to support headlights yet.
    Also, I haven't tried compiling this, but I didn't see any syntax errors. I'll compile it when I have a working ROS install.

diff --git a/scout/headlights/CMakeLists.txt b/scout/headlights/CMakeLists.txt
new file mode 100644
index 0000000..9e86a61
--- /dev/null
+++ b/scout/headlights/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 2.4.6)
+include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
+
+# Set the build type.  Options are:
+#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
+#  Debug          : w/ debug symbols, w/o optimization
+#  Release        : w/o debug symbols, w/ optimization
+#  RelWithDebInfo : w/ debug symbols, w/ optimization
+#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
+#set(ROS_BUILD_TYPE RelWithDebInfo)
+
+rosbuild_init()
+
+#set the default path for built executables to the "bin" directory
+set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
+#set the default path for built libraries to the "lib" directory
+set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
+
+#uncomment if you have defined messages
+rosbuild_genmsg()
+#uncomment if you have defined services
+#rosbuild_gensrv()
+
+#common commands for building c++ executables and libraries
+#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
+#target_link_libraries(${PROJECT_NAME} another_library)
+#rosbuild_add_boost_directories()
+#rosbuild_link_boost(${PROJECT_NAME} thread)
+#rosbuild_add_executable(example examples/example.cpp)
+#target_link_libraries(example ${PROJECT_NAME})
+
+rosbuild_add_executable(headlights_node src/headlights.cpp)
diff --git a/scout/headlights/Makefile b/scout/headlights/Makefile
new file mode 100644
index 0000000..bbd3fc6
--- /dev/null
+++ b/scout/headlights/Makefile
@@ -0,0 +1 @@
+include $(shell rospack find mk)/cmake.mk
diff --git a/scout/headlights/mainpage.dox b/scout/headlights/mainpage.dox
new file mode 100644
index 0000000..efd4324
--- /dev/null
+++ b/scout/headlights/mainpage.dox
@@ -0,0 +1,26 @@
+/**
+\mainpage
+\htmlinclude manifest.html
+
+\b headlights is the ROS node that will control the multicolor headlights on scout
+
+<!-- 
+Headlights will contain the functions necessary for controling the headlights
+-->
+
+
+\section codeapi Code API
+
+<!--
+Provide links to specific auto-generated API documentation within your
+package that is of particular interest to a reader. Doxygen will
+document pretty much every part of your code, so do your best here to
+point the reader to the actual API.
+
+If your codebase is fairly large or has different sets of APIs, you
+should use the doxygen 'group' tag to keep these APIs together. For
+example, the roscpp documentation has 'libros' group.
+-->
+
+
+*/
diff --git a/scout/headlights/manifest.xml b/scout/headlights/manifest.xml
new file mode 100644
index 0000000..93bde7b
--- /dev/null
+++ b/scout/headlights/manifest.xml
@@ -0,0 +1,15 @@
+<package>
+  <description brief="headlights">
+     motors
+     Module to drive the headlights and provide all headlights functionality.
+  </description>
+  <author>Ben Wasserman</author>
+  <license>BSD</license>
+  <review status="unreviewed" notes=""/>
+  <url>https://www.roboticsclub.org/redmine/projects/colonyscout/wiki</url>
+  <depend package="roscpp"/>
+  <depend package="std_msgs"/>
+
+</package>
+
+
diff --git a/scout/headlights/msg/set_headlights.msg b/scout/headlights/msg/set_headlights.msg
new file mode 100644
index 0000000..35f5c89
--- /dev/null
+++ b/scout/headlights/msg/set_headlights.msg
@@ -0,0 +1,7 @@
+Header header
+int8 left_red
+int8 left_green
+int8 left_blue
+int8 right_red
+int8 right_green
+int8 right_blue
diff --git a/scout/headlights/src/headlights.cpp b/scout/headlights/src/headlights.cpp
new file mode 100644
index 0000000..1a9ce7c
--- /dev/null
+++ b/scout/headlights/src/headlights.cpp
@@ -0,0 +1,129 @@
+/**
+ * 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 headlights.cpp
+ * @brief Contains code to control the headlights.
+ *
+ * Implementation of functions for headlights use.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#include "ros/ros.h"
+#include "headlights.h"
+//#include "libscout/src/constants.h"
+#include <cstdlib>
+
+/**
+ * @defgroup headlights headlights
+ * @brief Functions for using the headlights
+ *
+ * @{
+ **/
+
+/* Headlight state variables
+ * Each color intensity is stored as a value out of the max bunary value that 
+ * can be written to the output pins that control the LEDs.
+ */
+/** @todo Fix types: static */
+struct headlight
+{
+	char red;
+	char green;
+	char blue;
+};
+headlight left, right;
+
+/**
+ * @brief Sets headlight colors
+ *
+ * Sets the headlight colors based on subscription to the set_headlights topic.
+ *
+ * @param msg The message from the set_headlights topic, containing colors.
+ */
+void headlights_set(const headlights::set_headlights::ConstPtr& msg)
+{
+		/* Set state variables from message */
+		if(msg.left_red > NO_SET)
+		{
+			left.red = msg.left_red;
+		}
+		if(msg.left_green > NO_SET)
+		{
+			left.green = msg.left_green;
+		}
+		if(msg.left_blue > NO_SET)
+		{
+			left.blue = msg.left_blue;
+		}
+		if(msg.right_red > NO_SET)
+		{
+			right.red = msg.right_red;
+		}
+		if(msg.right_green > NO_SET)
+		{
+			right.green = msg.right_green;
+		}
+		if(msg.right_blue > NO_SET)
+		{
+			right.blue = msg.right_blue;
+		}
+		
+    /* Write colors to hardware */
+    /** @todo Add code to write colors to hardware */
+}
+
+/**
+ * @brief headlights driver. This is a ROS node that controls headlight colors.
+ *
+ * This is the main function for the headlights node. It is run when the node
+ * starts and initializes the headlights. It then subscribes to the
+ * set_headlights topic.
+ * 
+ * @param argc The number of command line arguments (should be 1)
+ * @param argv The array of command line arguments
+ **/
+int main(int argc, char **argv)
+{
+    /* Initialize in ROS the headlights driver node */
+    ros::init(argc, argv, "headlights_driver");
+
+    /* Create the nodehandle for this node*/
+    ros::NodeHandle n;
+
+    /* Subscribe to the set_headlights topic */
+    ros::Subscriber sub0 = n.subscribe("set_headlights", QUEUE_SIZE, headlights_set);
+
+    /* Initialize hardware for headlights */
+    // Hardware init functions here
+
+    ROS_INFO("Ready to set headlights.");
+    ros::spin();
+
+    return 0;
+}
+
+/** @} **/
diff --git a/scout/headlights/src/headlights.h b/scout/headlights/src/headlights.h
new file mode 100644
index 0000000..9aac3fe
--- /dev/null
+++ b/scout/headlights/src/headlights.h
@@ -0,0 +1,57 @@
+/**
+ * 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 headlights.h
+ * @brief Contains motor declarations and functions.
+ * 
+ * Contains functions and definitions for the use of
+ * headlights.
+ *
+ * @author Colony Project, CMU Robotics Club
+ **/
+
+#ifndef _HEADLIGHTS_H_
+#define _HEADLIGHTS_H_
+
+#include "headlights/set_headlights.h"
+
+#define FULL 0xFF
+#define HALF 0xC0
+#define OFF  0x00
+#define NO_SET -1
+
+/* The number of messages in the queue. If messages arrive faster than they are
+ * handled, old ones are thrown out */
+#define QUEUE_SIZE 4
+
+
+/** @brief Initialize the headlights module and driver. **/
+int main(int argc, char **argv);
+
+/** @brief Responds to topic to set motor speeds and configs. **/
+void headlights_set(const headlights::set_headlights::ConstPtr& msg);
+
+#endif
