Index: trunk/phidget_ik/CMakeLists.txt
===================================================================
--- trunk/phidget_ik/CMakeLists.txt	(revision 3)
+++ trunk/phidget_ik/CMakeLists.txt	(revision 3)
@@ -0,0 +1,30 @@
+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 src/example.cpp)
+#target_link_libraries(example ${PROJECT_NAME})
Index: trunk/phidget_ik/Makefile
===================================================================
--- trunk/phidget_ik/Makefile	(revision 3)
+++ trunk/phidget_ik/Makefile	(revision 3)
@@ -0,0 +1,1 @@
+include $(shell rospack find mk)/cmake.mk
Index: trunk/phidget_ik/include/phidget_ik/phidget_ik.h
===================================================================
--- trunk/phidget_ik/include/phidget_ik/phidget_ik.h	(revision 3)
+++ trunk/phidget_ik/include/phidget_ik/phidget_ik.h	(revision 3)
@@ -0,0 +1,255 @@
+/**
+ * \file phidget_ik.h
+ * \brief PhidgetInterfaceKit interface class header file
+ * 
+ * Based on the TextLCD class by Tully Foote. 
+ * Most member documentation was copied from the Phidget API manual.
+ * 
+ * \author Wouter Caarls <w.caarls@tudelft.nl>
+ */
+
+#include <phidgetspp.hh>
+
+/// Class for interfacing with the PhidgetInterfaceKit
+/** If you wish to use the InterfaceKit API's callback functions,
+ *  you should subclass this and override the Handler functions:
+ *  attachHandler(), inputChangeHandler(), outputChangeHandler() and sensorChangeHandler().
+ */
+class PhidgetIK : public Phidget
+{
+  public:
+    /// The constructor for the PhidgetInterfaceKit.
+    /** Create a new PhidgetIK interface class */
+	PhidgetIK() :
+	  Phidget((CPhidgetHandle*)&ik_handle_),
+	  ik_handle_(0)
+	{
+      last_error_ = CPhidgetInterfaceKit_create(&ik_handle_);
+      
+      if (!last_error_)
+      {
+    	CPhidget_set_OnAttach_Handler((CPhidgetHandle)ik_handle_, PhidgetIK::attachDelegate, this);
+    	CPhidgetInterfaceKit_set_OnInputChange_Handler(ik_handle_, PhidgetIK::inputChangeDelegate, this);
+    	CPhidgetInterfaceKit_set_OnOutputChange_Handler(ik_handle_, PhidgetIK::outputChangeDelegate, this);
+    	last_error_ = CPhidgetInterfaceKit_set_OnSensorChange_Handler(ik_handle_, PhidgetIK::sensorChangeDelegate, this);
+      }
+	}
+	
+    /// Initialize and connect to a device.
+	/** This will connect to any or a specific PhidgetInterfaceKit
+        @param serial_number The serial number to which to connect (-1 for any) */
+    int init(int serial_number)
+    {
+      return (last_error_ = open(serial_number));
+    }
+    
+    /// Gets the number of digital inputs supported by this board. 
+    int getInputCount()
+    {
+      int count=-1;
+      
+      last_error_ = CPhidgetInterfaceKit_getInputCount(ik_handle_, &count);
+      
+      return count;
+    }
+    
+    /// Gets the state of a digital input. 
+    int getInputState(int index)
+    {
+      int state=-1;
+      
+      last_error_ = CPhidgetInterfaceKit_getInputState(ik_handle_, index, &state);
+      
+      return state;
+    }
+    
+    /// Gets the number of digital outputs supported by this board. 
+    int getOutputCount()
+    {
+      int count=-1;
+      
+      last_error_ = CPhidgetInterfaceKit_getOutputCount(ik_handle_, &count);
+      
+      return count;
+    }
+    
+    /// Gets the state of a digital output. 
+    int getOutputState(int index)
+    {
+      int state=-1;
+      
+      last_error_ = CPhidgetInterfaceKit_getOutputState(ik_handle_, index, &state);
+      
+      return state;
+    }
+    
+    /// Sets the state of a digital output. 
+    int setOutputState(int index, int state)
+    {
+      return (last_error_ = CPhidgetInterfaceKit_setOutputState(ik_handle_, index, state));
+    }
+
+    /// Gets the number of sensor (analog) inputs supported by this board. 
+    int getSensorCount()
+    {
+      int count=-1;
+      
+      last_error_ = CPhidgetInterfaceKit_getSensorCount(ik_handle_, &count);
+      
+      return count;
+    }
+    
+    /// Gets a sensor value (0-1000). 
+    int getSensorValue(int index)
+    {
+      int value=-1;
+      
+      last_error_ = CPhidgetInterfaceKit_getSensorValue(ik_handle_, index, &value);
+      
+      return value;
+    }
+    
+    /// Gets a sensor raw value (12-bit). 
+    int getSensorRawValue(int index)
+    {
+      int value=-1;
+      
+      last_error_ = CPhidgetInterfaceKit_getSensorRawValue(ik_handle_, index, &value);
+      
+      return value;
+    }
+
+    /// Gets a sensor change trigger. 
+    int getSensorChangeTrigger(int index)
+    {
+      int trigger=-1;
+      
+      last_error_ = CPhidgetInterfaceKit_getSensorChangeTrigger(ik_handle_, index, &trigger);
+      
+      return trigger;
+    }
+    
+    /// Sets a sensor change trigger. 
+    int setSensorChangeTrigger(int index, int trigger)
+    {
+      return (last_error_ = CPhidgetInterfaceKit_setSensorChangeTrigger(ik_handle_, index, trigger));
+    }
+    
+    /// Gets the ratiometric state for this board. 
+    int getRatiometric()
+    {
+      int ratiometric=-1;
+      
+      last_error_ = CPhidgetInterfaceKit_getRatiometric(ik_handle_, &ratiometric);
+      
+      return ratiometric;
+    }
+    
+    /// Sets the ratiometric state for this board. 
+    int setRatiometric(int ratiometric)
+    {
+      return (last_error_ = CPhidgetInterfaceKit_setRatiometric(ik_handle_, ratiometric));
+    }
+    
+    /// Gets the Data Rate for an analog input. 
+    int getDataRate(int index)
+    {
+      int datarate=-1;
+      
+      last_error_ = CPhidgetInterfaceKit_getDataRate(ik_handle_, index, &datarate);
+      
+      return datarate;
+    }
+    
+    /// Sets the Data Rate (in ms) for an analog input. 
+    int setDataRate(int index, int datarate)
+    {
+      return (last_error_ = CPhidgetInterfaceKit_setDataRate(ik_handle_, index, datarate));
+    }
+    
+    /// Gets the maximum supported data rate (in ms) for an analog input. 
+    int getDataRateMax(int index)
+    {
+      int max=-1;
+      
+      last_error_ = CPhidgetInterfaceKit_getDataRateMax(ik_handle_, index, &max);
+      
+      return max;
+    }
+    
+    /// Gets the minimum supported data rate (in ms) for an analog input. 
+    int getDataRateMin(int index)
+    {
+      int min=-1;
+      
+      last_error_ = CPhidgetInterfaceKit_getDataRateMin(ik_handle_, index, &min);
+      
+      return min;
+    }
+    
+    /// Returns the last error generated by a CPhidget function.
+    int getLastError()
+    {
+      return last_error_;
+    }
+
+  protected:
+    /// Storage for the CPhidget handle.
+    CPhidgetInterfaceKitHandle ik_handle_;
+    
+    /// Last error generated by a CPhidget function.
+    int last_error_;
+   
+    /// This is called when a PhidgetInterfaceKit is attached
+    /** For overriding. */
+    virtual int attachHandler()
+    {
+      return 0;
+    };
+
+    /// This is called when a digital input changes.
+    /** For overriding. */
+    virtual int inputChangeHandler(int index, int inputState)
+    {
+      return 0;
+    }
+    
+    /// This is called when a digital output changes.
+    /** For overriding. */
+    virtual int outputChangeHandler(int index, int outputState)
+    {
+      return 0;
+    }
+    
+    /// This is called when a sensor value changes by more then the change trigger. 
+    /** For overriding. */
+    virtual int sensorChangeHandler(int index, int sensorValue)
+    {
+      return 0;
+    }
+    
+  private:
+    /// Delegate for calling attachHandler method.
+    static int attachDelegate(CPhidgetHandle phid, void *userptr)
+    {
+      return ((PhidgetIK*)userptr)->attachHandler();
+    };
+
+    /// Delegate for calling inputChangeHandler method.
+    static int inputChangeDelegate(CPhidgetInterfaceKitHandle phid, void *userPtr, int index, int inputState)
+    {
+      return ((PhidgetIK*)userPtr)->inputChangeHandler(index, inputState);
+    }
+    
+    /// Delegate for calling outputChangeHandler method.
+    static int outputChangeDelegate(CPhidgetInterfaceKitHandle phid, void *userPtr, int index, int outputState)
+    {
+      return ((PhidgetIK*)userPtr)->outputChangeHandler(index, outputState);
+    }
+    
+    /// Delegate for calling sensorChangeHandler method.
+    static int sensorChangeDelegate(CPhidgetInterfaceKitHandle phid, void *userPtr, int index, int sensorValue)
+    {
+      return ((PhidgetIK*)userPtr)->sensorChangeHandler(index, sensorValue);
+    }
+};
Index: trunk/phidget_ik/mainpage.dox
===================================================================
--- trunk/phidget_ik/mainpage.dox	(revision 3)
+++ trunk/phidget_ik/mainpage.dox	(revision 3)
@@ -0,0 +1,34 @@
+/**
+\mainpage
+\htmlinclude manifest.html
+
+\b phidget_ik extends phidgetspp to the PhidgetInterfaceKit.
+
+\section note Important notice
+
+The current version (as of 12-7-2011) of phidgetspp uses a deprecated build system. You will need to edit its CMakeLists.txt before building. See the <a href="http://code.google.com/p/foote-ros-pkg/issues/detail?id=25">issue</a>.
+
+In addition, be sure to follow the instructions in <tt>phidgetspp_c_api/build/Phidgetlinux/README</tt> such that the driver is loaded properly.
+
+<!-- 
+Provide an overview of your package.
+-->
+
+
+\section codeapi Code API
+
+Only one class is defined, PhidgetIK. This implements the Phidget class and additional functions for the PhidgetInterfaceKit
+
+<!--
+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.
+-->
+
+
+*/
Index: trunk/phidget_ik/manifest.xml
===================================================================
--- trunk/phidget_ik/manifest.xml	(revision 3)
+++ trunk/phidget_ik/manifest.xml	(revision 3)
@@ -0,0 +1,20 @@
+<package>
+  <description brief="phidget_ik">
+
+     phidget_ik extends phidgetspp to the PhidgetInterfaceKit.
+
+  </description>
+  <author>Wouter Caarls</author>
+  <license>BSD</license>
+  <review status="unreviewed" notes=""/>
+  <url>http://ros.org/wiki/phidget_ik</url>
+  <depend package="phidgetspp"/>
+  <depend package="roscpp"/>
+
+  <export>
+    <cpp cflags="-I${prefix}/include"/>
+  </export>
+        
+</package>
+
+
Index: trunk/phidget_ik/src/example.cpp
===================================================================
--- trunk/phidget_ik/src/example.cpp	(revision 3)
+++ trunk/phidget_ik/src/example.cpp	(revision 3)
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <phidget_ik/phidget_ik.h>
+
+int main(void)
+{
+  PhidgetIK phidget_ik;
+  
+  phidget_ik.init(-1);
+  phidget_ik.waitForAttachment(1000);
+  
+  int inputs = phidget_ik.getInputCount();
+  if (phidget_ik.getLastError())
+  {
+    std::cerr << "Error initializing PhidgetInterfaceKit: " << phidget_ik.getErrorDescription(phidget_ik.getLastError()) << std::endl;
+    return 1;
+  }
+  
+  for (int ii=0; ii != inputs; ii++)
+    std::cout << "Input " << ii << " has state " << phidget_ik.getInputState(ii) << std::endl;
+
+  return 0;
+}
Index: trunk/phidget_ik/stack.xml
===================================================================
--- trunk/phidget_ik/stack.xml	(revision 3)
+++ trunk/phidget_ik/stack.xml	(revision 3)
@@ -0,0 +1,9 @@
+<stack>
+  <description brief="phidge_ik">Phidget InterfaceKit</description>
+  <author>Maintained by Wouter Caarls</author>
+  <license>BSD</license>
+  <review status="unreviewed" notes=""/>
+  <url>http://ros.org/wiki/phidget_ik</url>
+  <depend stack="ros" />
+
+</stack>
