00001 00018 #ifndef MAINWINDOW_H 00019 #define MAINWINDOW_H 00020 00021 #include <QMainWindow> 00022 #include <QCheckBox> 00023 #include <QRadioButton> 00024 #include <QLabel> 00025 #include <QPushButton> 00026 #include <QListWidget> 00027 #ifndef Q_MOC_RUN 00028 #include <boost/shared_ptr.hpp> 00029 #endif 00030 00031 #include "VisualisationUtils/markerpublisher.h" 00032 #include "VisualisationUtils/laserscanwidget.h" 00033 #include "laserscanthread.h" 00034 #include "Laserscanner/laserscanner_mild.h" 00035 #include "Laserscanner/laserscanner_lms400.h" 00036 #include <GUI/ptuwindow.h> 00037 #include <calibration_object.h> 00038 #include <MathHelpers/Resectionsolver/resectionsolver.h> 00039 #include <MathHelpers/Resectionsolver/feasibilitychecker.h> 00040 #include <Transformation/transformation_publisher.h> 00041 #include <VisualisationUtils/tfvisualizer.h> 00042 00043 class MainWindow : public QMainWindow 00044 { 00045 Q_OBJECT 00046 public: 00047 explicit MainWindow(QWidget *parent = 0); 00048 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00049 protected: 00050 unsigned int showData; 00051 bool isCapturing; 00052 QCheckBox *chk_rawdata; 00053 QCheckBox *chk_avgData; 00054 QCheckBox *chk_filteredData; 00055 QCheckBox *chk_segments; 00056 QCheckBox *chk_edges; 00057 00058 //Shows the coordinates of all triangles currently detected by the scanner 00059 QLabel *lblTriangles; 00060 //Shows the number of solutions of the p3p problem for the current triangle 00061 QLabel *lblSolutions; 00062 00063 QLabel *lblCurrentTriangle; 00064 00065 QLabel *lblSolutionMatrix; 00066 00067 QLabel *lblPossibleSolutions_Position; 00068 00069 //Shows the variance over all captured poses of the objects top point 00070 QLabel *lblTopPoseVariance; 00071 00072 QPushButton *btnCapture; 00073 QPushButton *btnPossibleSolutions_Left; 00074 QPushButton *btnPossibleSolutions_Right; 00075 QPushButton *btnStartPTUCapture; 00076 QPushButton *btnAddTopPose; 00077 QPushButton *btnDeleteTopPose; 00078 QPushButton *btnClearTopPose; 00079 00080 QListWidget * lstTopPose; 00081 00082 int possibleSolutions_Position; 00083 00084 LaserScanThread *currentThread; 00085 00086 QRadioButton *radio_polar; 00087 QRadioButton *radio_flat; 00088 LaserScanWidget *widget; 00089 00090 std::vector<Eigen::Vector2d, Eigen::aligned_allocator<Eigen::Vector2d> > *currentTriangles; 00091 std::vector<Eigen::Vector2d, Eigen::aligned_allocator<Eigen::Vector2d> > *selectedTriangle; 00092 00093 // 00094 std::vector<Eigen::Vector3d, Eigen::aligned_allocator<Eigen::Vector3d> > *capturedTopPoses; 00095 00096 //All the possible solutions for the current triangle 00097 std::vector<Eigen::Matrix4d, Eigen::aligned_allocator<Eigen::Matrix4d> > * solutionFrames; 00098 00099 boost::shared_ptr<ResectionSolver> solver; 00100 00101 //Used to publish the current results to ros 00102 boost::shared_ptr<MarkerPublisher> markerPublisher; 00103 00104 //Contains all the parameters of the calibration object 00105 boost::shared_ptr<Calibration_Object> calibrationObject; 00106 00107 boost::shared_ptr<FeasibilityChecker> feasibilityChecker; 00108 00109 boost::shared_ptr<Transformation_Publisher> transformationPublisher; 00110 00111 //Used to project the tf frames into the camera image 00112 boost::shared_ptr<TF_Visualizer> tfVisualizer; 00113 00114 void addMatrixRow(QString* text, double value); 00115 void showPossibleSolutions(); 00116 void resizeEvent(QResizeEvent * event); 00117 void toggleCaptureMode(); 00118 void calculateTransformationFrames(); 00119 signals: 00120 void setCurves(unsigned int showData = 1); 00121 void newTransform_Laserscan(const Eigen::Matrix4d& transform, double distanceToTop); 00122 00123 public slots: 00124 void trianglesFound(std::vector<Eigen::Vector2d, Eigen::aligned_allocator<Eigen::Vector2d> > *triangles); 00125 00126 void chk_rawData_stateChanged(bool state); 00127 void chk_avgData_stateChanged(bool state); 00128 void chk_filteredData_stateChanged(bool state); 00129 void chk_segments_stateChanged(bool state); 00130 void chk_edges_stateChanged(bool state); 00131 00132 void radio_polar_stateChanged(bool state); 00133 void radio_flat_stateChanged(bool state); 00134 00135 void btnCapture_clicked(); 00136 00137 void btnPossibleSolutions_Left_clicked(); 00138 void btnPossibleSolutions_Right_clicked(); 00139 void btnStartPTUCapture_clicked(); 00140 00141 void btnAddTopPose_clicked(); 00142 void btnDeleteTopPose_clicked(); 00143 void btnClearTopPose_clicked(); 00144 00145 }; 00146 00147 #endif // MAINWINDOW_H