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
00027
00028
00029
00030
00031
00032
00037 #ifndef __GRASP_PLANNER_H__
00038 #define __GRASP_PLANNER_H__
00039
00040
00041
00042
00043 #define STARTING_DISTANCE 80.0
00044
00045
00046
00047
00048
00049
00050 #define NR_OF_360_DEG_STEPS 2
00051
00052
00053
00054
00055
00056 #define NR_OF_PARALLEL_PLANES 1
00057
00058
00059
00060
00061
00062 #define NR_OF_180_DEG_GRASPS 1
00063
00064
00065
00066 #define NR_OF_GRASP_ROTATIONS 1
00067
00068
00069 #define DEFAULT_PARAMETER_MODE 2
00070
00071
00072
00073
00074
00075
00076 #define GP_MAX_CUBE_SIZE 200.0
00077 #define GP_MIN_CUBE_SIZE 0.0
00078
00079
00080
00081
00082 #define GP_MAX_CYL_SIDEGRASP_DIAMETER 180.0
00083 #define GP_MIN_CYL_SIDEGRASP_DIAMETER 0.0
00084 #define GP_MIN_CYL_SIDEGRASP_HEIGHT 28.0
00085
00086
00087
00088 #define GP_MAX_CYL_SIDEGRASP_HEIGHT 200.0
00089
00090
00091
00092
00093 #define GP_MAX_CYL_TBGRASP_DIAMETER 180.0
00094 #define GP_MIN_CYL_TBGRASP_DIAMETER 5.0
00095 #define GP_MIN_CYL_TBGRASP_HEIGHT 40.0
00096
00097
00098
00099
00100 #define GP_MAX_SPH_DIAMETER 180.0
00101 #define GP_MIN_SPH_DIAMETER 0.0
00102
00103
00104
00105
00106 #define GP_MAX_CONE_TGRASP_DIAMETER 100000.0
00107 #define GP_MIN_CONE_TGRASP_DIAMETER 5.0
00108 #define GP_MIN_CONE_TGRASP_HEIGHT 0.0
00109
00110
00111
00112 #define GP_MAX_CONE_BGRASP_DIAMETER 180.0
00113 #define GP_MIN_CONE_BGRASP_DIAMETER 5.0
00114 #define GP_MIN_CONE_BGRASP_HEIGHT 0.0
00115
00116
00117
00118 #define GP_MAX_CONE_SIDEGRASP_DIAMETER 100000.0
00119 #define GP_MIN_CONE_SIDEGRASP_DIAMETER 0.0
00120 #define GP_MIN_CONE_SIDEGRASP_HEIGHT 0.0
00121
00122
00123
00124 #define GP_MAX_CONE_SIDEGRASP_HEIGHT 100000.0
00125
00126
00127
00128 #define GP_MAX_CONE_EDGEGRASP_DIAMETER 180.0
00129 #define GP_MIN_CONE_EDGEGRASP_DIAMETER 0.0
00130 #define GP_MIN_CONE_EDGEGRASP_HEIGHT 28.0
00131
00132
00133
00134 #define GP_MAX_CONE_EDGEGRASP_HEIGHT 100000.0
00135
00136
00137
00138
00139 #define PRESHAPE_CUBE_GRASP PR_two_opp_one
00140 #define PRESHAPE_CYLINDER_TOP_BOTTOM_GRASP PR_circle
00141 #define PRESHAPE_CYLINDER_SIDE_GRASP PR_two_opp_one
00142 #define PRESHAPE_SPHERE_GRASP PR_circle
00143 #define PRESHAPE_CONE_TOP_BOTTOM_GRASP PR_circle
00144 #define PRESHAPE_CONE_SIDE_GRASP PR_two_opp_one
00145 #define PRESHAPE_CONE_EDGE_GRASP PR_two_opp_one
00146
00147
00148
00149
00150 #define DELTA_360_DEG_ERROR 0.0001
00151
00152 class Body;
00153 class SoQtExaminerViewer;
00154 class GraspableBody;
00155 class IVmgr;
00156 class plannedGrasp;
00157 class GraspDirection;
00158 class SoPath;
00159 class SoSeparator;
00160
00161 #include "matvec3D.h"
00162 #include <Inventor/SoLists.h>
00163 #include <vector>
00164 typedef std::pair<Body *,Body *> BodyPair;
00165
00167
00188 class grasp_planner
00189 {
00190 private:
00191
00193 SoQtExaminerViewer *myViewer;
00194
00196 GraspableBody *my_body;
00197
00199 IVmgr *ivmgr;
00200
00202 SoGroup *IVGeomPrimitives;
00203
00205 int parameterMode;
00206
00207
00208
00209
00210
00211
00213 int nr_of_360_deg_steps;
00214
00216 int nr_of_parallel_planes_width;
00217
00219 int nr_of_parallel_planes_height;
00220
00222 int nr_of_parallel_planes_depth;
00223
00225 int nr_of_180_deg_grasps;
00226
00228 int nr_of_grasp_rotations;
00229
00230
00231
00232
00233
00234 SoPathList searchPrimitives(GraspableBody*);
00235
00236
00237
00238 void localToGlobalCoordinates(std::list<plannedGrasp*>&,
00239 SoPath *,const transf &);
00240
00241
00242
00243 SoPath *getGlobalPath(SoNode *node);
00244
00245
00246
00247
00248 std::list <plannedGrasp*> getPlannedGraspDirections(SoPath*);
00249
00250 std::list <GraspDirection*> getCubeGraspDirections (SoPath* sop);
00251 std::list <GraspDirection*> getCylinderGraspDirections(SoPath* sop);
00252 std::list <GraspDirection*> getSphereGraspDirections (SoPath* sop);
00253 std::list <GraspDirection*> getConeGraspDirections (SoPath* sop);
00254
00255
00256
00257 void computeGraspPreshapes (std::list<plannedGrasp*>&, SoPath*);
00258
00259 void computeCubeGraspPreshapes (std::list<plannedGrasp*>&, SoPath*);
00260 void computeCylinderGraspPreshapes(std::list<plannedGrasp*>&, SoPath*);
00261 void computeSphereGraspPreshapes (std::list<plannedGrasp*>&, SoPath*);
00262 void computeConeGraspPreshapes (std::list<plannedGrasp*>&, SoPath*);
00263
00264
00265
00266 bool existsInList(plannedGrasp, std::list<plannedGrasp*>);
00267
00268
00269
00270 int determineNumberOfGrasps(SoPathList);
00271
00272
00273
00274
00275 bool set_planningParametersFromPrimitive(SoPath*);
00276
00277 public:
00278
00279
00280
00281
00282 grasp_planner();
00283 ~grasp_planner();
00284
00285
00286 std::list<plannedGrasp*> planIt(GraspableBody*,SoGroup *);
00287
00288
00289 bool set_planningParameters(int nr_of_360_deg_steps_in,
00290 int nr_of_parallel_planes_in,
00291 int nr_of_180_deg_grasps_in,
00292 int nr_of_grasp_rotations_in);
00293
00294 void get_planningParameters(int& nr_of_360_deg_steps_in,
00295 int& nr_of_parallel_planes_in,
00296 int& nr_of_180_deg_grasps_in,
00297 int& nr_of_grasp_rotations_in);
00298
00299
00300 int get_parameterMode();
00301 bool set_parameterMode(int);
00302 };
00303
00304 #endif
00305
00306
00307
00308
00309
00310
00311
00312
00313