hpp-manipulation  6.0.0
Classes for manipulation planning.
problem-solver.hh
Go to the documentation of this file.
1 // Copyright (c) 2014 CNRS
2 // Author: Florent Lamiraux, Joseph Mirabel
3 //
4 
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // 1. Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27 // DAMAGE.
28 
29 #ifndef HPP_MANIPULATION_PROBLEM_SOLVER_HH
30 #define HPP_MANIPULATION_PROBLEM_SOLVER_HH
31 
32 #include <hpp/core/container.hh>
33 #include <hpp/core/problem-solver.hh>
34 #include <hpp/pinocchio/device.hh>
35 #include <map>
36 
40 #include "hpp/manipulation/fwd.hh"
42 
43 namespace hpp {
44 namespace manipulation {
45 class HPP_MANIPULATION_DLLAPI ProblemSolver : public core::ProblemSolver {
46  public:
47  typedef core::ProblemSolver parent_t;
48  typedef std::vector<std::string> Names_t;
49 
51  virtual ~ProblemSolver() {}
52 
54 
56 
59  virtual void robot(const core::DevicePtr_t& robot) {
60  robot_ = HPP_DYNAMIC_PTR_CAST(Device, robot);
61  assert(robot_);
62  parent_t::robot(robot);
63  }
64 
66  const DevicePtr_t& robot() const { return robot_; }
67 
70 
72  void constraintGraph(const std::string& graph);
73 
76 
80 
87  void createPlacementConstraint(const std::string& name,
88  const Strings_t& surface1,
89  const Strings_t& surface2,
90  const value_type& margin = 1e-4);
91 
99  void createPrePlacementConstraint(const std::string& name,
100  const Strings_t& surface1,
101  const Strings_t& surface2,
102  const value_type& width,
103  const value_type& margin = 1e-4);
104 
113  void createGraspConstraint(const std::string& name,
114  const std::string& gripper,
115  const std::string& handle);
116 
122  void createPreGraspConstraint(const std::string& name,
123  const std::string& gripper,
124  const std::string& handle);
125 
126  virtual void pathValidationType(const std::string& type,
127  const value_type& tolerance);
128 
130  virtual void resetProblem();
131 
133  virtual void resetRoadmap();
134 
136  ProblemPtr_t problem() const { return problem_; }
137 
139 
140  core::Container<graph::GraphPtr_t> graphs;
141 
143 
144  protected:
145  virtual void initializeProblem(ProblemPtr_t problem);
146 
147  private:
150  graph::GraphComponents_t components_;
151 
152  DevicePtr_t robot_;
154  ProblemPtr_t problem_;
155  graph::GraphPtr_t constraintGraph_;
156 }; // class ProblemSolver
157 } // namespace manipulation
158 } // namespace hpp
159 
160 #endif // HPP_MANIPULATION_PROBLEM_SOLVER_HH
Definition: device.hh:50
Definition: problem-solver.hh:45
void createPreGraspConstraint(const std::string &name, const std::string &gripper, const std::string &handle)
const DevicePtr_t & robot() const
Get robot.
Definition: problem-solver.hh:66
void createPrePlacementConstraint(const std::string &name, const Strings_t &surface1, const Strings_t &surface2, const value_type &width, const value_type &margin=1e-4)
void constraintGraph(const std::string &graph)
Set the constraint graph.
virtual void initializeProblem(ProblemPtr_t problem)
virtual void resetRoadmap()
Create a new Roadmap.
virtual void resetProblem()
Create a new problem.
graph::GraphPtr_t constraintGraph() const
Get the constraint graph.
std::vector< std::string > Names_t
Definition: problem-solver.hh:48
void createPlacementConstraint(const std::string &name, const Strings_t &surface1, const Strings_t &surface2, const value_type &margin=1e-4)
core::ProblemSolver parent_t
Definition: problem-solver.hh:47
core::Container< graph::GraphPtr_t > graphs
Definition: problem-solver.hh:140
virtual void robot(const core::DevicePtr_t &robot)
Definition: problem-solver.hh:59
void initConstraintGraph()
Should be called before any call on the graph is made.
virtual ~ProblemSolver()
Destructor.
Definition: problem-solver.hh:51
ConstraintsAndComplements_t constraintsAndComplements
Definition: problem-solver.hh:142
virtual void pathValidationType(const std::string &type, const value_type &tolerance)
void setTargetState(const graph::StatePtr_t state)
ProblemPtr_t problem() const
Get pointer to problem.
Definition: problem-solver.hh:136
static ProblemSolverPtr_t create()
void createGraspConstraint(const std::string &name, const std::string &gripper, const std::string &handle)
#define HPP_MANIPULATION_DLLAPI
Definition: config.hh:88
std::vector< ConstraintAndComplement_t > ConstraintsAndComplements_t
Definition: constraint-set.hh:87
shared_ptr< State > StatePtr_t
Definition: fwd.hh:48
std::vector< GraphComponentWkPtr_t > GraphComponents_t
Definition: fwd.hh:55
shared_ptr< Graph > GraphPtr_t
Definition: fwd.hh:47
shared_ptr< Problem > ProblemPtr_t
Definition: fwd.hh:65
core::value_type value_type
Definition: fwd.hh:89
shared_ptr< Device > DevicePtr_t
Definition: fwd.hh:40
std::vector< std::string > Strings_t
Definition: fwd.hh:159
Definition: main.hh:1