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
00030 #ifndef _GRASPIT_DB_PLANNER_H_
00031 #define _GRASPIT_DB_PLANNER_H_
00032 #include <ostream>
00033 #include <vector>
00034 #include <QObject>
00035 #include <QString>
00036 #include "matvec3D.h"
00037 #include "DBPlanner/aligner.h"
00038
00039 class Hand;
00040 class GraspableBody;
00041 class GraspitDBGrasp;
00042 class GraspitDBModel;
00043 class QualEpsilon;
00044 class QualVolume;
00045 class GraspPlanningState;
00046
00047 namespace db_planner {
00048 class DatabaseManager;
00049 class Model;
00050 class Grasp;
00051 }
00052
00053 class GraspitDBPlanner : public QObject{
00054 Q_OBJECT
00055 public:
00056 enum DynamicCode{DYNAMIC_SUCCESS=0, DYNAMIC_NO_FC=1, DYNAMIC_OBJECT_EJECTED=2, DYNAMIC_ERROR=3, DYNAMIC_APPROACH_FAILED=4, NO_DYNAMICS=5};
00057 enum TestType{STATIC=0, DYNAMIC=1};
00058 private:
00060 Hand *mHand;
00062 db_planner::Model *mObject;
00064 db_planner::DatabaseManager *mDBMgr;
00066 db_planner::Aligner<db_planner::Model> *mAligner;
00068 std::vector<GraspPlanningState*> mTestedGrasps;
00070 bool mDynamicsError;
00072 QualEpsilon* mEpsQual;
00074 QualVolume* mVolQual;
00075
00077 bool moveHandOutOfCollision();
00079 void moveBy(vec3 v);
00081 bool checkDynBody();
00083 void dynamicBodyInit();
00085 bool testGraspStatic();
00087 bool testGraspDynamic(DynamicCode *code);
00088
00089 public slots:
00090 void dynamicsError(const char*);
00091
00092 public:
00093
00094 GraspitDBPlanner(Hand *h,
00095 db_planner::Model *b,
00096 db_planner::DatabaseManager *m,
00097 db_planner::Aligner<db_planner::Model> *a) :
00098 mHand(h), mObject(b), mDBMgr(m), mAligner(a),
00099 mEpsQual(NULL), mVolQual(NULL) {}
00100 ~GraspitDBPlanner();
00101
00103 bool testCurrentGrasp(TestType t, DynamicCode* c = NULL);
00105 bool testGrasps(TestType t, std::vector<db_planner::Grasp*>,
00106 std::vector<db_planner::Grasp*>* testedGraspList);
00113 void crossCorrelate(const std::vector<db_planner::Model*> testModels,
00114 std::vector<db_planner::Grasp*> graspList);
00115
00117 void computeQuality(float& eq, float& vq);
00118 };
00119 #endif