libmove3d
3.13.0
|
00001 #ifndef ENV_HPP 00002 #define ENV_HPP 00003 00004 #ifdef QT_LIBRARY 00005 #undef CursorShape 00006 #include <QtCore/QObject> 00007 #endif 00008 00009 #include <map> 00010 #include <utility> 00011 #include <string> 00012 #include <vector> 00013 00014 #include "ParametersEnv.hpp" 00015 00020 class Env 00021 #ifdef QT_LIBRARY 00022 : public QObject 00023 #endif 00024 { 00025 public: 00026 00027 #ifdef QT_LIBRARY 00028 Q_OBJECT; 00029 Q_ENUMS(boolParameter); 00030 Q_ENUMS(intParameter); 00031 Q_ENUMS(doubleParameter); 00032 Q_ENUMS(stringParameter); 00033 Q_ENUMS(vectorParameter); 00034 Q_ENUMS(expansionMethod); 00035 #endif 00036 00037 public: 00038 00039 enum boolParameter { 00040 // Controls wether the C++ planner maps the C Graph or not 00041 // Only works with RRT 00042 use_p3d_structures, 00043 // Controls wether the planner is PRM or Diffusion 00044 isPRMvsDiffusion, 00045 isGoalBiased, 00046 treePlannerIsEST, 00047 // Controls wether the diffusion method expand towards a given goal. 00048 expandToGoal, 00049 // Controls wether the expansion process for bi-RRT is balanced. 00050 expandBalanced, 00051 // Controls wether the diffusion method is mono or bidirectional (bi-RRT). 00052 biDir, 00053 minimize, 00054 // Controls wether cycles are added during the diffusion process. 00055 // Currently, a cycle is added if from a new node, 00056 // we can find another node that is far in the graph structure. 00057 addCycles, 00058 // Wether the exporation controls the refinement vs expansion nodes 00059 expandControl, 00060 // Wether nodes are discarded for selection in RRT, 00061 // after a maximum number of allowed failures. 00062 discardNodes, 00063 //enable or disable edge validation (used in RRT only) 00064 findLowCostConf, 00065 // Manhattan-like RRT 00066 // In a first step only the active parameters are expanded 00067 // then we try to expand the passive parameter by recursivly 00068 // expanding only the passive parameters which were in collision 00069 // during the previsous expansion 00070 isManhattan, 00071 isMultiRRT, 00072 drawDisabled, 00073 drawFrame, 00074 drawGraph, 00075 drawTraj, 00076 drawOTPTraj, 00077 drawTrajVector, 00078 drawAll, 00079 drawLightSource, 00080 drawGrid, 00081 drawEntireGrid, 00082 drawDistance, 00083 drawPoints, 00084 drawGaze, 00085 drawBox, 00086 drawOnlyOneLine, 00087 drawVectorField, 00088 drawMultiColorLocalpath, 00089 // Variables Hri 00090 useHriDis, 00091 useHriPen, 00092 useHriNat, 00093 enableHri, 00094 computeGrid, 00095 HRIPlannerTS, 00096 HRIPlannerWS, 00097 HRIPlannerCS, 00098 HRIPlannerTRRT, 00099 HRIPathDistance, 00100 HRIleftArmVsRightArm, 00101 HRIcameraBehindHuman, 00102 HRINoRobot, 00103 HRIComputeOTP, 00104 HRIAutoLoadGrid, 00105 // Variable Visualisation 00106 printTemp, 00107 printRadius, 00108 printNbQRand, 00109 printCollFail, 00110 printCostFail, 00111 // Ligand exit trajectory simulation : 00112 // The rrt expansion is stopped when the distance from start 00113 // reaches a certain value. 00114 ligandExitTrajectory, 00115 useRefiRadius, 00116 // Cost Traj && Cost Space 00117 debugCostOptim, 00118 trajCostRecompute, 00119 isCostSpace, 00120 isPasExtWhenAct, 00121 useDist, 00122 costBeforeColl, 00123 costExpandToGoal, 00124 costThresholdRRT, 00125 costThresholdPlanner, 00126 costStarRRT, 00127 00128 //OTP 00129 FastComputingRobotBase, 00130 DrawRobotBaseGridCosts, 00131 00132 // Smoothing stage 00133 withMaxIteration, 00134 withGainLimit, 00135 withTimeLimit, 00136 withSmoothing, 00137 withShortCut, 00138 withDeformation, 00139 saveTrajCost, 00140 00141 withCleaning, 00142 00143 useTRRT, 00144 useBoxDist, 00145 useBallDist, 00146 isInverseKinematics, 00147 isRunning, 00148 initPlot, 00149 isWeightedRotation, 00150 randomConnectionToGoal, 00151 tryClosest, 00152 StopMultiRun, 00153 tRrtComputeGradient, 00154 FKShoot, 00155 FKDistance, 00156 RecomputeCellCost, 00157 UseDPGGrids, 00158 startWithFKCntrt, 00159 showOneCell 00160 #ifdef MULTILOCALPATH 00161 ,plotSoftMotionCurve, 00162 writeSoftMotionFiles 00163 #endif 00164 }; 00165 00166 enum intParameter { 00167 // number of consecutive times the optimization 00168 // of a cost trajectory fails before we stop the 00169 // optimization 00170 // WARNING: Currently, this parameter is also 00171 // used for other applications: 00172 // - Set the speed of the threshold increase in 00173 // the MAXIMAL_THRESHOLD variant 00174 // - Set the temperature in the MONTE_CARLO_SEARCH 00175 PRMType, 00176 nbOfSeeds, 00177 jntToDraw, 00178 maxCostOptimFailures, 00179 nbQRand, 00180 nbCostTransFailed, 00181 nbCollExpanFailed, 00182 nbCostOptimize, 00183 nbGreedyTraj, 00184 maxNodeCompco, 00185 maxNode, 00186 maxConnect, 00187 NbTry, 00188 MaxExpandNodeFail, 00189 MaxPassiveExpand, 00190 DistConfigChoice, 00191 ExpansionNodeMethod, 00192 costMethodChoice, 00193 test, 00194 nbRound, 00195 nbMultiRun, 00196 nbMultiSmooth, 00197 akinJntId, 00198 heightFactor, 00199 progress, 00200 costDeltaMethod, 00201 hriCostType, 00202 hriActiveGrid, 00203 hriShownGridLine, 00204 tRrtNbtry, 00205 cellToShow, 00206 lineToShow, 00207 nbCells, 00208 00209 //OTP 00210 typeRobotBaseGrid // 0, 1, 2 or 3 for all, dist only, robot dist only and visual field only 00211 }; 00212 00213 enum doubleParameter { 00214 // Mirrors the env dmax 00215 dmax, 00216 // Frame per seconds in the QT interface 00217 FPS, 00218 showTrajFPS, 00219 // the extension length in the extend method is equal to 00220 // mExtensionStep*Dmax 00221 extensionStep, 00222 costStep, 00223 costThreshold, 00224 00225 // Controls the increasement of the temperature in Cost Spaces. 00226 temperatureRate, 00227 temperatureStart, 00228 temperatureGoal, 00229 00230 // Temperature parameter of the T-RRT algorithm. 00231 // (by analogy with simulated annealing methods) 00232 initialTemperature, 00233 alpha, 00234 00235 // Variables Hri 00236 zone_size, 00237 coeffPen, 00238 coeffDis, 00239 coeffNat, 00240 coeffJoint, 00241 coeffEnerg, 00242 coeffConfo, 00243 coeffArmPr, 00244 multCost, 00245 Kdistance, 00246 Kvisibility, 00247 Knatural, 00248 Kreachable, 00249 KlengthWeight, 00250 00251 // Optimization Variables 00252 optimTimeLimit, 00253 MaxFactor, 00254 MinStep, 00255 00256 //Other variables 00257 refiRadius, 00258 manhatRatio, 00259 dist, 00260 visThresh, 00261 PlanCellSize, 00262 CellSize, 00263 Bias, 00264 RotationWeight, 00265 colorThreshold1, 00266 colorThreshold2, 00267 findLowCostThreshold, 00268 bestCost, 00269 minimalFinalExpansionGap, 00270 //Optimisation time 00271 timeOptimize, 00272 00273 //OTP 00274 optimalDist, 00275 robotMaximalDist, 00276 gazeAngle, 00277 00278 optimalDistFactor, 00279 robotMaximalDistFactor, 00280 gazeAngleFactor 00281 }; 00282 00283 enum stringParameter { 00284 nameOfFile, 00285 numberOfCollisionPerSec, 00286 numberOfLocalPathPerSec, 00287 numberOfCostPerSec, 00288 ObjectToCarry, 00289 ActiveGrid 00290 }; 00291 00292 enum vectorParameter { 00293 costAlongTraj 00294 }; 00295 00296 enum expansionMethod { 00297 Extend, 00298 nExtend, 00299 Connect, 00300 costConnect 00301 }; 00302 00306 Env(); 00307 00311 ~Env(); 00312 00313 #ifdef QT_LIBRARY 00314 00319 QString getString(stringParameter p); 00320 00326 void setString(stringParameter p, QString v); 00327 #endif 00328 00334 std::vector<double> getVector(vectorParameter p); 00335 00341 void setVector(vectorParameter p, std::vector<double> v); 00342 00348 int getInt(intParameter p); 00349 00355 void setInt(intParameter p, int v); 00356 00362 double getDouble(doubleParameter p); 00363 00369 void setDouble(doubleParameter p, double v); 00370 00376 bool getBool(boolParameter p); 00377 00383 void setBool(boolParameter p, bool v); 00384 00390 #ifdef QT_LIBRARY 00391 QObject* getObject(intParameter p); 00392 #endif 00393 00399 #ifdef QT_LIBRARY 00400 QObject* getObject(boolParameter p); 00401 #endif 00402 00408 #ifdef QT_LIBRARY 00409 QObject* getObject(doubleParameter p); 00410 #endif 00411 00417 #ifdef QT_LIBRARY 00418 QObject* getObject(stringParameter p); 00419 #endif 00420 00426 #ifdef QT_LIBRARY 00427 QObject* getObject(vectorParameter p); 00428 #endif 00429 00430 00435 void setExpansionMethod(expansionMethod method); 00436 00441 expansionMethod getExpansionMethod(); 00442 00443 00447 typedef std::pair<intParameter, intContainer*> intMap_t; 00448 typedef std::pair<stringParameter, stringContainer*> stringMap_t; 00449 typedef std::pair<vectorParameter, vectorContainer*> vectorMap_t; 00450 typedef std::pair<doubleParameter, doubleContainer*> doubleMap_t; 00451 typedef std::pair<boolParameter, boolContainer*> boolMap_t; 00452 00453 std::map<intParameter, intContainer*> getIntMap() {return mIntMap; } 00454 std::map<stringParameter, stringContainer*> getStringMap() {return mStringMap; } 00455 std::map<vectorParameter, vectorContainer*> getVectorMap() {return mVectorMap; } 00456 std::map<doubleParameter, doubleContainer*> getDoubleMap() {return mDoubleMap; } 00457 std::map<boolParameter, boolContainer*> getBoolMap() {return mBoolMap; } 00458 00459 00460 #ifdef QT_LIBRARY 00461 public slots: 00462 #endif 00463 00467 void setExpansionMethodSlot(int method); 00468 00469 #ifdef QT_LIBRARY 00470 signals: 00471 #endif 00472 00476 void expansionMethodChanged(int method); 00477 00478 00479 private: 00480 std::map<intParameter, intContainer*> mIntMap; 00481 std::map<stringParameter, stringContainer*> mStringMap; 00482 std::map<vectorParameter, vectorContainer*> mVectorMap; 00483 std::map<doubleParameter, doubleContainer*> mDoubleMap; 00484 std::map<boolParameter, boolContainer*> mBoolMap; 00485 00486 00487 /*The method used to expand a node toward a direction 00488 configuration selected as direction of expansion*/ 00489 expansionMethod mExpansionMethod; 00490 00491 }; 00492 00493 extern Env ENV; 00494 00495 #endif