diff --git a/include/hpp/manipulation/problem-solver.hh b/include/hpp/manipulation/problem-solver.hh index 406fc5c565e6b9a5c20e0022cff2b2944559919d..ee1fda93626722fb4c7f73bb7779b6d36dd0af53 100644 --- a/include/hpp/manipulation/problem-solver.hh +++ b/include/hpp/manipulation/problem-solver.hh @@ -31,10 +31,12 @@ namespace hpp { namespace manipulation { class HPP_MANIPULATION_DLLAPI ProblemSolver : public core::ProblemSolver, - public core::Container <LockedJointPtr_t>, - public core::Container <JointAndShapes_t> + public core::Containers < + boost::mpl::vector <LockedJointPtr_t, JointAndShapes_t> > { public: + typedef core::Containers < boost::mpl::vector + <LockedJointPtr_t, JointAndShapes_t> > ThisC_t; typedef core::ProblemSolver parent_t; typedef std::vector <std::string> Names_t; @@ -142,41 +144,6 @@ namespace hpp { return problem_; } - /// Get an element of a container - template <typename Element> - const Element& get (const std::string& name) const - { - return Container <Element>::get (name); - } - - /// Check if a Container has a key. - template <typename Element> - bool has (const std::string& name) const - { - return core::Container <Element>::has (name); - } - - /// Add an element to a container - template <typename Element> - void add (const std::string& name, const Element& element) - { - Container <Element>::add (name, element); - } - - /// Get the underlying map of a container - template <typename Element> - const typename core::Container<Element>::ElementMap_t& getAll () const - { - return Container <Element>::getAll (); - } - - /// Get the keys of a container - template <typename Element, typename ReturnType> - ReturnType getKeys () const - { - return Container <Element>::template getKeys <ReturnType> (); - } - protected: virtual void initializeProblem (ProblemPtr_t problem); diff --git a/src/graph/helper.cc b/src/graph/helper.cc index 9938530b8d9b046af992eb7a7b98b19beb1269de..5fd2e5d6bb3886e57e5d5467f1b4f1bc67766788 100644 --- a/src/graph/helper.cc +++ b/src/graph/helper.cc @@ -30,6 +30,7 @@ #include <hpp/manipulation/graph/node.hh> #include <hpp/manipulation/graph/edge.hh> #include <hpp/manipulation/graph/node-selector.hh> +#include <hpp/manipulation/graph/guided-node-selector.hh> #include <hpp/manipulation/problem-solver.hh> namespace hpp { @@ -864,12 +865,12 @@ namespace hpp { ps->createPlacementConstraint (placeN, od.shapes, envNames, margin); objects[i].get<0> ().get<0> () = - ps->get <NumericalConstraintPtr_t> (placeN); + ps->core::ProblemSolver::get <NumericalConstraintPtr_t> (placeN); if (prePlace) { ps->createPrePlacementConstraint ("pre" + placeN, od.shapes, envNames, margin, prePlaceWidth); objects[i].get<0> ().get<1> () = - ps->get <NumericalConstraintPtr_t> ("pre" + placeN); + ps->core::ProblemSolver::get <NumericalConstraintPtr_t> ("pre" + placeN); } } // Create object lock @@ -879,7 +880,7 @@ namespace hpp { LockedJointPtr_t lj = core::LockedJoint::create (oj, robot.currentConfiguration() .segment (oj->rankInConfiguration (), oj->configSize ())); - ps->add <LockedJointPtr_t> ("lock_" + oj->name (), lj); + ps->ProblemSolver::ThisC_t::add <LockedJointPtr_t> ("lock_" + oj->name (), lj); objects[i].get<0> ().get<2> ().push_back (lj); } ++i; diff --git a/src/problem-solver.cc b/src/problem-solver.cc index 621c187cc035bc2dd4f439bc06f9ffe5670d26e5..8f590ae90fba4293eb4cfd90d0f7f9de5ba31e3a 100644 --- a/src/problem-solver.cc +++ b/src/problem-solver.cc @@ -73,30 +73,31 @@ namespace hpp { ProblemSolver::ProblemSolver () : core::ProblemSolver (), robot_ (), problem_ (0x0), graspsMap_() { - add <core::PathPlannerBuilder_t> ("M-RRT", ManipulationPlanner::create); + parent_t::add<core::PathPlannerBuilder_t> + ("M-RRT", ManipulationPlanner::create); using core::PathValidationBuilder_t; - add <PathValidationBuilder_t> ("Graph-Discretized", + parent_t::add <PathValidationBuilder_t> ("Graph-Discretized", GraphPathValidation::create <core::DiscretizedCollisionChecking>); - add <PathValidationBuilder_t> ("Graph-Progressive", + parent_t::add <PathValidationBuilder_t> ("Graph-Progressive", GraphPathValidation::create < core::continuousCollisionChecking::Progressive >); using core::PathOptimizerBuilder_t; - add <PathOptimizerBuilder_t> ("Graph-RandomShortcut", + parent_t::add <PathOptimizerBuilder_t> ("Graph-RandomShortcut", GraphOptimizer::create <core::RandomShortcut>); - add <PathOptimizerBuilder_t> ("PartialShortcut", core::pathOptimization:: + parent_t::add <PathOptimizerBuilder_t> ("PartialShortcut", core::pathOptimization:: PartialShortcut::createWithTraits <PartialShortcutTraits>); - add <PathOptimizerBuilder_t> ("Graph-PartialShortcut", + parent_t::add <PathOptimizerBuilder_t> ("Graph-PartialShortcut", GraphOptimizer::create <core::pathOptimization::PartialShortcut>); - add <PathOptimizerBuilder_t> ("ConfigOptimization", + parent_t::add <PathOptimizerBuilder_t> ("ConfigOptimization", core::pathOptimization::ConfigOptimization::createWithTraits <pathOptimization::ConfigOptimizationTraits>); - add <PathOptimizerBuilder_t> ("Graph-ConfigOptimization", + parent_t::add <PathOptimizerBuilder_t> ("Graph-ConfigOptimization", GraphOptimizer::create < GraphConfigOptimizationTraits <pathOptimization::ConfigOptimizationTraits> >); using core::SteeringMethodBuilder_t; - add <SteeringMethodBuilder_t> ("Graph-SteeringMethodStraight", + parent_t::add <SteeringMethodBuilder_t> ("Graph-SteeringMethodStraight", GraphSteeringMethod::create <core::SteeringMethodStraight>); pathPlannerType ("M-RRT"); @@ -181,8 +182,8 @@ namespace hpp { if (robot_->has <JointAndShapes_t> (*it2)) l = robot_->get <JointAndShapes_t> (*it2); // and then environment triangles. - else if (has <JointAndShapes_t> (*it2)) - l = get <JointAndShapes_t> (*it2); + else if (ThisC_t::has <JointAndShapes_t> (*it2)) + l = ThisC_t::get <JointAndShapes_t> (*it2); else throw std::runtime_error ("Second list of triangles not found."); for (JointAndShapes_t::const_iterator it = l.begin (); it != l.end(); ++it) { @@ -229,8 +230,8 @@ namespace hpp { if (robot_->has <JointAndShapes_t> (*it2)) l = robot_->get <JointAndShapes_t> (*it2); // and then environment triangles. - else if (has <JointAndShapes_t> (*it2)) - l = get <JointAndShapes_t> (*it2); + else if (ThisC_t::has <JointAndShapes_t> (*it2)) + l = ThisC_t::get <JointAndShapes_t> (*it2); else throw std::runtime_error ("Second list of triangles not found."); for (JointAndShapes_t::const_iterator it = l.begin ();