00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00031 #ifndef _DBASEPLANNERDLG_H_
00032 #define _DBASEPLANNERDLG_H_
00033
00034 #include "ui_dbasePlannerDlg.h"
00035 #include <utility>
00036 #include <QDialog>
00037
00038 #include "DBPlanner/neighbor_finder.h"
00039 #include "DBPlanner/aligner.h"
00040 #include "DBPlanner/grasp_ranker.h"
00041 #include "DBPlanner/db_manager.h"
00042
00043 namespace db_planner {
00044 class DatabaseManager;
00045 class Model;
00046 class Grasp;
00047 }
00048
00049 class Hand;
00050 class GraspitDBPlanner;
00051 class GraspableBody;
00052 class GraspitDBModel;
00053 class GraspPlanningState;
00054
00055 class DBasePlannerDlg : public QDialog, public Ui::DBasePlannerDlgUI
00056 {
00057 Q_OBJECT
00058 private:
00060 db_planner::DatabaseManager *mDBMgr;
00062 db_planner::NeighborFinder<db_planner::Model> *mNeighborFinder;
00064 db_planner::GraspRanker *mGraspRanker;
00066 db_planner::Aligner<db_planner::Model> *mAligner;
00068 GraspitDBPlanner* mPlanner;
00070 std::vector<std::pair<db_planner::Model*, double> >mNeighbors;
00072 std::vector<db_planner::Grasp*>mOriginalGrasps;
00074 std::vector<db_planner::Grasp*>mTestedGrasps;
00076 db_planner::Model *mPlanningModel;
00078 db_planner::Model *mModelShown;
00080 Hand* mHand;
00082 int mCurrentOriginalGrasp;
00084 int mCurrentTestedGrasp;
00086 QGraphicsScene * mModelScene;
00088 bool neighborComboBoxInReconstruction;
00089
00090 void init();
00091 void destroy();
00092 void initializeDistanceComboBox(std::vector<string>);
00093 void updateNeighborList();
00094 void updateModelImage(db_planner::Model*);
00095 void updateOriginalGraspInfo();
00096 void updateTestedGraspInfo();
00097 void show3DObject(bool isNbr = false);
00098
00099 template <class vectorType, class treatAsType>
00100 void deleteVectorElements(std::vector<vectorType>& v);
00101
00102 void previousGrasp(int& i, std::vector<db_planner::Grasp*> graspList);
00103 void nextGrasp(int& i, std::vector<db_planner::Grasp*> graspList);
00104 void showGrasp(db_planner::Grasp* grasp);
00105 void setGroupBoxEnabled(bool nbrGen, bool alignment, bool ranking, bool grasp, bool execute);
00106
00107 public:
00108 DBasePlannerDlg(QWidget *parent = 0, db_planner::DatabaseManager* dbm = NULL,
00109 db_planner::Model* m = NULL, Hand* h = NULL) :
00110 QDialog(parent), mDBMgr(dbm), mPlanningModel(m), mModelShown(m),
00111 mHand(h), mModelScene(NULL), mCurrentOriginalGrasp(0),
00112 mCurrentTestedGrasp(0), neighborComboBoxInReconstruction(false), mAligner(NULL) {
00113 setupUi(this);
00114 QObject::connect(exitButton, SIGNAL(clicked()), this, SLOT(exitButton_clicked()));
00115 QObject::connect(getNeighborButton, SIGNAL(clicked()), this, SLOT(getNeighborButton_clicked()));
00116 QObject::connect(executeButton, SIGNAL(clicked()), this, SLOT(executeButton_clicked()));
00117 QObject::connect(retrieveGraspsButton, SIGNAL(clicked()), this, SLOT(retrieveGraspsButton_clicked()));
00118 QObject::connect(rankGraspsButton, SIGNAL(clicked()), this, SLOT(rankGraspsButton_clicked()));
00119 QObject::connect(previousGraspButton, SIGNAL(clicked()), this, SLOT(previousGraspButton_clicked()));
00120 QObject::connect(nextGraspButton, SIGNAL(clicked()), this, SLOT(nextGraspButton_clicked()));
00121 QObject::connect(createGWSButton, SIGNAL(clicked()), this, SLOT(createGWSButton_clicked()));
00122 QObject::connect(neighborComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(modelChanged()));
00123 QObject::connect(alignmentMethodComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(alignmentChanged()));
00124 QObject::connect(seeNeighborCheckBox, SIGNAL(stateChanged(int)), this, SLOT(neighborCheckBoxChanged()));
00125 QObject::connect(originalGraspRadioButton, SIGNAL(clicked()), this, SLOT(originalGraspRadioButton_clicked()));
00126 QObject::connect(testedGraspRadioButton, SIGNAL(clicked()), this, SLOT(testedGraspRadioButton_clicked()));
00127 init();
00128 }
00129 ~DBasePlannerDlg(){destroy();}
00130
00131 public slots:
00133 void exitButton_clicked();
00134 void getNeighborButton_clicked();
00135 void executeButton_clicked();
00136 void retrieveGraspsButton_clicked();
00137 void rankGraspsButton_clicked();
00138 void previousGraspButton_clicked();
00139 void nextGraspButton_clicked();
00140 void createGWSButton_clicked();
00141 void originalGraspRadioButton_clicked();
00142 void testedGraspRadioButton_clicked();
00143
00145 void modelChanged();
00146 void neighborCheckBoxChanged();
00147 void alignmentChanged();
00148 };
00149
00150 #endif