hpp-core  6.0.0
Implement basic classes for canonical path planning for kinematic chains.
partial-shortcut.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015 CNRS
3 // Authors: Joseph Mirabel
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_CORE_PATH_OPTIMIZATION_PARTIAL_SHORTCUT_HH
31 #define HPP_CORE_PATH_OPTIMIZATION_PARTIAL_SHORTCUT_HH
32 
34 
35 namespace hpp {
36 namespace core {
37 namespace pathOptimization {
38 
39 typedef std::vector<JointConstPtr_t> JointStdVector_t;
40 
43 
57  static bool removeLockedJoints() { return true; }
58  static bool onlyFullShortcut() { return false; }
59  static std::size_t numberOfConsecutiveFailurePerJoints() { return 5; }
60  static value_type progressionMargin() { return 1e-3; }
61 };
62 
64  public:
66  template <typename Traits>
67  static PartialShortcutPtr_t createWithTraits(
68  const ProblemConstPtr_t& problem);
69 
72 
75 
76  struct Parameters {
82 
86 
91 
96 
98  } parameters;
99 
100  protected:
102 
103  private:
104  PathVectorPtr_t generatePath(PathVectorPtr_t path, JointConstPtr_t joint,
105  const value_type t1, ConfigurationIn_t q1,
106  const value_type t2, ConfigurationIn_t q2) const;
107 
108  JointStdVector_t generateJointVector(const PathVectorPtr_t& pv) const;
109 
116  PathVectorPtr_t optimizeFullPath(const PathVectorPtr_t& pv,
117  const JointStdVector_t& jvIn,
118  JointStdVector_t& jvOut) const;
119 
124  PathVectorPtr_t optimizeRandom(const PathVectorPtr_t& pv,
125  const JointStdVector_t& jv) const;
126 }; // class RandomShortcut
128 
129 template <typename Traits>
131  const ProblemConstPtr_t& problem) {
133  ptr->parameters.removeLockedJoints = Traits::removeLockedJoints();
134  ptr->parameters.onlyFullShortcut = Traits::onlyFullShortcut();
135  ptr->parameters.progressionMargin = Traits::progressionMargin();
137  Traits::numberOfConsecutiveFailurePerJoints();
138  return PartialShortcutPtr_t(ptr);
139 }
140 } // namespace pathOptimization
141 } // namespace core
142 } // namespace hpp
143 #endif // HPP_CORE_PATH_OPTIMIZATION_PARTIAL_SHORTCUT_HH
Definition: path-optimizer.hh:44
Definition: partial-shortcut.hh:63
virtual PathVectorPtr_t optimize(const PathVectorPtr_t &path)
Optimize path.
PartialShortcut(const ProblemConstPtr_t &problem)
struct hpp::core::pathOptimization::PartialShortcut::Parameters parameters
static PartialShortcutPtr_t create(const ProblemConstPtr_t &problem)
Return shared pointer to new object.
static PartialShortcutPtr_t createWithTraits(const ProblemConstPtr_t &problem)
Return shared pointer to new object.
Definition: partial-shortcut.hh:130
#define HPP_CORE_DLLAPI
Definition: config.hh:88
ProblemConstPtr_t problem() const
Get problem.
Definition: path-optimizer.hh:49
std::vector< JointConstPtr_t > JointStdVector_t
Definition: partial-shortcut.hh:39
shared_ptr< PartialShortcut > PartialShortcutPtr_t
Definition: fwd.hh:293
pinocchio::value_type value_type
Definition: fwd.hh:174
shared_ptr< PathVector > PathVectorPtr_t
Definition: fwd.hh:193
pinocchio::JointConstPtr_t JointConstPtr_t
Definition: fwd.hh:150
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:108
shared_ptr< const Problem > ProblemConstPtr_t
Definition: fwd.hh:197
Definition: bi-rrt-planner.hh:35
Definition: partial-shortcut.hh:56
static value_type progressionMargin()
Definition: partial-shortcut.hh:60
static std::size_t numberOfConsecutiveFailurePerJoints()
Definition: partial-shortcut.hh:59
static bool removeLockedJoints()
Definition: partial-shortcut.hh:57
static bool onlyFullShortcut()
Definition: partial-shortcut.hh:58
bool onlyFullShortcut
Definition: partial-shortcut.hh:85
bool removeLockedJoints
Definition: partial-shortcut.hh:81
std::size_t numberOfConsecutiveFailurePerJoints
Definition: partial-shortcut.hh:90
value_type progressionMargin
Definition: partial-shortcut.hh:95