Go to the documentation of this file.00001 #pragma once
00002
00022 #ifndef __MAPVIEW_H
00023 #define __MAPVIEW_H
00024
00025
00026
00027
00028 #include "GLWindow2.h"
00029 #include <deque>
00030 #include "cvd/thread.h"
00031 #include "TooN/se3.h"
00032 #include "MouseKeyHandler.h"
00033
00034
00035 class DroneKalmanFilter;
00036 class PTAMWrapper;
00037 class Predictor;
00038 class EstimationNode;
00039
00040 class TrailPoint
00041 {
00042 public:
00043 inline TrailPoint(TooN::Vector<3> filter)
00044 {
00045 pointFilter = filter;
00046 PTAMValid = false;
00047 }
00048 inline TrailPoint(TooN::Vector<3> filter, TooN::Vector<3> ptam)
00049 {
00050 pointFilter = filter;
00051 pointPTAM = ptam;
00052 PTAMValid = true;
00053 }
00054 TooN::Vector<3> pointPTAM;
00055 TooN::Vector<3> pointFilter;
00056 bool PTAMValid;
00057 };
00058
00059 class MapView : private CVD::Thread, private MouseKeyHandler
00060 {
00061 private:
00062
00063 GLWindow2* myGLWindow;
00064 CVD::ImageRef desiredWindowSize;
00065 CVD::ImageRef defaultWindowSize;
00066 bool changeSizeNextRender;
00067
00068
00069
00070
00071 void run();
00072
00073
00074
00075 void control();
00076
00077
00078 void Render();
00079
00080 DroneKalmanFilter* filter;
00081 PTAMWrapper* ptamWrapper;
00082 EstimationNode* node;
00083
00084 bool resetRequested;
00085
00086
00087 bool keepRunning;
00088
00089 Predictor* predConvert;
00090
00091
00092
00093 char charBuf[1000];
00094 std::string msg;
00095 enum {UI_NONE = 0, UI_DEBUG = 1, UI_PRES = 2} drawUI;
00096 float lineWidthFactor;
00097
00098
00099 void plotMapPoints();
00100 void plotGrid();
00101 void plotKeyframes();
00102 void SetupFrustum();
00103 void SetupModelView(TooN::SE3<> se3WorldFromCurrent = TooN::SE3<>());
00104
00105
00106 TooN::SE3<> mse3ViewerFromWorld;
00107 TooN::Vector<3> mv3MassCenter;
00108 bool resetMapViewFlag;
00109
00110 void plotCam(TooN::SE3<> droneToGlobal, bool xyCross, float thick, float len, float alpha);
00111 void drawTrail();
00112
00113
00114 void ResetInternal();
00115
00116
00117 TooN::Vector<10> lastFramePoseSpeed;
00118 bool inControl;
00119 bool clearTrail;
00120
00121
00122
00123 std::vector<TrailPoint> trailPoints;
00124
00125 public:
00126
00127 MapView(DroneKalmanFilter* f, PTAMWrapper* p, EstimationNode* nde);
00128 ~MapView(void);
00129
00130 bool handleCommand(std::string s);
00131
00132 inline void Reset() {resetRequested = true;};
00133
00134
00135
00136 void on_key_down(int key);
00137
00138
00139
00140
00141
00142 static pthread_mutex_t trailPointsVec_CS;
00143
00144
00145 void startSystem();
00146 void stopSystem();
00147
00148 void resetMapView();
00149 };
00150 #endif
00151