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