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
00036
00037 #ifndef OMPL_TOOLS_MULTIPLAN_PARALLEL_PLAN_
00038 #define OMPL_TOOLS_MULTIPLAN_PARALLEL_PLAN_
00039
00040 #include "ompl/base/Planner.h"
00041 #include "ompl/geometric/PathGeometric.h"
00042 #include <boost/thread.hpp>
00043
00044 namespace ompl
00045 {
00047 namespace geometric
00048 {
00049 ClassForward(PathHybridization);
00050 }
00052
00053 namespace tools
00054 {
00055
00063 class ParallelPlan
00064 {
00065 public:
00066
00068 ParallelPlan(const base::ProblemDefinitionPtr &pdef);
00069
00070 virtual ~ParallelPlan(void);
00071
00073 void addPlanner(const base::PlannerPtr &planner);
00074
00076 void addPlannerAllocator(const base::PlannerAllocator &pa);
00077
00079 void clearHybridizationPaths(void);
00080
00082 void clearPlanners(void);
00083
00085 const base::ProblemDefinitionPtr& getProblemDefinition(void) const
00086 {
00087 return pdef_;
00088 }
00089
00093 bool solve(double solveTime, bool hybridize = true);
00094
00098 bool solve(const base::PlannerTerminationCondition &ptc, bool hybridize = true);
00099
00104 bool solve(double solveTime, std::size_t minSolCount, std::size_t maxSolCount, bool hybridize = true);
00105
00110 bool solve(const base::PlannerTerminationCondition &ptc, std::size_t minSolCount, std::size_t maxSolCount, bool hybridize = true);
00111
00112 protected:
00113
00115 void solveOne(base::Planner *planner, std::size_t minSolCount, const base::PlannerTerminationCondition *ptc);
00116
00118 void solveMore(base::Planner *planner, std::size_t minSolCount, std::size_t maxSolCount, const base::PlannerTerminationCondition *ptc);
00119
00121 base::ProblemDefinitionPtr pdef_;
00122
00124 std::vector<base::PlannerPtr> planners_;
00125
00127 geometric::PathHybridizationPtr phybrid_;
00128
00130 boost::mutex phlock_;
00131
00133 msg::Interface msg_;
00134
00135 private:
00136
00138 unsigned int foundSolCount_;
00139
00141 boost::mutex foundSolCountLock_;
00142 };
00143
00144 }
00145 }
00146
00147 #endif