RRT.h
Go to the documentation of this file.
00001 #ifndef __RRT_H__
00002 #define __RRT_H__
00003 
00004 #include <vector>
00005 #include <string>
00006 #include <iostream>
00007 #include <stdio.h>
00008 
00009 #include "PathPlanner.h"
00010 #include "Algorithm.h"
00011 #include "Roadmap.h"
00012 
00013 namespace PathEngine {
00014 
00018   class RRT
00019     : public Algorithm {
00020   public:
00024     typedef boost::function1<bool, const Configuration &> extraConnectionCheckFunc;
00025 
00026   private:
00030     enum ExtendResult {
00031       Advanced, 
00032       Trapped,  
00033       Reached   
00034     };
00035 
00039     RoadmapPtr Tstart_;
00040 
00044     RoadmapPtr Tgoal_;
00045 
00049     RoadmapPtr TlastExtended_;
00050 
00054     RoadmapPtr Ta_, Tb_;
00055 
00063     int extend(RoadmapPtr tree, Configuration& qRand, bool reverse=false);
00064 
00072     int connect(RoadmapPtr tree, const Configuration& qNew, bool reverse=false);
00073 
00074     void swapTrees();
00075 
00079     double eps_;
00080 
00084     int times_;
00085 
00089     bool extendFromStart_;
00090 
00094     bool extendFromGoal_;
00095 
00099     extraConnectionCheckFunc extraConnectionCheckFunc_;
00100 
00101   public:
00106     RRT(PathPlanner* planner);
00107 
00111     ~RRT();
00112 
00116     bool calcPath();
00117 
00122     void extendFromStart(bool b) { extendFromStart_ = b; }
00123 
00128     void extendFromGoal(bool b) { extendFromGoal_ = b; }
00129 
00133     void extractPath();
00134 
00138     void extractPath(std::vector<Configuration>& o_path);
00139 
00144     RoadmapPtr getForwardTree() { return Tstart_; }
00145 
00150     void setForwardTree(RoadmapPtr tree);
00151 
00156     RoadmapPtr getBackwardTree() { return Tgoal_; }
00157 
00162     RoadmapPtr getLastExtendedTree() { return TlastExtended_; }
00163 
00168     void setBackwardTree(RoadmapPtr tree);
00169 
00174     bool extendOneStep();
00175 
00180     void epsilon(double e) { eps_ = e; }
00181 
00186     void setExtraConnectionCheckFunc(extraConnectionCheckFunc i_func);
00187   };
00188 };
00189 
00190 
00191 #endif // __RRT_H__


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Apr 11 2019 03:30:19