hpp-core  4.9.0
Implement basic classes for canonical path planning for kinematic chains.
spline.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2017 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_STEERING_METHOD_SPLINE_HH
20 # define HPP_CORE_STEERING_METHOD_SPLINE_HH
21 
22 # include <hpp/util/debug.hh>
23 # include <hpp/util/pointer.hh>
24 
25 # include <hpp/core/fwd.hh>
26 # include <hpp/core/config.hh>
28 
29 namespace hpp {
30  namespace core {
31  namespace steeringMethod {
34 
37  template <int _PolynomeBasis, int _SplineOrder>
38  class HPP_CORE_DLLAPI Spline : public SteeringMethod
39  {
40  public:
41  enum {
42  PolynomeBasis = _PolynomeBasis,
43  SplineOrder = _SplineOrder
44  };
47 
48  typedef boost::shared_ptr<Spline> Ptr_t;
49  typedef boost::weak_ptr<Spline> WkPtr_t;
50 
51  static Ptr_t create (const Problem& problem)
52  {
53  Spline* ptr = new Spline (problem);
54  Ptr_t shPtr (ptr);
55  ptr->init (shPtr);
56  return shPtr;
57  }
58 
60  static Ptr_t createCopy (const Ptr_t& other)
61  {
62  Spline* ptr = new Spline (*other);
63  Ptr_t shPtr (ptr);
64  ptr->init (shPtr);
65  return shPtr;
66  }
67 
69  virtual SteeringMethodPtr_t copy () const
70  {
71  return createCopy (weak_.lock ());
72  }
73 
75  virtual PathPtr_t impl_compute (ConfigurationIn_t q1,
76  ConfigurationIn_t q2) const;
77 
79  PathPtr_t steer (ConfigurationIn_t q1, std::vector<int> order1, matrixIn_t derivatives1,
80  ConfigurationIn_t q2, std::vector<int> order2, matrixIn_t derivatives2) const;
81 
82  protected:
84  Spline (const Problem& problem);
85 
87  Spline (const Spline& other);
88 
90  void init (WkPtr_t weak)
91  {
92  SteeringMethod::init (weak);
93  weak_ = weak;
94  }
95 
96  private:
98  template <typename Derived>
99  PathPtr_t impl_compute (
100  ConfigurationIn_t q1, std::vector<int> order1, const Eigen::MatrixBase<Derived>& derivatives1,
101  ConfigurationIn_t q2, std::vector<int> order2, const Eigen::MatrixBase<Derived>& derivatives2) const;
102 
103  DeviceWkPtr_t device_;
104  WkPtr_t weak_;
105  }; // Spline
107  } // namespace steeringMethod
108  } // namespace core
109 } // namespace hpp
110 #endif // HPP_CORE_STEERING_METHOD_REEDS_SHEPP_HH
boost::shared_ptr< Spline > Ptr_t
Definition: spline.hh:100
boost::shared_ptr< Path > PathPtr_t
Definition: fwd.hh:170
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:97
Definition: problem.hh:48
SplinePath::Ptr_t SplinePathPtr_t
Definition: spline.hh:46
pinocchio::DeviceWkPtr_t DeviceWkPtr_t
Definition: fwd.hh:115
boost::weak_ptr< Spline > WkPtr_t
Definition: spline.hh:49
virtual SteeringMethodPtr_t copy() const
Copy instance and return shared pointer.
Definition: spline.hh:69
static Ptr_t createCopy(const Ptr_t &other)
Copy instance and return shared pointer.
Definition: spline.hh:60
static Ptr_t create(const Problem &problem)
Definition: spline.hh:51
void init(SteeringMethodWkPtr_t weak)
Store weak pointer to itself.
Definition: steering-method.hh:114
constraints::matrixIn_t matrixIn_t
Definition: fwd.hh:149
void init(WkPtr_t weak)
Store weak pointer to itself.
Definition: spline.hh:90
boost::shared_ptr< Spline > Ptr_t
Definition: spline.hh:48
Definition: fwd.hh:224
path::Spline< PolynomeBasis, SplineOrder > SplinePath
Definition: spline.hh:45
boost::shared_ptr< SteeringMethod > SteeringMethodPtr_t
Definition: fwd.hh:194