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

hpp-core 9.0.2 Implement basic classes for canonical path planning for kinematic chains.

Loading...
Searching...
No Matches
interpolated-steering-method.hh
Go to the documentation of this file.
1// Copyright (c) 2015 CNRS
2// Authors: Joseph Mirabel
3//
4
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions are
7// met:
8//
9// 1. Redistributions of source code must retain the above copyright
10// notice, this list of conditions and the following disclaimer.
11//
12// 2. Redistributions in binary form must reproduce the above copyright
13// notice, this list of conditions and the following disclaimer in the
14// documentation and/or other materials provided with the distribution.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27// DAMAGE.
28
29#ifndef HPP_CORE_STEERING_METHOD_INTERPOLATED_HH
30#define HPP_CORE_STEERING_METHOD_INTERPOLATED_HH
31
32#include <hpp/core/interpolated-path.hh>
33#include <hpp/core/steering-method.hh>
34#include <hpp/core/steering-method/fwd.hh>
35#include <hpp/core/weighed-distance.hh>
36
37namespace hpp {
38namespace core {
39namespace steeringMethod {
42
45 class HPP_CORE_DLLAPI Interpolated : public SteeringMethod {
46 public:
48 static InterpolatedPtr_t create(const DevicePtr_t& device) {
49 Interpolated* ptr = new Interpolated(device);
50 InterpolatedPtr_t shPtr(ptr);
51 ptr->init(shPtr);
52 return shPtr;
53 }
54
56 static InterpolatedPtr_t create(const DevicePtr_t& device,
57 const WeighedDistancePtr_t& distance) {
58 Interpolated* ptr = new Interpolated(device, distance);
59 InterpolatedPtr_t shPtr(ptr);
60 ptr->init(shPtr);
61 return shPtr;
62 }
63
65 static InterpolatedPtr_t createCopy(const InterpolatedPtr_t& other) {
66 Interpolated* ptr = new Interpolated(*other);
67 InterpolatedPtr_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 value_type length = (*distance_)(q1, q2);
79 PathPtr_t path =
80 InterpolatedPath::create(device_.lock(), q1, q2, length, constraints());
81 return path;
82 }
83
84 protected:
87 Interpolated(const DevicePtr_t& device)
88 : SteeringMethod(),
89 device_(device),
90 distance_(WeighedDistance::create(device)),
91 weak_() {}
92
94 Interpolated(const DevicePtr_t& device, const WeighedDistancePtr_t& distance)
95 : SteeringMethod(), device_(device), distance_(distance), weak_() {}
96
98 Interpolated(const Interpolated& other)
99 : SteeringMethod(other),
100 device_(other.device_),
101 distance_(other.distance_),
102 weak_() {}
103
105 void init(InterpolatedWkPtr_t weak) {
106 SteeringMethod::init(weak);
107 weak_ = weak;
108 }
109
110 private:
111 DeviceWkPtr_t device_;
112 WeighedDistancePtr_t distance_;
113 InterpolatedWkPtr_t weak_;
114}; // Interpolated
116} // namespace steeringMethod
117} // namespace core
118} // namespace hpp
119#endif // HPP_CORE_STEERING_METHOD_STRAIGHT_HH
hpp::core::SteeringMethod
Definition steering-method.hh:48
hpp::core::WeighedDistance
Definition weighed-distance.hh:44
hpp::core::steeringMethod::Interpolated
Definition interpolated-steering-method.hh:45
hpp::core::steeringMethod::Interpolated::init
void init(InterpolatedWkPtr_t weak)
Store weak pointer to itself.
Definition interpolated-steering-method.hh:105
hpp::core::steeringMethod::Interpolated::Interpolated
Interpolated(const Interpolated &other)
Copy constructor.
Definition interpolated-steering-method.hh:98
hpp::core::steeringMethod::Interpolated::copy
virtual SteeringMethodPtr_t copy() const
Copy instance and return shared pointer.
Definition interpolated-steering-method.hh:73
hpp::core::steeringMethod::Interpolated::create
static InterpolatedPtr_t create(const DevicePtr_t &device, const WeighedDistancePtr_t &distance)
Create instance and return shared pointer.
Definition interpolated-steering-method.hh:56
hpp::core::steeringMethod::Interpolated::Interpolated
Interpolated(const DevicePtr_t &device, const WeighedDistancePtr_t &distance)
Constructor with weighed distance.
Definition interpolated-steering-method.hh:94
hpp::core::steeringMethod::Interpolated::impl_compute
virtual PathPtr_t impl_compute(ConfigurationIn_t q1, ConfigurationIn_t q2) const
create a path between two configurations
Definition interpolated-steering-method.hh:76
hpp::core::steeringMethod::Interpolated::createCopy
static InterpolatedPtr_t createCopy(const InterpolatedPtr_t &other)
Copy instance and return shared pointer.
Definition interpolated-steering-method.hh:65
hpp::core::steeringMethod::Interpolated::Interpolated
Interpolated(const DevicePtr_t &device)
Definition interpolated-steering-method.hh:87
hpp::core::steeringMethod::Interpolated::create
static InterpolatedPtr_t create(const DevicePtr_t &device)
Create instance and return shared pointer.
Definition interpolated-steering-method.hh:48
HPP_CORE_DLLAPI
#define HPP_CORE_DLLAPI
Definition config.hh:88
interpolated-path.hh
hpp
hpp::core::steeringMethod::InterpolatedPtr_t
shared_ptr< Interpolated > InterpolatedPtr_t
Definition fwd.hh:350
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::WeighedDistancePtr_t
shared_ptr< WeighedDistance > WeighedDistancePtr_t
Definition fwd.hh:226
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::DevicePtr_t
pinocchio::DevicePtr_t DevicePtr_t
Definition fwd.hh:134
hpp::core::PathPtr_t
shared_ptr< Path > PathPtr_t
Definition fwd.hh:187
fwd.hh
steering-method.hh
weighed-distance.hh