hpp-manipulation  6.0.0
Classes for manipulation planning.
cross-state-optimization.hh
Go to the documentation of this file.
1 // Copyright (c) 2017, Joseph Mirabel
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr),
3 // Florent Lamiraux (florent.lamiraux@laas.fr)
4 //
5 
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are
8 // met:
9 //
10 // 1. Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 //
13 // 2. Redistributions in binary form must reproduce the above copyright
14 // notice, this list of conditions and the following disclaimer in the
15 // documentation and/or other materials provided with the distribution.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
28 // DAMAGE.
29 
30 #ifndef HPP_MANIPULATION_STEERING_METHOD_CROSS_STATE_OPTIMIZATION_HH
31 #define HPP_MANIPULATION_STEERING_METHOD_CROSS_STATE_OPTIMIZATION_HH
32 
33 #include <hpp/core/config-projector.hh>
34 #include <hpp/core/steering-method.hh>
36 #include <hpp/manipulation/fwd.hh>
40 
41 namespace hpp {
42 namespace manipulation {
43 namespace steeringMethod {
46 
100  public:
101  struct OptimizationData;
102 
104 
107  const core::ProblemConstPtr_t& problem);
108 
109  template <typename T>
110  static CrossStateOptimizationPtr_t create(
111  const core::ProblemConstPtr_t& problem);
112 
114 
115  protected:
117  : SteeringMethod(problem), sameRightHandSide_() {
118  gatherGraphConstraints();
119  }
120 
122  : SteeringMethod(other),
123  constraints_(other.constraints_),
124  index_(other.index_),
125  sameRightHandSide_(other.sameRightHandSide_),
126  weak_() {}
127 
128  core::PathPtr_t impl_compute(ConfigurationIn_t q1,
129  ConfigurationIn_t q2) const;
130 
131  void init(CrossStateOptimizationWkPtr_t weak) {
132  SteeringMethod::init(weak);
133  weak_ = weak;
134  }
135 
136  private:
137  typedef constraints::solver::BySubstitution Solver_t;
138  struct GraphSearchData;
139 
141  void gatherGraphConstraints();
142 
145  bool findTransitions(GraphSearchData& data) const;
146 
148  graph::Edges_t getTransitionList(GraphSearchData& data,
149  const std::size_t& i) const;
150 
152  bool buildOptimizationProblem(OptimizationData& d,
153  const graph::Edges_t& transitions) const;
154 
156  bool solveOptimizationProblem(OptimizationData& d) const;
157 
158  bool checkConstantRightHandSide(OptimizationData& d, size_type index) const;
159 
160  core::PathVectorPtr_t buildPath(OptimizationData& d,
161  const graph::Edges_t& edges) const;
162 
163  bool contains(const Solver_t& solver, const ImplicitPtr_t& c) const;
164 
166  NumericalConstraints_t constraints_;
168  std::map<std::string, std::size_t> index_;
169 
172  std::map<ImplicitPtr_t, ImplicitPtr_t> sameRightHandSide_;
173 
175  CrossStateOptimizationWkPtr_t weak_;
176 }; // class CrossStateOptimization
178 
179 template <typename T>
181  const core::ProblemConstPtr_t& problem) {
183  gsm->innerSteeringMethod(T::create(problem));
184  return gsm;
185 }
186 } // namespace steeringMethod
187 } // namespace manipulation
188 } // namespace hpp
189 
190 #endif // HPP_MANIPULATION_STEERING_METHOD_CROSS_STATE_OPTIMIZATION_HH
Definition: graph.hh:43
void init(SteeringMethodWkPtr_t weak)
Definition: graph.hh:60
Definition: cross-state-optimization.hh:99
static CrossStateOptimizationPtr_t create(const ProblemConstPtr_t &problem)
core::PathPtr_t impl_compute(ConfigurationIn_t q1, ConfigurationIn_t q2) const
void init(CrossStateOptimizationWkPtr_t weak)
Definition: cross-state-optimization.hh:131
static CrossStateOptimizationPtr_t create(const core::ProblemConstPtr_t &problem)
CrossStateOptimization(const ProblemConstPtr_t &problem)
Definition: cross-state-optimization.hh:116
CrossStateOptimization(const CrossStateOptimization &other)
Definition: cross-state-optimization.hh:121
#define HPP_MANIPULATION_DLLAPI
Definition: config.hh:88
std::vector< EdgePtr_t > Edges_t
Definition: fwd.hh:57
shared_ptr< CrossStateOptimization > CrossStateOptimizationPtr_t
Definition: fwd.hh:43
core::NumericalConstraints_t NumericalConstraints_t
Definition: fwd.hh:143
shared_ptr< const Problem > ProblemConstPtr_t
Definition: fwd.hh:66
constraints::ImplicitPtr_t ImplicitPtr_t
Definition: fwd.hh:131
core::size_type size_type
Definition: fwd.hh:90
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:49
shared_ptr< SteeringMethod > SteeringMethodPtr_t
Definition: fwd.hh:112
Definition: main.hh:1