hpp-core  4.12.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 // This file is part of hpp-core
6 // hpp-core is free software: you can redistribute it
7 // and/or modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation, either version
9 // 3 of the License, or (at your option) any later version.
10 //
11 // hpp-core is distributed in the hope that it will be
12 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Lesser Public License for more details. You should have
15 // received a copy of the GNU Lesser General Public License along with
16 // hpp-core If not, see
17 // <http://www.gnu.org/licenses/>.
18 
19 #ifndef HPP_CORE_PATH_OPTIMIZATION_PARTIAL_SHORTCUT_HH
20 # define HPP_CORE_PATH_OPTIMIZATION_PARTIAL_SHORTCUT_HH
21 
23 
24 namespace hpp {
25  namespace core {
26  namespace pathOptimization {
27 
28  typedef std::vector <JointConstPtr_t> JointStdVector_t;
29 
32 
46  static bool removeLockedJoints ()
47  { return true; }
48  static bool onlyFullShortcut ()
49  { return false; }
51  { return 5; }
53  { return 1e-3; }
54  };
55 
57  {
58  public:
60  template < typename Traits > static
61  PartialShortcutPtr_t createWithTraits
62  (const ProblemConstPtr_t& problem);
63 
65  static PartialShortcutPtr_t create (const ProblemConstPtr_t& problem);
66 
68  virtual PathVectorPtr_t optimize (const PathVectorPtr_t& path);
69 
70  struct Parameters {
76 
80 
85 
90 
91  Parameters ();
92  } parameters;
93 
94  protected:
95  PartialShortcut (const ProblemConstPtr_t& problem);
96 
97  private:
98  PathVectorPtr_t generatePath (PathVectorPtr_t path, JointConstPtr_t joint,
99  const value_type t1, ConfigurationIn_t q1,
100  const value_type t2, ConfigurationIn_t q2) const;
101 
102  JointStdVector_t generateJointVector(const PathVectorPtr_t& pv) const;
103 
110  PathVectorPtr_t optimizeFullPath (const PathVectorPtr_t& pv,
111  const JointStdVector_t &jvIn, JointStdVector_t &jvOut) const;
112 
117  PathVectorPtr_t optimizeRandom (const PathVectorPtr_t& pv,
118  const JointStdVector_t &jv) const;
119  }; // class RandomShortcut
121 
122  template < typename Traits > PartialShortcutPtr_t
124  {
125  PartialShortcut* ptr = new PartialShortcut (problem);
126  ptr->parameters.removeLockedJoints = Traits::removeLockedJoints();
127  ptr->parameters.onlyFullShortcut = Traits::onlyFullShortcut();
128  ptr->parameters.progressionMargin = Traits::progressionMargin ();
130  Traits::numberOfConsecutiveFailurePerJoints();
131  return PartialShortcutPtr_t (ptr);
132  }
133  } // namespace pathOptimization
134  } // namespace core
135 } // namespace hpp
136 #endif // HPP_CORE_PATH_OPTIMIZATION_PARTIAL_SHORTCUT_HH
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:97
shared_ptr< PathVector > PathVectorPtr_t
Definition: fwd.hh:176
Definition: bi-rrt-planner.hh:24
shared_ptr< const Problem > ProblemConstPtr_t
Definition: fwd.hh:180
bool removeLockedJoints
Definition: partial-shortcut.hh:75
pinocchio::JointConstPtr_t JointConstPtr_t
Definition: fwd.hh:132
static std::size_t numberOfConsecutiveFailurePerJoints()
Definition: partial-shortcut.hh:50
Definition: partial-shortcut.hh:45
std::size_t numberOfConsecutiveFailurePerJoints
Definition: partial-shortcut.hh:84
static bool removeLockedJoints()
Definition: partial-shortcut.hh:46
static value_type progressionMargin()
Definition: partial-shortcut.hh:52
Definition: path-optimizer.hh:34
shared_ptr< PartialShortcut > PartialShortcutPtr_t
Definition: fwd.hh:276
pinocchio::value_type value_type
Definition: fwd.hh:157
bool onlyFullShortcut
Definition: partial-shortcut.hh:79
struct hpp::core::pathOptimization::PartialShortcut::Parameters parameters
std::vector< JointConstPtr_t > JointStdVector_t
Definition: partial-shortcut.hh:28
Definition: partial-shortcut.hh:56
static PartialShortcutPtr_t createWithTraits(const ProblemConstPtr_t &problem)
Return shared pointer to new object.
Definition: partial-shortcut.hh:123
value_type progressionMargin
Definition: partial-shortcut.hh:89
static bool onlyFullShortcut()
Definition: partial-shortcut.hh:48
#define HPP_CORE_DLLAPI
Definition: config.hh:64