00001 //###################################################################### 00002 // 00003 // GraspIt! 00004 // Copyright (C) 2002-2009 Columbia University in the City of New York. 00005 // All rights reserved. 00006 // 00007 // GraspIt! is free software: you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation, either version 3 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // GraspIt! is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with GraspIt!. If not, see <http://www.gnu.org/licenses/>. 00019 // 00020 // Authors: Steffen Knoop 00021 // Andrew T. Miller 00022 // 00023 // $Id: grasp_manager.h,v 1.2 2009/03/25 22:10:23 cmatei Exp $ 00024 // 00025 //###################################################################### 00026 00027 /***************************************************************************/ 00028 /* FILE: grasp_manager.h */ 00029 /* AUTHOR: Steffen Knoop */ 00030 /* DATE: 03-08-2002 */ 00031 /***************************************************************************/ 00032 00037 #ifndef __GRASP_MANAGER_H__ 00038 #define __GRASP_MANAGER_H__ 00039 #include <qstring.h> 00040 00041 /* This is the number of iterations used to compute 00042 a grasp. One iteration consists of: 00043 - plan grasps 00044 - compare them to eventually existing ones to 00045 extract those near to the best ones in the 00046 last set 00047 - test the remaining grasps 00048 MAYBE THIS ISNT NEEDED ANY MORE, SHOULD THINK 00049 ABOUT IT... */ 00050 //#define NR_OF_PLAN_TEST_ITERATIONS 3 00051 00052 /* When doing an iteration step, maybe not all grasps with 00053 quality > 0.0 should be considered as "good" grasps. 00054 Only grasps with quality >= ITERATION_QUALITY_THRESH 00055 are taken into account while looking for those in the 00056 new set that are worth testing. Should be accessible 00057 from the interface. */ 00058 #define ITERATION_QUALITY_THRESH 0.05 00059 00060 /* This is a double which defines the max distance for the 00061 compare step above. Grasps further away than this 00062 from any tested and stable grasp are not tested in 00063 this step. */ 00064 #define MAX_GRASP_DISTANCE_IN_ITERATION 0.2 00065 00066 /* When computing new grasps for an iteration step, 00067 more grasps are genererated than in the step before. 00068 This means better accuracy as well as longer testing 00069 time. These defines fix the step size for each planning 00070 parameter. */ 00071 /* > 0 */ 00072 #define DEG_STEPS_STEP 40 00073 /* > 0 and even */ 00074 #define PAR_PLANES_STEP 4 00075 /* 1 or 2 (this is no step size, it only defines the value from seconds step on) */ 00076 #define DEG_180_STEP 1 00077 /* >0 */ 00078 #define ROTATIONS_STEP 3 00079 00080 class GraspableBody; 00081 class plannedGrasp; 00082 class grasp_planner; 00083 class grasp_presenter; 00084 class grasp_tester; 00085 class IVmgr; 00086 00088 00096 class grasp_manager{ 00097 00099 GraspableBody *my_body; 00100 00102 std::list<plannedGrasp*> graspList; 00103 00105 bool renderIt; 00106 00108 bool doIteration; 00109 00111 int graspsNotShown; 00112 00114 grasp_planner *myPlanner; 00115 00117 grasp_presenter* myPresent; 00118 00120 IVmgr *ivmgr; 00121 00123 SoGroup *primitives; 00124 00125 // a pointer to the grasp tester, now global because of idle Sensor stuff */ 00126 // grasp_tester *myTester; 00127 00128 /* same as define above */ 00129 // int nrOfPlanTestIteration; 00130 00132 double maxdist; 00133 00135 double itQualThresh; 00136 00137 // struct timeval computingTime; 00138 00140 int nrOfPlannedGrasps; 00141 00143 int nrOfStableGrasps; 00144 00145 /* changes the parameters of the planner according to 00146 actual iteration step so that planning gets more accurate 00147 with increasing stepnumber */ 00148 // void changePlanningParameters(int); 00149 00150 void loadPrimitives(); 00151 void compareGraspListsByDist(std::list<plannedGrasp*>&, std::list<plannedGrasp*>); 00152 00153 public: 00154 grasp_manager(); 00155 ~grasp_manager(); 00156 00157 int readCandidateGraspsFile(const QString& filename); 00158 void generateGrasps(); 00159 void testGrasps(); 00160 void showGrasps(int next); 00161 void chooseGrasp(); 00162 00163 void set_render(bool); 00164 bool get_render()const; 00165 00166 void set_doIteration(bool); 00167 bool get_doIteration()const; 00168 00169 bool set_iterationParameters(double,double); 00170 void get_iterationParameters(double&,double&)const; 00171 00172 grasp_planner* get_graspPlanner()const; 00173 grasp_tester* get_graspTester()const; 00174 }; 00175 00176 00177 #endif 00178 /****************** 00179 Local Variables: 00180 mode:c++ 00181 End: 00182 ******************/ 00183 00184 00185