GrasperRequest.h
Go to the documentation of this file.00001
00002 #ifndef INCLUDED_GrasperRequest_h_
00003 #define INCLUDED_GrasperRequest_h_
00004
00005 #include "Behaviors/StateNode.h"
00006 #include "DualCoding/ShapeAgent.h"
00007
00008 #include "PilotRequest.h"
00009 #include "MapBuilderRequest.h"
00010
00011 #if defined(TGT_IS_CALLIOPE2) || defined(TGT_IS_CALLIOPE3) || defined(TGT_IS_CALLIOPE5) || defined(TGT_IS_MANTIS)
00012 # include "Planners/Manipulation/ShapeSpacePlanner3DR.h"
00013 #else
00014 # include "Planners/Manipulation/ShapeSpacePlanner2DR.h"
00015 #endif
00016
00017 using namespace std;
00018 using namespace DualCoding;
00019
00020
00021
00022 class GrasperRequest {
00023 public:
00024 #if defined(TGT_IS_CALLIOPE5)
00025 typedef ShapeSpacePlanner3DR<NumArmJoints-2> Planner;
00026 typedef PlannerObstacle3D PlannerObstacleG;
00027 static const unsigned int numPlannerJoints = NumArmJoints-2;
00028 #elif defined(TGT_IS_CALLIOPE2) || defined(TGT_IS_CALLIOPE3)
00029 typedef ShapeSpacePlanner3DR<NumArmJoints-1> Planner;
00030 typedef PlannerObstacle3D PlannerObstacleG;
00031 static const unsigned int numPlannerJoints = NumArmJoints-1;
00032 #elif defined(TGT_IS_MANTIS)
00033 typedef ShapeSpacePlanner3DR<JointsPerFrLeg> Planner;
00034 typedef PlannerObstacle3D PlannerObstacleG;
00035 static const unsigned int numPlannerJoints = JointsPerFrLeg;
00036 #elif defined(TGT_HAS_FINGERS)
00037 typedef ShapeSpacePlanner2DR<NumArmJoints-2> Planner;
00038 typedef PlannerObstacle2D PlannerObstacleG;
00039 static const unsigned int numPlannerJoints = NumArmJoints-2;
00040 #elif defined(TGT_HAS_GRIPPER)
00041 typedef ShapeSpacePlanner2DR<NumArmJoints-1> Planner;
00042 typedef PlannerObstacle2D PlannerObstacleG;
00043 static const unsigned int numPlannerJoints = NumArmJoints-1;
00044 #else
00045 typedef ShapeSpacePlanner2DR<NumArmJoints> Planner;
00046 typedef PlannerObstacle2D PlannerObstacleG;
00047 static const unsigned int numPlannerJoints = NumArmJoints;
00048 #endif
00049
00050 typedef Planner::NodeType_t NodeType_t;
00051 typedef NodeType_t::NodeValue_t NodeValue_t;
00052
00053 private:
00054 friend class Grasper;
00055
00056 typedef unsigned int GrasperVerbosity_t;
00057
00058 public:
00059
00060
00061 enum GrasperRequestType_t {
00062 checkGraspable,
00063 checkMovable,
00064 checkRestable,
00065 computeReach,
00066 reach,
00067 grasp,
00068 touch,
00069 release,
00070 moveTo,
00071 rest,
00072
00073 sweep,
00074 computeMove,
00075 computeRest
00076 };
00077
00078
00079 enum GrasperErrorType_t {
00080 noError = 0,
00081 someError,
00082 invalidRequest,
00083 noGraspState,
00084 noGraspPath,
00085 lostObject,
00086 noDeliverState,
00087 noDeliverPath,
00088 noRestPath,
00089 badGrasp,
00090 badMove,
00091 pickUpUnreachable,
00092 dropOffUnreachable
00093 };
00094
00095
00096 enum GraspStrategy_t {
00097 unconstrainedGrasp,
00098 sideGrasp,
00099 overheadGrasp
00100 };
00101
00102
00103 enum GrasperPathType_t {
00104 noPath,
00105 doApproach,
00106 doDeliver,
00107 doRelease
00108 };
00109
00110
00111 enum GrasperRestType_t {
00112 stationary,
00113 settleArm,
00114 settleBodyAndArm
00115 };
00116
00117
00118 enum GrasperVerifyStrategy_t {
00119 verifyNone,
00120 verifyAprilTag,
00121 verifyDomino,
00122 verifyCross,
00123 verifyLoad,
00124 verifyUser
00125 };
00126
00127
00128 GrasperRequest(GrasperRequestType_t _type);
00129
00130
00131 GrasperRequest(const GrasperRequest &req);
00132
00133
00134 GrasperErrorType_t validateRequest();
00135
00136
00137 GrasperRequestType_t requestType;
00138
00139
00140 GraspStrategy_t graspStrategy;
00141
00142
00143 GrasperRestType_t restType;
00144
00145
00146 NodeValue_t armRestState;
00147
00148 GrasperVerbosity_t setVerbosity;
00149 GrasperVerbosity_t clearVerbosity;
00150
00151
00152
00153
00154 unsigned int effectorOffset;
00155
00156
00157 unsigned int rrtMaxIterations;
00158
00159
00160 float rrtInflation;
00161
00162
00163 NodeValue_t rrtInterpolationStep;
00164
00165
00166 float armTimeFactor;
00167
00168
00169 bool openGripperOnRest;
00170
00171
00172 ShapeRoot object;
00173
00174
00175 unsigned int objectFeature;
00176
00177
00178 std::vector<Point> objectGraspPoints;
00179
00180
00181 AngTwoPi approachOrientation;
00182
00183
00184 GrasperVerifyStrategy_t verifyStrategy;
00185
00186
00187 bool (*verifyGraspFunction)(ShapeRoot&);
00188
00189
00190 ShapeRoot targetLocation;
00191
00192
00193 AngTwoPi targetOrientation;
00194
00195
00196 bool allowBodyMotion;
00197
00198
00199 float gripPressure;
00200
00201
00202 std::vector<std::pair<float, float> > gripperAngleRangesX;
00203
00204
00205 std::vector<std::pair<float, float> > gripperAngleRangesY;
00206
00207
00208 std::vector<std::pair<float, float> > gripperAngleRangesZ;
00209
00210
00211 unsigned int maxNumberOfAngles;
00212
00213
00214 float angleResolution;
00215
00216
00217 std::vector<ShapeRoot> sweepObjects;
00218
00219
00220 std::vector<ShapeRoot> envObstacles;
00221
00222
00223 AdmissibilityPredicate<NodeType_t> *predicate;
00224
00225
00226 GrasperPathType_t populateEventPathWith;
00227
00228
00229 PilotRequest pilotreq;
00230
00231
00232 MapBuilderRequest *mapreq;
00233
00234
00235 bool displayPath;
00236
00237
00238 bool displayTree;
00239
00240 private:
00241
00242 Shape<AgentData> approachPose;
00243
00244
00245 Shape<AgentData> transportPose;
00246
00247
00248 Shape<AgentData> withdrawPose;
00249
00250
00251 std::vector<NodeValue_t> approachPath;
00252
00253
00254 std::vector<NodeValue_t> deliverPath;
00255
00256
00257 std::vector<NodeValue_t> releasePath;
00258
00259
00260 BehaviorBase* requestingBehavior;
00261
00262
00263 GrasperVerbosity_t verbosity;
00264
00265 protected:
00266 unsigned int requestID;
00267 GrasperRequest& operator=(const GrasperRequest&);
00268 };
00269
00270 typedef GrasperRequest::GrasperErrorType_t GraspError;
00271
00272 #endif