hpp-core  6.0.0
Implement basic classes for canonical path planning for kinematic chains.
kinodynamic-oriented-path.hh
Go to the documentation of this file.
1 // Copyright (c) 2016, LAAS-CNRS
2 // Authors: Pierre Fernbach (pierre.fernbach@laas.fr)
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_KINODYNAMIC_ORIENTED_PATH_HH
30 #define HPP_CORE_KINODYNAMIC_ORIENTED_PATH_HH
31 
33 
34 namespace hpp {
35 namespace core {
41 
43  public:
46 
52  const DevicePtr_t& device, ConfigurationIn_t init, ConfigurationIn_t end,
55  ConfigurationIn_t vLim, bool ignoreZValue = false) {
57  device, init, end, length, a1, t0, t1, tv, t2, vLim, ignoreZValue);
59  ptr->init(shPtr);
60  ptr->checkPath();
61  return shPtr;
62  }
63 
70  const DevicePtr_t& device, ConfigurationIn_t init, ConfigurationIn_t end,
73  ConfigurationIn_t vLim, ConstraintSetPtr_t constraints,
74  bool ignoreZValue = false) {
76  new KinodynamicOrientedPath(device, init, end, length, a1, t0, t1, tv,
77  t2, vLim, constraints, ignoreZValue);
79  ptr->init(shPtr);
80  ptr->checkPath();
81  return shPtr;
82  }
83 
87  const KinodynamicOrientedPathPtr_t& path) {
90  ptr->init(shPtr);
91  ptr->checkPath();
92  return shPtr;
93  }
94 
96  bool ignoreZValue = false) {
98  new KinodynamicOrientedPath(*path, ignoreZValue);
100  ptr->init(shPtr);
101  ptr->checkPath();
102  return shPtr;
103  }
104 
109  const KinodynamicOrientedPathPtr_t& path,
110  const ConstraintSetPtr_t& constraints) {
112  new KinodynamicOrientedPath(*path, constraints);
113  KinodynamicOrientedPathPtr_t shPtr(ptr);
114  ptr->init(shPtr);
115  ptr->checkPath();
116  return shPtr;
117  }
118 
123  virtual PathPtr_t copy() const { return createCopy(weak_.lock()); }
124 
129  virtual PathPtr_t copy(const ConstraintSetPtr_t& constraints) const {
130  return createCopy(weak_.lock(), constraints);
131  }
132 
133  bool ignoreZValue() const { return ignoreZValue_; }
134  void ignoreZValue(bool ignoreZValue) { ignoreZValue_ = ignoreZValue; }
135 
136  protected:
138  virtual std::ostream& print(std::ostream& os) const {
139  os << "KinodynamicOrientedPath:" << std::endl;
140  os << "interval: [ " << timeRange().first << ", " << timeRange().second
141  << " ]" << std::endl;
142  os << "initial configuration: " << pinocchio::displayConfig(initial_)
143  << std::endl;
144  os << "final configuration: " << pinocchio::displayConfig(end_)
145  << std::endl;
146  return os;
147  }
148 
149  void orienteInitAndGoal(const DevicePtr_t& device);
150 
153  ConfigurationIn_t end, value_type length,
157  bool ignoreZValue);
158 
161  ConfigurationIn_t end, value_type length,
165  ConstraintSetPtr_t constraints, bool ignoreZValue);
166 
169 
171  KinodynamicOrientedPath(const KinodynamicPath& path, bool ignoreZValue);
172 
175  const ConstraintSetPtr_t& constraints);
176 
178  parent_t::init(self);
179  weak_ = self;
180  checkPath();
181  }
182 
183  virtual bool impl_compute(ConfigurationOut_t result, value_type t) const;
184 
185  virtual PathPtr_t impl_extract(const interval_t& subInterval) const;
186 
187  private:
188  KinodynamicOrientedPathWkPtr_t weak_;
189  bool ignoreZValue_;
190 }; // class kinodynamic oriented path
191 } // namespace core
192 } // namespace hpp
193 
194 #endif // HPP_CORE_KINODYNAMIC_ORIENTED_PATH_HH
Definition: kinodynamic-oriented-path.hh:42
KinodynamicOrientedPath(const DevicePtr_t &robot, ConfigurationIn_t init, ConfigurationIn_t end, value_type length, ConfigurationIn_t a1, ConfigurationIn_t t0, ConfigurationIn_t t1, ConfigurationIn_t tv, ConfigurationIn_t t2, ConfigurationIn_t vLim, bool ignoreZValue)
Constructor.
static KinodynamicOrientedPathPtr_t createCopy(const KinodynamicOrientedPathPtr_t &path, const ConstraintSetPtr_t &constraints)
Definition: kinodynamic-oriented-path.hh:108
virtual std::ostream & print(std::ostream &os) const
Print path in a stream.
Definition: kinodynamic-oriented-path.hh:138
void ignoreZValue(bool ignoreZValue)
Definition: kinodynamic-oriented-path.hh:134
KinodynamicOrientedPath(const DevicePtr_t &robot, ConfigurationIn_t init, ConfigurationIn_t end, value_type length, ConfigurationIn_t a1, ConfigurationIn_t t0, ConfigurationIn_t t1, ConfigurationIn_t tv, ConfigurationIn_t t2, ConfigurationIn_t vLim, ConstraintSetPtr_t constraints, bool ignoreZValue)
Constructor with constraints.
KinodynamicPath parent_t
Definition: kinodynamic-oriented-path.hh:44
bool ignoreZValue() const
Definition: kinodynamic-oriented-path.hh:133
static KinodynamicOrientedPathPtr_t create(const DevicePtr_t &device, ConfigurationIn_t init, ConfigurationIn_t end, value_type length, ConfigurationIn_t a1, ConfigurationIn_t t0, ConfigurationIn_t t1, ConfigurationIn_t tv, ConfigurationIn_t t2, ConfigurationIn_t vLim, bool ignoreZValue=false)
Definition: kinodynamic-oriented-path.hh:51
void init(KinodynamicOrientedPathPtr_t self)
Definition: kinodynamic-oriented-path.hh:177
virtual PathPtr_t copy() const
Definition: kinodynamic-oriented-path.hh:123
KinodynamicOrientedPath(const KinodynamicOrientedPath &path, const ConstraintSetPtr_t &constraints)
Copy constructor with constraints.
void orienteInitAndGoal(const DevicePtr_t &device)
virtual ~KinodynamicOrientedPath()
Definition: kinodynamic-oriented-path.hh:45
static KinodynamicOrientedPathPtr_t createCopy(const KinodynamicOrientedPathPtr_t &path)
Definition: kinodynamic-oriented-path.hh:86
virtual PathPtr_t impl_extract(const interval_t &subInterval) const
virtual PathPtr_t copy(const ConstraintSetPtr_t &constraints) const
Definition: kinodynamic-oriented-path.hh:129
virtual bool impl_compute(ConfigurationOut_t result, value_type t) const
Function evaluation without applying constraints.
static KinodynamicOrientedPathPtr_t create(const KinodynamicPathPtr_t &path, bool ignoreZValue=false)
Definition: kinodynamic-oriented-path.hh:95
static KinodynamicOrientedPathPtr_t create(const DevicePtr_t &device, ConfigurationIn_t init, ConfigurationIn_t end, value_type length, ConfigurationIn_t a1, ConfigurationIn_t t0, ConfigurationIn_t t1, ConfigurationIn_t tv, ConfigurationIn_t t2, ConfigurationIn_t vLim, ConstraintSetPtr_t constraints, bool ignoreZValue=false)
Definition: kinodynamic-oriented-path.hh:69
KinodynamicOrientedPath(const KinodynamicPath &path, bool ignoreZValue)
constructor from KinodynamicPath
KinodynamicOrientedPath(const KinodynamicOrientedPath &path)
Copy constructor.
Definition: kinodynamic-path.hh:59
virtual void checkPath() const
Should be called by child classes after having init.
#define HPP_CORE_DLLAPI
Definition: config.hh:88
pinocchio::value_type value_type
Definition: fwd.hh:174
pinocchio::ConfigurationOut_t ConfigurationOut_t
Definition: fwd.hh:109
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:108
shared_ptr< KinodynamicPath > KinodynamicPathPtr_t
Definition: fwd.hh:206
std::pair< value_type, value_type > interval_t
Definition: fwd.hh:175
shared_ptr< KinodynamicOrientedPath > KinodynamicOrientedPathPtr_t
Definition: fwd.hh:208
pinocchio::DevicePtr_t DevicePtr_t
Definition: fwd.hh:134
shared_ptr< ConstraintSet > ConstraintSetPtr_t
Definition: fwd.hh:130
shared_ptr< Path > PathPtr_t
Definition: fwd.hh:187
Definition: bi-rrt-planner.hh:35