00001 /*************************************************************** 00002 00003 Mini Grand Challenge 2010 00004 Pennsylvania State University - Robotics Club 00005 Learn more at www.psurobotics.org 00006 Protected by the GNU General Public License 00007 00008 This source file is developed and maintained by: 00009 + Erich Stoekl ems5311@psu.edu 00010 + Jeremy Bridon jgbridon@gmail.com 00011 00012 File: ObserverInterface.cpp/h 00013 Desc: An observer client that prints out statistics information 00014 of all components that are defined for in the associated observer 00015 interface configuration file. All components that derive from 00016 "BaseComponent" will spit back important performance data. See 00017 "BaseComponent.h" for that information. 00018 00019 To "observe" a component, simply write "component[index] [component_name]" 00020 to this component's configuration file. The component index must be 00021 from 0 to any value, increasing by one. For example: 00022 00023 component0 WaypointeInterface 00024 component1 CamVisionInterface 00025 component2 MainController 00026 00027 Doing this will have this observer client observe the statistics of 00028 Waypointe, CamVision, and Main controller components. 00029 00030 ***************************************************************/ 00031 00032 // Inclusion guard 00033 #ifndef __OBSERVER_INTERFACE_H 00034 #define __OBSERVER_INTERFACE_H 00035 00036 // Includes 00037 #include "../Shared/Utilities.h" 00038 #include "../Shared/BaseComponent.h" 00039 #include "../Shared/Vector2.h" 00040 #include "../Shared/List.h" 00041 #include <GL/freeglut.h> 00042 //#include <GL/glui.h> 00043 00045 void ResizeHandle(int width, int height); 00046 void KeyHandle(unsigned char key, int x, int y); 00047 00049 class Observer : public BaseComponent 00050 { 00051 00052 public: 00053 00055 Observer(int argc, char* argv[]); 00056 00058 ~Observer(); 00059 00060 protected: 00061 00063 int Update(); 00064 00065 // Internal render function, does all rendering work when called by our external OpenGL hook; This is done such that we can directly access internal resources 00066 void Render(); 00067 00069 void RenderUpdateIcon(); 00070 00071 private: 00072 00074 // void KeyHandle(unsigned char key, int x, int y); 00075 00076 // Defined constants 00077 static const int MAX_QUEUE_SIZE = 32; 00078 00079 // Queue information 00080 float (*CycleTimeQueue)[MAX_QUEUE_SIZE]; 00081 unsigned int (*CycleTimeStamp)[2]; 00082 int* CycleTimeIndex; 00083 float* CycleTimeMaxValue; 00084 float* CycleTimeMinValue; 00085 int* CycleTimeCounter; 00086 00087 float (*InputTimeQueue)[MAX_QUEUE_SIZE]; 00088 unsigned int (*InputTimeStamp)[2]; 00089 int* InputTimeIndex; 00090 float InputTimeMaxValue; 00091 float InputTimeMinValue; 00092 00093 int (*CycleCountQueue)[MAX_QUEUE_SIZE]; 00094 unsigned int (*CycleCountStamp)[2]; 00095 int CycleCountIndex; 00096 00097 // GLUI *glui; 00098 00099 int MainWindow; // Contains location of main GUI window. Set in constructor. 00100 00101 int DepCount; // Keeps track of how many dependencies there are. 00102 char** DepName; // Stores each dependency (from the cfg file) name. 00103 00104 }; 00105 00106 // End of inclusion guard 00107 #endif
1.5.5