hpp-core  6.0.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 
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_STEERING_METHOD_SPLINE_HH
31 #define HPP_CORE_STEERING_METHOD_SPLINE_HH
32 
33 #include <hpp/core/config.hh>
34 #include <hpp/core/fwd.hh>
36 #include <hpp/util/debug.hh>
37 #include <hpp/util/pointer.hh>
38 
39 namespace hpp {
40 namespace core {
41 namespace steeringMethod {
44 
47 template <int _PolynomeBasis, int _SplineOrder>
49  public:
50  enum { PolynomeBasis = _PolynomeBasis, SplineOrder = _SplineOrder };
53 
54  typedef shared_ptr<Spline> Ptr_t;
55  typedef weak_ptr<Spline> WkPtr_t;
56 
57  static Ptr_t create(const ProblemConstPtr_t& problem) {
58  Spline* ptr = new Spline(problem);
59  Ptr_t shPtr(ptr);
60  ptr->init(shPtr);
61  return shPtr;
62  }
63 
65  static Ptr_t createCopy(const Ptr_t& other) {
66  Spline* ptr = new Spline(*other);
67  Ptr_t shPtr(ptr);
68  ptr->init(shPtr);
69  return shPtr;
70  }
71 
73  virtual SteeringMethodPtr_t copy() const { return createCopy(weak_.lock()); }
74 
77  ConfigurationIn_t q2) const;
78 
86  PathPtr_t steer(ConfigurationIn_t q1, std::vector<int> order1,
87  matrixIn_t derivatives1, ConfigurationIn_t q2,
88  std::vector<int> order2, matrixIn_t derivatives2,
89  value_type length = -1) const;
90 
91  protected:
93  Spline(const ProblemConstPtr_t& problem);
94 
96  Spline(const Spline& other);
97 
99  void init(WkPtr_t weak) {
100  SteeringMethod::init(weak);
101  weak_ = weak;
102  }
103 
104  private:
106  template <typename Derived>
107  PathPtr_t impl_compute(ConfigurationIn_t q1, std::vector<int> order1,
108  const Eigen::MatrixBase<Derived>& derivatives1,
109  ConfigurationIn_t q2, std::vector<int> order2,
110  const Eigen::MatrixBase<Derived>& derivatives2,
111  value_type length) const;
112 
113  DeviceWkPtr_t device_;
114  WkPtr_t weak_;
115 }; // Spline
117 } // namespace steeringMethod
118 } // namespace core
119 } // namespace hpp
120 #endif // HPP_CORE_STEERING_METHOD_REEDS_SHEPP_HH
Definition: steering-method.hh:48
void init(SteeringMethodWkPtr_t weak)
Store weak pointer to itself.
Definition: steering-method.hh:110
Definition: spline.hh:91
shared_ptr< Spline > Ptr_t
Definition: spline.hh:111
Definition: spline.hh:48
Spline(const ProblemConstPtr_t &problem)
Constructor.
void init(WkPtr_t weak)
Store weak pointer to itself.
Definition: spline.hh:99
PathPtr_t steer(ConfigurationIn_t q1, std::vector< int > order1, matrixIn_t derivatives1, ConfigurationIn_t q2, std::vector< int > order2, matrixIn_t derivatives2, value_type length=-1) const
SplinePath::Ptr_t SplinePathPtr_t
Definition: spline.hh:52
static Ptr_t create(const ProblemConstPtr_t &problem)
Definition: spline.hh:57
shared_ptr< Spline > Ptr_t
Definition: spline.hh:54
Spline(const Spline &other)
Copy constructor.
static Ptr_t createCopy(const Ptr_t &other)
Copy instance and return shared pointer.
Definition: spline.hh:65
path::Spline< PolynomeBasis, SplineOrder > SplinePath
Definition: spline.hh:51
virtual SteeringMethodPtr_t copy() const
Copy instance and return shared pointer.
Definition: spline.hh:73
weak_ptr< Spline > WkPtr_t
Definition: spline.hh:55
virtual PathPtr_t impl_compute(ConfigurationIn_t q1, ConfigurationIn_t q2) const
create a path between two configurations
#define HPP_CORE_DLLAPI
Definition: config.hh:88
pinocchio::DeviceWkPtr_t DeviceWkPtr_t
Definition: fwd.hh:135
pinocchio::value_type value_type
Definition: fwd.hh:174
shared_ptr< SteeringMethod > SteeringMethodPtr_t
Definition: fwd.hh:213
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:108
shared_ptr< const Problem > ProblemConstPtr_t
Definition: fwd.hh:197
constraints::matrixIn_t matrixIn_t
Definition: fwd.hh:166
shared_ptr< Path > PathPtr_t
Definition: fwd.hh:187
Definition: bi-rrt-planner.hh:35