Skip to content
Snippets Groups Projects
Commit 68d96553 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Update to changes of core::Container

parent eb2dc046
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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;
......
......@@ -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 ();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment