diff --git a/include/hpp/manipulation/problem-solver.hh b/include/hpp/manipulation/problem-solver.hh index 33dda8ae8df685a4e76206c15f0db24b6a4fd7e8..932042a4ffd793c4268f4d590e940e7ea8cd0ebc 100644 --- a/include/hpp/manipulation/problem-solver.hh +++ b/include/hpp/manipulation/problem-solver.hh @@ -36,7 +36,7 @@ namespace hpp { { } ProblemSolver () : core::ProblemSolver (), robot_ (), - robotsAndObjects_ (), graspsMap_() + robotsAndObjects_ (), graspsMap_(), lockedDofConstraintMap_() { } /// Set robot @@ -105,6 +105,19 @@ namespace hpp { /// return NULL if no grasp named graspName GraspPtr_t grasp(const DifferentiableFunctionPtr_t& constraint) const; + /// Add a LockedDof constraint to the map + /// \param name key of the constraint as stored in an internal map. + /// \param lockedDof the constraint to add. + void addLockedDofConstraint (const std::string& name, + const LockedDofPtr_t& lockedDof) + { + lockedDofConstraintMap_ [name] = lockedDof; + } + + /// Get a LockedDof constraint by name + /// \param name key of the constraint as stored in an internal map. + LockedDofPtr_t lockedDofConstraint (const std::string& name) const; + /// Reset constraint set and put back the disable collisions /// between gripper and handle virtual void resetConstraints (); @@ -129,6 +142,7 @@ namespace hpp { /// Map of single robots to store before building a composite robot. RobotsandObjects_t robotsAndObjects_; GraspsMap_t graspsMap_; + LockedDofConstraintMap_t lockedDofConstraintMap_; }; // class ProblemSolver } // namespace manipulation } // namespace hpp diff --git a/src/problem-solver.cc b/src/problem-solver.cc index 501b9ea2cb7ea67f7eac1ba0d8bbdc59395a99ad..2e48ae6216334a1d04417f96c4f752023fb0468b 100644 --- a/src/problem-solver.cc +++ b/src/problem-solver.cc @@ -69,6 +69,16 @@ namespace hpp { return object; } + LockedDofPtr_t ProblemSolver::lockedDofConstraint (const std::string& name) const + { + LockedDofConstraintMap_t::const_iterator it = + lockedDofConstraintMap_.find (name); + if (it == lockedDofConstraintMap_.end ()) { + throw std::runtime_error ("No LockedDof constraint with this name"); + } + return it->second; + } + GraspPtr_t ProblemSolver::grasp ( const DifferentiableFunctionPtr_t& constraint) const {