hpp-core: include/hpp/core/kinodynamic-path.hh Source File

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

Loading...
Searching...
No Matches
kinodynamic-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_PATH_HH
30#define HPP_CORE_KINODYNAMIC_PATH_HH
31
32#include <hpp/core/config.hh>
33#include <hpp/core/fwd.hh>
34#include <hpp/core/straight-path.hh>
35#include <hpp/pinocchio/configuration.hh>
36
37namespace hpp {
38namespace core {
41
59 class HPP_CORE_DLLAPI KinodynamicPath : public StraightPath {
60 public:
61 typedef StraightPath parent_t;
63 virtual ~KinodynamicPath() {}
64
69 static KinodynamicPathPtr_t create(const DevicePtr_t& device,
70 ConfigurationIn_t init,
71 ConfigurationIn_t end, value_type length,
72 ConfigurationIn_t a1, ConfigurationIn_t t0,
73 ConfigurationIn_t t1, ConfigurationIn_t tv,
74 ConfigurationIn_t t2,
75 ConfigurationIn_t vLim) {
76 KinodynamicPath* ptr = new KinodynamicPath(device, init, end, length, a1,
77 t0, t1, tv, t2, vLim);
78 KinodynamicPathPtr_t shPtr(ptr);
79 ptr->init(shPtr);
80 ptr->checkPath();
81 return shPtr;
82 }
83
89 static KinodynamicPathPtr_t create(
90 const DevicePtr_t& device, ConfigurationIn_t init, ConfigurationIn_t end,
91 value_type length, ConfigurationIn_t a1, ConfigurationIn_t t0,
92 ConfigurationIn_t t1, ConfigurationIn_t tv, ConfigurationIn_t t2,
93 ConfigurationIn_t vLim, ConstraintSetPtr_t constraints) {
94 KinodynamicPath* ptr = new KinodynamicPath(
95 device, init, end, length, a1, t0, t1, tv, t2, vLim, constraints);
96 KinodynamicPathPtr_t shPtr(ptr);
97 ptr->init(shPtr);
98 ptr->checkPath();
99 return shPtr;
100 }
101
104 static KinodynamicPathPtr_t createCopy(const KinodynamicPathPtr_t& path) {
105 KinodynamicPath* ptr = new KinodynamicPath(*path);
106 KinodynamicPathPtr_t shPtr(ptr);
107 ptr->init(shPtr);
108 ptr->checkPath();
109 return shPtr;
110 }
111
115 static KinodynamicPathPtr_t createCopy(
116 const KinodynamicPathPtr_t& path, const ConstraintSetPtr_t& constraints) {
117 KinodynamicPath* ptr = new KinodynamicPath(*path, constraints);
118 KinodynamicPathPtr_t shPtr(ptr);
119 ptr->init(shPtr);
120 ptr->checkPath();
121 return shPtr;
122 }
123
128 virtual PathPtr_t copy() const { return createCopy(weak_.lock()); }
129
134 virtual PathPtr_t copy(const ConstraintSetPtr_t& constraints) const {
135 return createCopy(weak_.lock(), constraints);
136 }
137
142 virtual PathPtr_t impl_extract(const interval_t& paramInterval) const;
143
144 vector_t getT0() { return t0_; }
145
146 vector_t getT1() { return t1_; }
147
148 vector_t getT2() { return t2_; }
149
150 vector_t getTv() { return tv_; }
151
152 vector_t getA1() { return a1_; }
153
154 protected:
155 // Make this method accessible to this class
156 void constraints(const ConstraintSetPtr_t& constr) {
157 this->parent_t::constraints(constr);
158 }
159
161 virtual std::ostream& print(std::ostream& os) const {
162 os << "KinodynamicPath:" << std::endl;
163 os << "interval: [ " << timeRange().first << ", " << timeRange().second
164 << " ]" << std::endl;
165 os << "initial configuration: " << pinocchio::displayConfig(initial_)
166 << std::endl;
167 os << "final configuration: " << pinocchio::displayConfig(end_)
168 << std::endl;
169 return os;
170 }
172 KinodynamicPath(const DevicePtr_t& robot, ConfigurationIn_t init,
173 ConfigurationIn_t end, value_type length,
174 ConfigurationIn_t a1, ConfigurationIn_t t0,
175 ConfigurationIn_t t1, ConfigurationIn_t tv,
176 ConfigurationIn_t t2, ConfigurationIn_t vLim);
177
179 KinodynamicPath(const DevicePtr_t& robot, ConfigurationIn_t init,
180 ConfigurationIn_t end, value_type length,
181 ConfigurationIn_t a1, ConfigurationIn_t t0,
182 ConfigurationIn_t t1, ConfigurationIn_t tv,
183 ConfigurationIn_t t2, ConfigurationIn_t vLim,
184 ConstraintSetPtr_t constraints);
185
187 KinodynamicPath(const KinodynamicPath& path);
188
190 KinodynamicPath(const KinodynamicPath& path,
191 const ConstraintSetPtr_t& constraints);
192
193 void init(KinodynamicPathPtr_t self) {
194 parent_t::init(self);
195 weak_ = self;
196 checkPath();
197 }
198
199 virtual bool impl_compute(ConfigurationOut_t result, value_type t) const;
200
201 inline double sgnenum(double val) const { return ((0. < val) - (val < 0.)); }
202
203 inline int sgn(double d) const { return d >= 0.0 ? 1 : -1; }
204
205 inline double sgnf(double d) const { return d >= 0.0 ? 1.0 : -1.0; }
206
207 const DevicePtr_t& device() const { return device_; }
208
209 private:
210 KinodynamicPathWkPtr_t weak_;
211 DevicePtr_t device_;
212 vector_t a1_;
213 vector_t t0_, t1_, tv_, t2_, vLim_;
214}; // class KinodynamicPath
216} // namespace core
217} // namespace hpp
218#endif // HPP_CORE_KINODYNAMIC_PATH_HH
hpp::core::KinodynamicPath
Definition kinodynamic-path.hh:59
hpp::core::KinodynamicPath::constraints
void constraints(const ConstraintSetPtr_t &constr)
Definition kinodynamic-path.hh:156
hpp::core::KinodynamicPath::create
static KinodynamicPathPtr_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)
Definition kinodynamic-path.hh:89
hpp::core::KinodynamicPath::device
const DevicePtr_t & device() const
Definition kinodynamic-path.hh:207
hpp::core::KinodynamicPath::init
void init(KinodynamicPathPtr_t self)
Definition kinodynamic-path.hh:193
hpp::core::KinodynamicPath::getT2
vector_t getT2()
Definition kinodynamic-path.hh:148
hpp::core::KinodynamicPath::impl_extract
virtual PathPtr_t impl_extract(const interval_t &paramInterval) const
hpp::core::KinodynamicPath::KinodynamicPath
KinodynamicPath(const KinodynamicPath &path, const ConstraintSetPtr_t &constraints)
Copy constructor with constraints.
hpp::core::KinodynamicPath::KinodynamicPath
KinodynamicPath(const KinodynamicPath &path)
Copy constructor.
hpp::core::KinodynamicPath::create
static KinodynamicPathPtr_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)
Definition kinodynamic-path.hh:69
hpp::core::KinodynamicPath::KinodynamicPath
KinodynamicPath(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)
Constructor with constraints.
hpp::core::KinodynamicPath::KinodynamicPath
KinodynamicPath(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)
Constructor.
hpp::core::KinodynamicPath::getA1
vector_t getA1()
Definition kinodynamic-path.hh:152
hpp::core::KinodynamicPath::createCopy
static KinodynamicPathPtr_t createCopy(const KinodynamicPathPtr_t &path)
Definition kinodynamic-path.hh:104
hpp::core::KinodynamicPath::sgnenum
double sgnenum(double val) const
Definition kinodynamic-path.hh:201
hpp::core::KinodynamicPath::sgn
int sgn(double d) const
Definition kinodynamic-path.hh:203
hpp::core::KinodynamicPath::copy
virtual PathPtr_t copy() const
Definition kinodynamic-path.hh:128
hpp::core::KinodynamicPath::sgnf
double sgnf(double d) const
Definition kinodynamic-path.hh:205
hpp::core::KinodynamicPath::~KinodynamicPath
virtual ~KinodynamicPath()
Destructor.
Definition kinodynamic-path.hh:63
hpp::core::KinodynamicPath::impl_compute
virtual bool impl_compute(ConfigurationOut_t result, value_type t) const
Function evaluation without applying constraints.
hpp::core::KinodynamicPath::print
virtual std::ostream & print(std::ostream &os) const
Print path in a stream.
Definition kinodynamic-path.hh:161
hpp::core::KinodynamicPath::createCopy
static KinodynamicPathPtr_t createCopy(const KinodynamicPathPtr_t &path, const ConstraintSetPtr_t &constraints)
Definition kinodynamic-path.hh:115
hpp::core::KinodynamicPath::getT1
vector_t getT1()
Definition kinodynamic-path.hh:146
hpp::core::KinodynamicPath::getTv
vector_t getTv()
Definition kinodynamic-path.hh:150
hpp::core::KinodynamicPath::parent_t
StraightPath parent_t
Definition kinodynamic-path.hh:61
hpp::core::KinodynamicPath::getT0
vector_t getT0()
Definition kinodynamic-path.hh:144
hpp::core::KinodynamicPath::copy
virtual PathPtr_t copy(const ConstraintSetPtr_t &constraints) const
Definition kinodynamic-path.hh:134
hpp::core::Path::checkPath
virtual void checkPath() const
Should be called by child classes after having init.
hpp::core::StraightPath
Definition straight-path.hh:52
config.hh
HPP_CORE_DLLAPI
#define HPP_CORE_DLLAPI
Definition config.hh:88
configuration.hh
fwd.hh
hpp
hpp::core::value_type
pinocchio::value_type value_type
Definition fwd.hh:174
hpp::core::ConfigurationOut_t
pinocchio::ConfigurationOut_t ConfigurationOut_t
Definition fwd.hh:109
hpp::core::vector_t
pinocchio::vector_t vector_t
Definition fwd.hh:220
hpp::core::ConfigurationIn_t
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition fwd.hh:108
hpp::core::KinodynamicPathPtr_t
shared_ptr< KinodynamicPath > KinodynamicPathPtr_t
Definition fwd.hh:206
hpp::core::interval_t
std::pair< value_type, value_type > interval_t
Definition fwd.hh:175
hpp::core::DevicePtr_t
pinocchio::DevicePtr_t DevicePtr_t
Definition fwd.hh:134
hpp::core::ConstraintSetPtr_t
shared_ptr< ConstraintSet > ConstraintSetPtr_t
Definition fwd.hh:130
hpp::core::PathPtr_t
shared_ptr< Path > PathPtr_t
Definition fwd.hh:187
straight-path.hh