hpp-core  4.9.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 
56  class HPP_CORE_DLLAPI PartialShortcut : public PathOptimizer
57  {
58  public:
60  template < typename Traits > static
61  PartialShortcutPtr_t createWithTraits (const Problem& problem);
62 
64  static PartialShortcutPtr_t create (const Problem& problem);
65 
67  virtual PathVectorPtr_t optimize (const PathVectorPtr_t& path);
68 
69  struct Parameters {
75 
79 
84 
89 
90  Parameters ();
91  } parameters;
92 
93  protected:
94  PartialShortcut (const Problem& problem);
95 
96  private:
97  PathVectorPtr_t generatePath (PathVectorPtr_t path, JointConstPtr_t joint,
98  const value_type t1, ConfigurationIn_t q1,
99  const value_type t2, ConfigurationIn_t q2) const;
100 
101  JointStdVector_t generateJointVector(const PathVectorPtr_t& pv) const;
102 
109  PathVectorPtr_t optimizeFullPath (const PathVectorPtr_t& pv,
110  const JointStdVector_t &jvIn, JointStdVector_t &jvOut) const;
111 
116  PathVectorPtr_t optimizeRandom (const PathVectorPtr_t& pv,
117  const JointStdVector_t &jv) const;
118  }; // class RandomShortcut
120 
121  template < typename Traits > PartialShortcutPtr_t
123  {
124  PartialShortcut* ptr = new PartialShortcut (problem);
125  ptr->parameters.removeLockedJoints = Traits::removeLockedJoints();
126  ptr->parameters.onlyFullShortcut = Traits::onlyFullShortcut();
127  ptr->parameters.progressionMargin = Traits::progressionMargin ();
129  Traits::numberOfConsecutiveFailurePerJoints();
130  return PartialShortcutPtr_t (ptr);
131  }
132  } // namespace pathOptimization
133  } // namespace core
134 } // namespace hpp
135 #endif // HPP_CORE_PATH_OPTIMIZATION_PARTIAL_SHORTCUT_HH
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:97
Definition: problem.hh:48
ObjectFactory * create(ObjectFactory *parent=NULL, const XMLElement *element=NULL)
bool removeLockedJoints
Definition: partial-shortcut.hh:74
static PartialShortcutPtr_t createWithTraits(const Problem &problem)
Return shared pointer to new object.
Definition: partial-shortcut.hh:122
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:83
static bool removeLockedJoints()
Definition: partial-shortcut.hh:46
static value_type progressionMargin()
Definition: partial-shortcut.hh:52
Definition: path-optimizer.hh:32
pinocchio::value_type value_type
Definition: fwd.hh:157
bool onlyFullShortcut
Definition: partial-shortcut.hh:78
struct hpp::core::pathOptimization::PartialShortcut::Parameters parameters
std::vector< JointConstPtr_t > JointStdVector_t
Definition: partial-shortcut.hh:28
Definition: partial-shortcut.hh:56
boost::shared_ptr< PathVector > PathVectorPtr_t
Definition: fwd.hh:176
boost::shared_ptr< PartialShortcut > PartialShortcutPtr_t
Definition: fwd.hh:275
value_type progressionMargin
Definition: partial-shortcut.hh:88
static bool onlyFullShortcut()
Definition: partial-shortcut.hh:48