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_grasps.h,v 1.2 2009/03/25 22:10:23 cmatei Exp $ 00024 // 00025 //###################################################################### 00026 00027 /***************************************************************************/ 00028 /* FILE: grasp_grasps.h */ 00029 /* AUTHOR: Steffen Knoop */ 00030 /* DATE: 03-08-2002 */ 00031 /***************************************************************************/ 00032 00037 #ifndef __GRASP_GRASPS_H__ 00038 #define __GRASP_GRASPS_H__ 00039 00040 #define DIST_DIR_WEIGHT 5.0 00041 #define DIST_FFD_WEIGHT 2.0 00042 #define DIST_PRESH_WEIGHT 1.0 00043 00044 #include <list> 00045 #include <vector> 00046 00047 class grasp_representation; 00048 class GraspableBody; 00049 00051 00056 class finalGraspPosition 00057 { 00058 private: 00060 transf finalTran; 00061 00063 std::list<double> dof; 00064 00065 public: 00066 finalGraspPosition(); 00067 finalGraspPosition(const finalGraspPosition&); 00068 ~finalGraspPosition(); 00069 00070 transf get_finalTran()const; 00071 void set_finalTran(transf); 00072 00073 std::list<double> get_dof() const; 00074 void add_dof(double); 00075 bool change_dof(unsigned int, double); 00076 }; 00077 00078 /**********************/ 00079 00081 00089 class plannedGrasp 00090 { 00091 private: 00093 cartesianGraspDirection myGraspDir; 00094 00096 cartesian_coordinates fixedFingerDirection; 00097 00099 finalGraspPosition finalGPos; 00100 00101 // /* reachability of GraspDirection for the platform, arm and hand */ 00102 // bool isReachable; 00103 00105 double myQuality; 00106 00108 preshape myPreshape; 00109 00111 GraspableBody *myGraspableBody; 00112 00114 grasp_representation *myCP; 00115 00116 public: 00117 00118 /* constructor, destructor */ 00119 plannedGrasp(); 00120 plannedGrasp(const plannedGrasp&); 00121 plannedGrasp(cartesianGraspDirection); 00122 ~plannedGrasp(); 00123 00124 /* return value: 0 <= val <= 1.0 */ 00125 double distanceTo(plannedGrasp) const; 00126 00127 /* access methods */ 00128 cartesianGraspDirection get_graspDirection() const; 00129 void set_graspDirection(cartesianGraspDirection); 00130 00131 cartesian_coordinates get_fixedFingerDirection() const; 00132 void set_fixedFingerDirection(cartesian_coordinates); 00133 00134 finalGraspPosition get_finalGraspPosition() const; 00135 void set_finalGraspPosition(finalGraspPosition); 00136 00137 // bool get_isReachable() const; 00138 // void set_isReachable(bool); 00139 00140 double get_quality() const; 00141 void set_quality(double); 00142 00143 preshape get_preshape() const; 00144 void set_preshape(preshape in); 00145 00146 GraspableBody* get_graspableBody() const; 00147 void set_graspableBody(GraspableBody*); 00148 00149 grasp_representation* get_graspRepresentation() const; 00150 void set_graspRepresentation(grasp_representation*); 00151 void remove_graspRepresentation(); 00152 }; 00153 00154 00155 /* 00156 Two different versions are used because of the differences in the 00157 STL implementations 00158 */ 00159 00160 #ifdef WIN32 00161 00163 struct compareGraspQM : public std::greater<plannedGrasp *> 00164 { 00165 bool operator()(plannedGrasp *&, plannedGrasp *&) const; 00166 }; 00167 00168 #else 00169 00171 struct compareGraspQM : public std::less<plannedGrasp *> 00172 { 00173 bool operator()(plannedGrasp *&, plannedGrasp *&) const; 00174 }; 00175 00176 #endif 00177 00178 /* This function is needed by the STL for sorting the grasp list 00179 according to the qm */ 00180 //bool compareGraspQM(plannedGrasp*, plannedGrasp*); 00181 00182 #endif 00183 00184 00185 /****************** 00186 Local Variables: 00187 mode:c++ 00188 End: 00189 ******************/ 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212