hpp-core  4.9.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 // This file is part of hpp-core
5 // hpp-core is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // hpp-core is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // hpp-core If not, see
16 // <http://www.gnu.org/licenses/>.
17 
18 #ifndef HPP_CORE_STEERING_METHOD_INTERPOLATED_HH
19 # define HPP_CORE_STEERING_METHOD_INTERPOLATED_HH
20 
25 
26 namespace hpp {
27  namespace core {
28  namespace steeringMethod {
31 
34  class HPP_CORE_DLLAPI Interpolated : public SteeringMethod
35  {
36  public:
38  static InterpolatedPtr_t create (const DevicePtr_t& device)
39  {
40  Interpolated* ptr = new Interpolated (device);
41  InterpolatedPtr_t shPtr (ptr);
42  ptr->init (shPtr);
43  return shPtr;
44  }
45 
47  static InterpolatedPtr_t create (const DevicePtr_t& device,
49  {
50  Interpolated* ptr = new Interpolated (device,
51  distance);
52  InterpolatedPtr_t shPtr (ptr);
53  ptr->init (shPtr);
54  return shPtr;
55  }
56 
59  {
60  Interpolated* ptr = new Interpolated (*other);
61  InterpolatedPtr_t shPtr (ptr);
62  ptr->init (shPtr);
63  return shPtr;
64  }
65 
67  virtual SteeringMethodPtr_t copy () const
68  {
69  return createCopy (weak_.lock ());
70  }
71 
74  ConfigurationIn_t q2) const
75  {
76  value_type length = (*distance_) (q1, q2);
77  PathPtr_t path = InterpolatedPath::create (device_.lock (), q1, q2,
78  length, constraints ());
79  return path;
80  }
81 
82  protected:
85  Interpolated (const DevicePtr_t& device) :
86  SteeringMethod (), device_ (device),
87  distance_ (WeighedDistance::create (device)), weak_ ()
88  {}
89 
91  Interpolated (const DevicePtr_t& device,
93  SteeringMethod (), device_ (device),
94  distance_ (distance), weak_ ()
95  {}
96 
98  Interpolated (const Interpolated& other) :
99  SteeringMethod (other), device_ (other.device_),
100  distance_ (other.distance_), weak_ ()
101  {}
102 
104  void init (InterpolatedWkPtr_t weak)
105  {
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
boost::shared_ptr< Path > PathPtr_t
Definition: fwd.hh:170
Definition: interpolated-steering-method.hh:34
virtual SteeringMethodPtr_t copy() const
Copy instance and return shared pointer.
Definition: interpolated-steering-method.hh:67
boost::shared_ptr< WeighedDistance > WeighedDistancePtr_t
Definition: fwd.hh:207
pinocchio::DevicePtr_t DevicePtr_t
Definition: fwd.hh:114
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:97
Definition: steering-method.hh:38
static InterpolatedPtr_t create(const DevicePtr_t &device, const WeighedDistancePtr_t &distance)
Create instance and return shared pointer.
Definition: interpolated-steering-method.hh:47
pinocchio::DeviceWkPtr_t DeviceWkPtr_t
Definition: fwd.hh:115
Definition: weighed-distance.hh:33
ObjectFactory * create(ObjectFactory *parent=NULL, const XMLElement *element=NULL)
static InterpolatedPathPtr_t create(const DevicePtr_t &device, ConfigurationIn_t init, ConfigurationIn_t end, interval_t timeRange)
Definition: interpolated-path.hh:56
virtual PathPtr_t impl_compute(ConfigurationIn_t q1, ConfigurationIn_t q2) const
create a path between two configurations
Definition: interpolated-steering-method.hh:73
Interpolated(const Interpolated &other)
Copy constructor.
Definition: interpolated-steering-method.hh:98
static InterpolatedPtr_t createCopy(const InterpolatedPtr_t &other)
Copy instance and return shared pointer.
Definition: interpolated-steering-method.hh:58
void init(InterpolatedWkPtr_t weak)
Store weak pointer to itself.
Definition: interpolated-steering-method.hh:104
void init(SteeringMethodWkPtr_t weak)
Store weak pointer to itself.
Definition: steering-method.hh:114
static InterpolatedPtr_t create(const DevicePtr_t &device)
Create instance and return shared pointer.
Definition: interpolated-steering-method.hh:38
pinocchio::value_type value_type
Definition: fwd.hh:157
boost::shared_ptr< Interpolated > InterpolatedPtr_t
Definition: fwd.hh:320
Interpolated(const DevicePtr_t &device)
Definition: interpolated-steering-method.hh:85
FCL_REAL length[2]
boost::shared_ptr< SteeringMethod > SteeringMethodPtr_t
Definition: fwd.hh:194
Interpolated(const DevicePtr_t &device, const WeighedDistancePtr_t &distance)
Constructor with weighed distance.
Definition: interpolated-steering-method.hh:91
FCL_REAL distance(const KDOP< N > &other, Vec3f *P=NULL, Vec3f *Q=NULL) const