hpp-core  6.0.0
Implement basic classes for canonical path planning for kinematic chains.
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 
36 
37 namespace hpp {
38 namespace core {
39 namespace steeringMethod {
42 
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 
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 
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
static InterpolatedPathPtr_t create(const DevicePtr_t &device, ConfigurationIn_t init, ConfigurationIn_t end, interval_t timeRange)
Definition: interpolated-path.hh:67
Definition: steering-method.hh:48
void init(SteeringMethodWkPtr_t weak)
Store weak pointer to itself.
Definition: steering-method.hh:110
Definition: weighed-distance.hh:44
Definition: interpolated-steering-method.hh:45
void init(InterpolatedWkPtr_t weak)
Store weak pointer to itself.
Definition: interpolated-steering-method.hh:105
Interpolated(const Interpolated &other)
Copy constructor.
Definition: interpolated-steering-method.hh:98
virtual SteeringMethodPtr_t copy() const
Copy instance and return shared pointer.
Definition: interpolated-steering-method.hh:73
static InterpolatedPtr_t create(const DevicePtr_t &device, const WeighedDistancePtr_t &distance)
Create instance and return shared pointer.
Definition: interpolated-steering-method.hh:56
Interpolated(const DevicePtr_t &device, const WeighedDistancePtr_t &distance)
Constructor with weighed distance.
Definition: interpolated-steering-method.hh:94
virtual PathPtr_t impl_compute(ConfigurationIn_t q1, ConfigurationIn_t q2) const
create a path between two configurations
Definition: interpolated-steering-method.hh:76
static InterpolatedPtr_t createCopy(const InterpolatedPtr_t &other)
Copy instance and return shared pointer.
Definition: interpolated-steering-method.hh:65
Interpolated(const DevicePtr_t &device)
Definition: interpolated-steering-method.hh:87
static InterpolatedPtr_t create(const DevicePtr_t &device)
Create instance and return shared pointer.
Definition: interpolated-steering-method.hh:48
#define HPP_CORE_DLLAPI
Definition: config.hh:88
shared_ptr< Interpolated > InterpolatedPtr_t
Definition: fwd.hh:339
pinocchio::DeviceWkPtr_t DeviceWkPtr_t
Definition: fwd.hh:135
pinocchio::value_type value_type
Definition: fwd.hh:174
shared_ptr< WeighedDistance > WeighedDistancePtr_t
Definition: fwd.hh:226
shared_ptr< SteeringMethod > SteeringMethodPtr_t
Definition: fwd.hh:213
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:108
pinocchio::DevicePtr_t DevicePtr_t
Definition: fwd.hh:134
shared_ptr< Path > PathPtr_t
Definition: fwd.hh:187
Definition: bi-rrt-planner.hh:35