hpp-core 4.14.0
Implement basic classes for canonical path planning for kinematic chains.
Loading...
Searching...
No Matches
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
39namespace hpp {
40namespace core {
41namespace steeringMethod {
44
47template <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
80 PathPtr_t steer(ConfigurationIn_t q1, std::vector<int> order1,
81 matrixIn_t derivatives1, ConfigurationIn_t q2,
82 std::vector<int> order2, matrixIn_t derivatives2) const;
83
84 protected:
86 Spline(const ProblemConstPtr_t& problem);
87
89 Spline(const Spline& other);
90
92 void init(WkPtr_t weak) {
93 SteeringMethod::init(weak);
94 weak_ = weak;
95 }
96
97 private:
99 template <typename Derived>
100 PathPtr_t impl_compute(ConfigurationIn_t q1, std::vector<int> order1,
101 const Eigen::MatrixBase<Derived>& derivatives1,
102 ConfigurationIn_t q2, std::vector<int> order2,
103 const Eigen::MatrixBase<Derived>& derivatives2) const;
104
105 DeviceWkPtr_t device_;
106 WkPtr_t weak_;
107}; // Spline
109} // namespace steeringMethod
110} // namespace core
111} // namespace hpp
112#endif // HPP_CORE_STEERING_METHOD_REEDS_SHEPP_HH
Definition: steering-method.hh:48
Definition: spline.hh:88
shared_ptr< Spline > Ptr_t
Definition: spline.hh:108
Definition: spline.hh:48
Spline(const ProblemConstPtr_t &problem)
Constructor.
void init(WkPtr_t weak)
Store weak pointer to itself.
Definition: spline.hh:92
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
PathPtr_t steer(ConfigurationIn_t q1, std::vector< int > order1, matrixIn_t derivatives1, ConfigurationIn_t q2, std::vector< int > order2, matrixIn_t derivatives2) const
create a path between two configurations
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:64
pinocchio::DeviceWkPtr_t DeviceWkPtr_t
Definition: fwd.hh:134
shared_ptr< SteeringMethod > SteeringMethodPtr_t
Definition: fwd.hh:212
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:106
shared_ptr< const Problem > ProblemConstPtr_t
Definition: fwd.hh:196
constraints::matrixIn_t matrixIn_t
Definition: fwd.hh:165
shared_ptr< Path > PathPtr_t
Definition: fwd.hh:186
Definition: bi-rrt-planner.hh:35