ServerTracker.cpp
Go to the documentation of this file.
00001 /*
00002  * ServerTracker.cpp
00003  *
00004  *  Created on: Jan 9, 2012
00005  *      Author: mriedel
00006  */
00007 
00008 #include <telekyb_base/TeleKyb.hpp>
00009 
00010 #include <telekyb_vrpn/VRPNTrackerServer.hpp>
00011 #include <telekyb_vrpn/VRPNTrackerServerOptions.hpp>
00012 
00013 #include <vrpn_Connection.h>
00014 
00015 using namespace TELEKYB_NAMESPACE;
00016 
00017 int main(int argc, char **argv) {
00018         TeleKyb::init(argc,argv,"VRPNClientServer");
00019 
00020         VRPNTrackerServerOptions* options = new VRPNTrackerServerOptions();
00021 
00022         std::vector<std::string> serverTopicNames = options->tVRPNTopicNames->getValue();
00023         std::vector<VRPNTrackerServer*> servers(serverTopicNames.size());
00024 
00025         vrpn_Connection *c = vrpn_create_server_connection();
00026 
00027         for (unsigned int i = 0; i < serverTopicNames.size(); ++i) {
00028                 servers[i] = new VRPNTrackerServer(serverTopicNames[i], c);
00029         }
00030 
00031         while(ros::ok()) {
00032                 for (unsigned int i = 0; i < serverTopicNames.size(); ++i) {
00033                         servers[i]->spin();
00034                 }
00035 
00036                 usleep(10);
00037         }
00038 
00039         // wait for shutdown.
00040         ros::waitForShutdown();
00041 
00042         for (unsigned int i = 0; i < serverTopicNames.size(); ++i) {
00043                 delete servers[i];
00044         }
00045 
00046         delete options;
00047 
00048         TeleKyb::shutdown();
00049         return EXIT_SUCCESS;
00050 }
00051 
00052 
00053 
00054 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends


telekyb_vrpn
Author(s): Martin Riedel
autogenerated on Mon Nov 11 2013 11:14:04