Skip to content
Snippets Groups Projects
Commit 5ae2433c authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

Make GraphPathValidation not mandatory (may be deleted ?)

parent f8bc475d
No related branches found
No related tags found
No related merge requests found
...@@ -49,9 +49,11 @@ namespace hpp { ...@@ -49,9 +49,11 @@ namespace hpp {
/// Check whether the problem is well formulated. /// Check whether the problem is well formulated.
virtual void checkProblem () const; virtual void checkProblem () const;
/// Get the path validation as a GraphPathValidation /// Expose parent method.
GraphPathValidationPtr_t pathValidation () const; PathValidationPtr_t pathValidation () const;
/// \param pathValidation if of type GraphPathValidation, sets
/// its constraint graph to Problem::constraintGraph()
void pathValidation (const PathValidationPtr_t& pathValidation); void pathValidation (const PathValidationPtr_t& pathValidation);
/// Get the steering method as a SteeringMethod /// Get the steering method as a SteeringMethod
......
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
#include <hpp/core/path-projector/dichotomy.hh> #include <hpp/core/path-projector/dichotomy.hh>
#include <hpp/core/path-projector/global.hh> #include <hpp/core/path-projector/global.hh>
#include <hpp/core/path-projector/recursive-hermite.hh> #include <hpp/core/path-projector/recursive-hermite.hh>
#include <hpp/core/path-validation/discretized-collision-checking.hh>
#include <hpp/core/path-validation/discretized-joint-bound.hh>
#include <hpp/core/continuous-validation/dichotomy.hh>
#include <hpp/core/continuous-validation/progressive.hh>
#include <hpp/core/roadmap.hh> #include <hpp/core/roadmap.hh>
#include <hpp/core/steering-method/dubins.hh> #include <hpp/core/steering-method/dubins.hh>
#include <hpp/core/steering-method/hermite.hh> #include <hpp/core/steering-method/hermite.hh>
...@@ -74,6 +78,16 @@ namespace hpp { ...@@ -74,6 +78,16 @@ namespace hpp {
static bool removeLockedJoints () { return false; } static bool removeLockedJoints () { return false; }
}; };
#define MAKE_GRAPH_PATH_VALIDATION_BUILDER(name, function) \
PathValidationPtr_t create ## name ## GraphPathValidation ( \
const core::DevicePtr_t& robot, const value_type& stepSize) \
{ \
return GraphPathValidation::create (function (robot, stepSize)); \
}
MAKE_GRAPH_PATH_VALIDATION_BUILDER(DiscretizedCollision , core::pathValidation::createDiscretizedCollisionChecking)
MAKE_GRAPH_PATH_VALIDATION_BUILDER(DiscretizedJointBound , core::pathValidation::createDiscretizedJointBound)
//MAKE_GRAPH_PATH_VALIDATION_BUILDER(DiscretizedCollisionAndJointBound, createDiscretizedJointBoundAndCollisionChecking)
template <typename ParentSM_t, typename ChildSM_t> template <typename ParentSM_t, typename ChildSM_t>
core::SteeringMethodPtr_t createSMWithGuess core::SteeringMethodPtr_t createSMWithGuess
(const core::Problem& problem) (const core::Problem& problem)
...@@ -110,6 +124,15 @@ namespace hpp { ...@@ -110,6 +124,15 @@ namespace hpp {
pathPlanners.add ("M-RRT", ManipulationPlanner::create); pathPlanners.add ("M-RRT", ManipulationPlanner::create);
pathPlanners.add ("SymbolicPlanner", SymbolicPlanner::create); pathPlanners.add ("SymbolicPlanner", SymbolicPlanner::create);
pathValidations.add ("Graph-Discretized" , createDiscretizedCollisionGraphPathValidation);
pathValidations.add ("Graph-DiscretizedCollision" , createDiscretizedCollisionGraphPathValidation);
pathValidations.add ("Graph-DiscretizedJointBound" , createDiscretizedJointBoundGraphPathValidation);
//pathValidations.add ("Graph-DiscretizedCollisionAndJointBound", createDiscretizedCollisionAndJointBoundGraphPathValidation);
pathValidations.add ("Graph-Dichotomy" , GraphPathValidation::create<core::continuousValidation::Dichotomy >);
pathValidations.add ("Graph-Progressive", GraphPathValidation::create<core::continuousValidation::Progressive>);
pathValidationType ("Graph-Discretized", 0.05);
pathOptimizers.add ("RandomShortcut", pathOptimizers.add ("RandomShortcut",
pathOptimization::RandomShortcut::create); pathOptimization::RandomShortcut::create);
pathOptimizers.add ("Graph-RandomShortcut", pathOptimizers.add ("Graph-RandomShortcut",
...@@ -179,11 +202,8 @@ namespace hpp { ...@@ -179,11 +202,8 @@ namespace hpp {
{ {
problem_ = problem; problem_ = problem;
core::ProblemSolver::initializeProblem (problem_); core::ProblemSolver::initializeProblem (problem_);
if (constraintGraph_) { if (constraintGraph_)
problem_->constraintGraph (constraintGraph_); problem_->constraintGraph (constraintGraph_);
if (problem_->pathValidation ())
problem_->pathValidation ()->constraintGraph (constraintGraph_);
}
} }
void ProblemSolver::constraintGraph (const std::string& graphName) void ProblemSolver::constraintGraph (const std::string& graphName)
......
...@@ -51,24 +51,24 @@ namespace hpp { ...@@ -51,24 +51,24 @@ namespace hpp {
{ {
graph_ = graph; graph_ = graph;
graph_->problem (wkPtr_.lock()); graph_->problem (wkPtr_.lock());
if (pathValidation ())
pathValidation ()->constraintGraph (graph); GraphPathValidationPtr_t pv = HPP_DYNAMIC_PTR_CAST(GraphPathValidation, pathValidation());
if (pv) pv->constraintGraph (graph_);
WeighedDistancePtr_t d = HPP_DYNAMIC_PTR_CAST (WeighedDistance, WeighedDistancePtr_t d = HPP_DYNAMIC_PTR_CAST (WeighedDistance,
distance ()); distance ());
if (d) d->constraintGraph (graph); if (d) d->constraintGraph (graph);
} }
GraphPathValidationPtr_t Problem::pathValidation () const PathValidationPtr_t Problem::pathValidation () const
{ {
return HPP_DYNAMIC_PTR_CAST (GraphPathValidation, return Parent::pathValidation();
Parent::pathValidation());
} }
void Problem::pathValidation (const PathValidationPtr_t& pathValidation) void Problem::pathValidation (const PathValidationPtr_t& pathValidation)
{ {
GraphPathValidationPtr_t pv (GraphPathValidation::create (pathValidation)); GraphPathValidationPtr_t pv = HPP_DYNAMIC_PTR_CAST(GraphPathValidation, pathValidation);
pv->constraintGraph (graph_); if (pv) pv->constraintGraph (graph_);
Parent::pathValidation (pv); Parent::pathValidation (pathValidation);
} }
PathValidationPtr_t Problem::pathValidationFactory () const PathValidationPtr_t Problem::pathValidationFactory () const
...@@ -79,6 +79,8 @@ namespace hpp { ...@@ -79,6 +79,8 @@ namespace hpp {
for (core::ObjectStdVector_t::const_iterator _obs = obstacles.begin (); for (core::ObjectStdVector_t::const_iterator _obs = obstacles.begin ();
_obs != obstacles.end (); ++_obs) _obs != obstacles.end (); ++_obs)
pv->addObstacle (*_obs); pv->addObstacle (*_obs);
GraphPathValidationPtr_t gpv = HPP_DYNAMIC_PTR_CAST(GraphPathValidation, pv);
if (gpv) return gpv->innerValidation();
return pv; return pv;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment