Go to the documentation of this file.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
00033
00034
00035 #include <dbase_grasp_planner/velo_grasp_planning_task.h>
00036
00037 #include "robot.h"
00038 #include "EGPlanner/searchState.h"
00039 #include "EGPlanner/loopPlanner.h"
00040 #include "debug.h"
00041
00042 namespace dbase_grasp_planner {
00043
00044 VeloGraspPlanningTask::VeloGraspPlanningTask(graspit_dbase_tasks::DBTaskDispatcher *disp,
00045 db_planner::DatabaseManager *mgr,
00046 db_planner::TaskRecord rec) : GraspPlanningTask(disp, mgr, rec) {}
00047
00048 void VeloGraspPlanningTask::start()
00049 {
00050 GraspPlanningTask::start();
00051 if (mStatus == RUNNING) {
00052 static_cast<LoopPlanner*>(mPlanner)->setSaveThreshold(6.0);
00053 }
00054 }
00055
00056 bool VeloGraspPlanningTask::setPreGrasp(const GraspPlanningState *graspState)
00057 {
00058
00059 double RETREAT_BY = -100;
00060
00061
00062 graspState->execute();
00063
00064
00065 std::vector<double> dof(mHand->getNumDOF(),0.0);
00066 dof[0] = dof[2] = 20.0 * M_PI / 180.0;
00067 dof[1] = dof[3] = -20.0 * M_PI / 180.0;
00068 std::vector<double> stepSize(mHand->getNumDOF(), M_PI/36.0);
00069 mHand->moveDOFToContacts(&dof[0], &stepSize[0], true, false);
00070
00071
00072 for (int d=0; d<mHand->getNumDOF(); d++) {
00073 if ( fabs( dof[d] - mHand->getDOF(d)->getVal() ) > 1.0e-5) {
00074 DBGP(" Velo trying to open to " << dof[d] << "; only made it to " << mHand->getDOF(d)->getVal());
00075 DBGA(" open Velo fails");
00076 return false;
00077 }
00078 }
00079
00080
00081 if (mHand->approachToContact(RETREAT_BY, false)) {
00082
00083 DBGA(" retreat fails");
00084 return false;
00085 }
00086
00087 return true;
00088 }
00089
00090 }
00091
00092