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 // Author(s): Matei T. Ciocarlie 00021 // 00022 // $Id: graspTesterThread.h,v 1.10 2009/05/07 19:57:46 cmatei Exp $ 00023 // 00024 //###################################################################### 00025 00026 #ifndef _grasptesterthread_h_ 00027 #define _grasptesterthread_h_ 00028 00029 #include <QThread> 00030 #include <QMutex> 00031 #include <list> 00032 00033 #include "egPlanner.h" 00034 00035 class GraspPlanningState; 00036 class Hand; 00037 class Body; 00038 00052 class GraspTester : public EGPlanner 00053 { 00054 private: 00056 QMutex mListMutex; 00058 std::list<GraspPlanningState*> mSolutionList; 00060 std::list<GraspPlanningState*> mCandidateList; 00062 int mMaxCandidates; 00064 int mNumCandidates; 00065 00067 GraspPlanningState* popCandidate(); 00069 void postSolution(GraspPlanningState*); 00070 00072 void testGrasp(GraspPlanningState *s); 00073 00075 void mainLoop(); 00076 public: 00078 GraspTester(Hand *h); 00080 ~GraspTester(); 00081 virtual PlannerType getType(){return PLANNER_GT;} 00082 00084 void setEnergyType(SearchEnergyType); 00086 virtual bool resetPlanner(); 00087 00089 bool postCandidate(GraspPlanningState *s); 00091 GraspPlanningState* popSolution(); 00093 void clearBuffers(); 00094 00096 int getNumCandidates(){return mNumCandidates;} 00097 }; 00098 00099 #endif