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
00026 #ifndef _compliantplannerdlg_h_
00027 #define _compliantplannerdlg_h_
00028
00029 #include <QDialog>
00030 #include <list>
00031 #include <fstream>
00032
00033 #include "ui_compliantPlannerDlg.h"
00034
00035 #include "matvec3D.h"
00036
00037 class ListPlanner;
00038 class Hand;
00039 class GraspableBody;
00040 class GraspPlanningState;
00041
00043
00047 class CompliantPlannerDlg : public QDialog, public Ui::CompliantPlannerDlgUI
00048 {
00049 Q_OBJECT
00050 private:
00052 ListPlanner *mPlanner;
00054 Hand *mHand;
00056 GraspableBody *mObject;
00058 int mNumCandidates;
00060 int mBestGraspNum;
00062 transf mObjectRefTran;
00064 std::fstream *mOut;
00065
00067 double mTFrom, mTTo, mTStep, mTR;
00068 double mSFrom, mSTo, mSStep, mSR;
00069 bool mBatch;
00070
00072 void ellipsoidSampling(double a, double b, double c, double resolution);
00074 void boxSampling(double a, double b, double c, double res);
00076 void sampleFace(vec3 x, vec3 y, vec3 z, double sz1, double sz2, vec3 tln, double res,
00077 std::list<GraspPlanningState*> *sampling);
00078
00080 void gridEllipsoidSampling(const GraspPlanningState &seed,
00081 std::list<GraspPlanningState*> *sampling, int samples);
00083 void addCartesianSamples(const GraspPlanningState &seed, std::list<GraspPlanningState*> *sampling,
00084 int samples, double x, double y, double z);
00086 void init();
00088 void showResult();
00089 void startPlanner();
00090 public:
00091 CompliantPlannerDlg(Hand *h, GraspableBody *gb, QWidget *parent = 0) :
00092 QDialog(parent), mHand(h), mObject(gb) {
00093 setupUi(this);
00094 QObject::connect(generateButton, SIGNAL(clicked()),
00095 this, SLOT(generateButtonClicked()));
00096 QObject::connect(testButton, SIGNAL(clicked()),
00097 this, SLOT(testButtonClicked()));
00098 QObject::connect(testOneButton, SIGNAL(clicked()),
00099 this, SLOT(testOneButtonClicked()));
00100 QObject::connect(nextButton, SIGNAL(clicked()),
00101 this, SLOT(nextButtonClicked()));
00102 QObject::connect(prevButton, SIGNAL(clicked()),
00103 this, SLOT(prevButtonClicked()));
00104 QObject::connect(bestButton, SIGNAL(clicked()),
00105 this, SLOT(bestButtonClicked()));
00106 QObject::connect(designTestButton, SIGNAL(clicked()),
00107 this, SLOT(designTestButtonClicked()));
00108 QObject::connect(showOneButton, SIGNAL(clicked()),
00109 this, SLOT(showOneButtonClicked()));
00110 QObject::connect(prepareOneButton, SIGNAL(clicked()),
00111 this, SLOT(prepareOneButtonClicked()));
00112 QObject::connect(visualMarkersBox, SIGNAL(clicked()),
00113 this, SLOT(visualMarkersBoxClicked()));
00114 QObject::connect(resetObjectButton, SIGNAL(clicked()),
00115 this, SLOT(resetObjectButtonClicked()));
00116 QObject::connect(resultsFileEdit, SIGNAL(editingFinished()),
00117 this, SLOT(updateOut()));
00118 QObject::connect(resultsBox, SIGNAL(activated(int)),
00119 this, SLOT(updateOut()));
00120 init();
00121 }
00122 ~CompliantPlannerDlg();
00123
00124 public slots:
00125 void generateButtonClicked();
00126 void testButtonClicked();
00127 void testOneButtonClicked();
00128 void nextButtonClicked();
00129 void prevButtonClicked();
00130 void bestButtonClicked();
00131 void update();
00132 void plannerFinished();
00133 void showOneButtonClicked();
00134 void prepareOneButtonClicked();
00135 void visualMarkersBoxClicked();
00136 void resetObjectButtonClicked();
00137 void designTestButtonClicked();
00138 void updateOut();
00139 };
00140
00141 #endif