00001 #pragma once 00002 00022 #ifndef __PINGTHREAD_H 00023 #define __PINGTHREAD_H 00024 00025 00026 #include "cvd/thread.h" 00027 #include <string> 00028 00029 00030 class uga_tum_ardrone_gui; 00031 class RosThread; 00032 00033 00034 class PingThread : private CVD::Thread 00035 { 00036 private: 00037 // the associated thread's run function. 00038 void run(); 00039 00040 // keep Running 00041 bool keepRunning; 00042 bool started; 00043 00044 // buffers 00045 char pingCommand500[100]; 00046 char pingCommand20000[100]; 00047 char line1[200]; 00048 char line2[200]; 00049 std::string ip; 00050 00051 00052 // running averages 00053 double p500; 00054 double p20000; 00055 00056 static const double p500Default = 25; 00057 static const double p20000Default = 50; 00058 public: 00059 PingThread(void); 00060 ~PingThread(void); 00061 00062 // start and stop system and respective thread. 00063 // to be called externally 00064 void startSystem(); 00065 void stopSystem(); 00066 00067 void setIp(std::string); 00068 00069 // start and stop pinging 00070 void setEnabled(bool); 00071 00072 uga_tum_ardrone_gui* gui; 00073 RosThread* rosThread; 00074 bool measure; 00075 }; 00076 00077 #endif /* __PINGTHREAD_H */