00001 00023 #include <signal.h> 00024 #include <time.h> 00025 #include "micros_swarm/runtime_core.h" 00026 00027 boost::shared_ptr<micros_swarm::RuntimeCore> rtp_core_; 00028 00029 void rtpManagerDestroySigintHandler(int sig) 00030 { 00031 // Do some custom action. 00032 // For example, publish a stop message to some other nodes. 00033 // All the default sigint handler does is call shutdown() 00034 rtp_core_->shutdown(); 00035 rtp_core_.reset(); 00036 ros::shutdown(); 00037 } 00038 00039 int main(int argc, char** argv) 00040 { 00041 ros::init(argc, argv, "micros_swarm_framework_rtp_node"); 00042 00043 rtp_core_.reset(new micros_swarm::RuntimeCore()); 00044 rtp_core_->initialize(); 00045 00046 // Override the default ros sigint handler. 00047 // This must be set after the first NodeHandle is created. 00048 signal(SIGINT, rtpManagerDestroySigintHandler); 00049 00050 boost::thread t = boost::thread(boost::bind(&ros::spin)); 00051 t.join(); 00052 return 0; 00053 } 00054