hpp-manipulation  6.0.0
Classes for manipulation planning.
graph.hh
Go to the documentation of this file.
1 // Copyright (c) 2014, LAAS-CNRS
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
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_STEERING_METHOD_GRAPH_HH
30 #define HPP_MANIPULATION_STEERING_METHOD_GRAPH_HH
31 
32 #include <hpp/core/problem-solver.hh> // SteeringMethodBuilder_t
33 #include <hpp/core/steering-method.hh>
35 #include <hpp/manipulation/fwd.hh>
38 
39 namespace hpp {
40 namespace manipulation {
43 class HPP_MANIPULATION_DLLAPI SteeringMethod : public core::SteeringMethod {
44  public:
46  return steeringMethod_;
47  }
48 
50  steeringMethod_ = sm;
51  }
52 
53  protected:
56 
59 
60  void init(SteeringMethodWkPtr_t weak) { core::SteeringMethod::init(weak); }
61 
66 };
67 
68 namespace steeringMethod {
69 using core::PathPtr_t;
70 
72  typedef core::SteeringMethodBuilder_t SteeringMethodBuilder_t;
73 
74  public:
77  static GraphPtr_t create(const core::ProblemConstPtr_t& problem);
78 
79  template <typename T>
80  static GraphPtr_t create(const core::ProblemConstPtr_t& problem);
81 
83  static GraphPtr_t createCopy(const GraphPtr_t& other);
84 
86  virtual core::SteeringMethodPtr_t copy() const {
87  return createCopy(weak_.lock());
88  }
89 
90  protected:
92  Graph(const ProblemConstPtr_t& problem);
93 
95  Graph(const Graph&);
96 
97  virtual PathPtr_t impl_compute(ConfigurationIn_t q1,
98  ConfigurationIn_t q2) const;
99 
100  void init(GraphWkPtr_t weak) {
101  SteeringMethod::init(weak);
102  weak_ = weak;
103  }
104 
105  private:
107  GraphWkPtr_t weak_;
108 };
109 
110 template <typename T>
112  GraphPtr_t gsm = Graph::create(problem);
113  gsm->innerSteeringMethod(T::create(problem));
114  return gsm;
115 }
116 } // namespace steeringMethod
118 } // namespace manipulation
119 } // namespace hpp
120 
121 #endif // HPP_MANIPULATION_STEERING_METHOD_GRAPH_HH
Definition: graph.hh:43
SteeringMethod(const SteeringMethod &other)
Copy constructor.
void innerSteeringMethod(const core::SteeringMethodPtr_t &sm)
Definition: graph.hh:49
core::SteeringMethodPtr_t steeringMethod_
The encapsulated steering method.
Definition: graph.hh:65
ProblemConstPtr_t problem_
A pointer to the manipulation problem.
Definition: graph.hh:63
SteeringMethod(const ProblemConstPtr_t &problem)
Constructor.
void init(SteeringMethodWkPtr_t weak)
Definition: graph.hh:60
const core::SteeringMethodPtr_t & innerSteeringMethod() const
Definition: graph.hh:45
Graph(const Graph &)
Copy constructor.
void init(GraphWkPtr_t weak)
Definition: graph.hh:100
static GraphPtr_t create(const core::ProblemConstPtr_t &problem)
Graph(const ProblemConstPtr_t &problem)
Constructor.
static GraphPtr_t createCopy(const GraphPtr_t &other)
Create copy and return shared pointer.
virtual core::SteeringMethodPtr_t copy() const
Copy instance and return shared pointer.
Definition: graph.hh:86
virtual PathPtr_t impl_compute(ConfigurationIn_t q1, ConfigurationIn_t q2) const
#define HPP_MANIPULATION_DLLAPI
Definition: config.hh:88
shared_ptr< Graph > GraphPtr_t
Definition: fwd.hh:41
shared_ptr< const Problem > ProblemConstPtr_t
Definition: fwd.hh:66
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:49
shared_ptr< SteeringMethod > SteeringMethodPtr_t
Definition: fwd.hh:112
Definition: main.hh:1