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