00001 00022 #include "uga_tum_ardrone_gui.h" 00023 #include "RosThread.h" 00024 #include "PingThread.h" 00025 00026 #include <QtGui> 00027 #include <QApplication> 00028 #include "ros/ros.h" 00029 00030 // this global var is used in getMS(ros::Time t) to convert to a consistent integer timestamp used internally pretty much everywhere. 00031 // kind of an artifact from Windows-Version, where only that was available / used. 00032 unsigned int ros_header_timestamp_base = 0; 00033 00034 int main(int argc, char *argv[]) 00035 { 00036 std::cout << "Starting drone_gui Node" << std::endl; 00037 00038 // ROS 00039 ros::init(argc, argv, "drone_gui"); 00040 RosThread t; 00041 PingThread p; 00042 00043 // UI 00044 QApplication a(argc, argv); 00045 uga_tum_ardrone_gui w; 00046 00047 // make them communicate with each other 00048 t.gui = &w; 00049 w.rosThread = &t; 00050 p.gui = &w; 00051 p.rosThread = &t; 00052 w.pingThread = &p; 00053 00054 00055 dynamic_reconfigure::Server<uga_tum_ardrone::GUIParamsConfig> srv; 00056 dynamic_reconfigure::Server<uga_tum_ardrone::GUIParamsConfig>::CallbackType f; 00057 f = boost::bind(&uga_tum_ardrone_gui::dynConfCb, &w, _1, _2); 00058 srv.setCallback(f); 00059 00060 // start them. 00061 t.startSystem(); 00062 p.startSystem(); 00063 w.show(); 00064 00065 // wait until windows closed.... 00066 int ec = a.exec(); 00067 00068 // stop ROS again.... 00069 t.stopSystem(); 00070 p.stopSystem(); 00071 00072 std::cout << "Exiting drone_gui Node" << std::endl; 00073 00074 return ec; 00075 }