joy.cpp
Go to the documentation of this file.
00001 /*
00002  * joy.cpp
00003  *
00004  *  Created on: Oct 24, 2011
00005  *      Author: mriedel
00006  */
00007 
00008 
00009 #include <telekyb_hid/Joystick.hpp>
00010 #include <telekyb_base/TeleKyb.hpp>
00011 
00012 #include <telekyb_hid/JoystickOptions.hpp>
00013 
00014 #include <hidapi.h>
00015 
00016 using namespace telekyb;
00017 
00018 int main(int argc, char* argv[])
00019 {
00020         TeleKyb::init(argc, argv, "tJoy");
00021 
00022         // Singleton Creation
00023         JoystickOptions* jO = new JoystickOptions();
00024 
00025 
00026         std::vector<Joystick*> joysticks;
00027         Joystick::getJoysticks(jO->tJoystickConfigFile->getValue(), joysticks);
00028 
00029         for (unsigned int i = 0; i < joysticks.size(); ++i) {
00030                 ROS_INFO_STREAM("Starting Joystick Thread for " << joysticks[i]->getName());
00031                 joysticks[i]->startThread();
00032         }
00033 
00034         //ros::waitForShutdown();
00035 
00036 
00037         // cleanup
00038         for (unsigned int i = 0; i < joysticks.size(); ++i) {
00039                 joysticks[i]->joinThread();
00040                 delete joysticks[i];
00041         }
00042 
00043         delete jO;
00044 
00045         TeleKyb::shutdown();
00046         return 0;
00047 }
00048 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Defines


telekyb_hid
Author(s): mriedel
autogenerated on Mon Nov 11 2013 11:14:51