hpp-core: include/hpp/core/steering-method/spline.hh Source File

hpp-core 9.0.2 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>
35#include <hpp/core/steering-method.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>
48 class HPP_CORE_DLLAPI Spline : public SteeringMethod {
49 public:
50 enum { PolynomeBasis = _PolynomeBasis, SplineOrder = _SplineOrder };
51 typedef path::Spline<PolynomeBasis, SplineOrder> SplinePath;
52 typedef typename SplinePath::Ptr_t SplinePathPtr_t;
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
76 virtual PathPtr_t impl_compute(ConfigurationIn_t q1,
77 ConfigurationIn_t q2) const;
78
90 PathPtr_t steer(ConfigurationIn_t q1, std::vector<int> order1,
91 matrixIn_t derivatives1, ConfigurationIn_t q2,
92 std::vector<int> order2, matrixIn_t derivatives2,
93 value_type length = -1, bool se3Output = false) const;
94
95 protected:
97 Spline(const ProblemConstPtr_t& problem);
98
100 Spline(const Spline& other);
101
103 void init(WkPtr_t weak) {
104 SteeringMethod::init(weak);
105 weak_ = weak;
106 }
107
108 private:
110 template <typename Derived>
111 PathPtr_t impl_compute(ConfigurationIn_t q1, std::vector<int> order1,
112 const Eigen::MatrixBase<Derived>& derivatives1,
113 ConfigurationIn_t q2, std::vector<int> order2,
114 const Eigen::MatrixBase<Derived>& derivatives2,
115 value_type length, bool se3Output = false) const;
116
117 DeviceWkPtr_t device_;
118 WkPtr_t weak_;
119}; // Spline
121} // namespace steeringMethod
122} // namespace core
123} // namespace hpp
124#endif // HPP_CORE_STEERING_METHOD_REEDS_SHEPP_HH
hpp::core::SteeringMethod
Definition steering-method.hh:48
hpp::core::path::Spline
Definition spline.hh:91
hpp::core::path::Spline::Ptr_t
shared_ptr< Spline > Ptr_t
Definition spline.hh:111
hpp::core::steeringMethod::Spline
Definition spline.hh:48
hpp::core::steeringMethod::Spline::Spline
Spline(const ProblemConstPtr_t &problem)
Constructor.
hpp::core::steeringMethod::Spline::steer
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, bool se3Output=false) const
hpp::core::steeringMethod::Spline::init
void init(WkPtr_t weak)
Store weak pointer to itself.
Definition spline.hh:103
hpp::core::steeringMethod::Spline::SplinePathPtr_t
SplinePath::Ptr_t SplinePathPtr_t
Definition spline.hh:52
hpp::core::steeringMethod::Spline::create
static Ptr_t create(const ProblemConstPtr_t &problem)
Definition spline.hh:57
hpp::core::steeringMethod::Spline::Ptr_t
shared_ptr< Spline > Ptr_t
Definition spline.hh:54
hpp::core::steeringMethod::Spline::Spline
Spline(const Spline &other)
Copy constructor.
hpp::core::steeringMethod::Spline::createCopy
static Ptr_t createCopy(const Ptr_t &other)
Copy instance and return shared pointer.
Definition spline.hh:65
hpp::core::steeringMethod::Spline::SplinePath
path::Spline< PolynomeBasis, SplineOrder > SplinePath
Definition spline.hh:51
hpp::core::steeringMethod::Spline::copy
virtual SteeringMethodPtr_t copy() const
Copy instance and return shared pointer.
Definition spline.hh:73
hpp::core::steeringMethod::Spline::WkPtr_t
weak_ptr< Spline > WkPtr_t
Definition spline.hh:55
hpp::core::steeringMethod::Spline::impl_compute
virtual PathPtr_t impl_compute(ConfigurationIn_t q1, ConfigurationIn_t q2) const
create a path between two configurations
config.hh
HPP_CORE_DLLAPI
#define HPP_CORE_DLLAPI
Definition config.hh:88
debug.hh
fwd.hh
hpp
hpp::core::DeviceWkPtr_t
pinocchio::DeviceWkPtr_t DeviceWkPtr_t
Definition fwd.hh:135
hpp::core::value_type
pinocchio::value_type value_type
Definition fwd.hh:174
hpp::core::SteeringMethodPtr_t
shared_ptr< SteeringMethod > SteeringMethodPtr_t
Definition fwd.hh:213
hpp::core::ConfigurationIn_t
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition fwd.hh:108
hpp::core::ProblemConstPtr_t
shared_ptr< const Problem > ProblemConstPtr_t
Definition fwd.hh:197
hpp::core::matrixIn_t
constraints::matrixIn_t matrixIn_t
Definition fwd.hh:166
hpp::core::PathPtr_t
shared_ptr< Path > PathPtr_t
Definition fwd.hh:187
pointer.hh
steering-method.hh