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

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

Loading...
Searching...
No Matches
straight-path.hh
Go to the documentation of this file.
1//
2// Copyright (c) 2014 CNRS
3// Authors: Florent Lamiraux
4//
5
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are
8// met:
9//
10// 1. Redistributions of source code must retain the above copyright
11// notice, this list of conditions and the following disclaimer.
12//
13// 2. Redistributions in binary form must reproduce the above copyright
14// notice, this list of conditions and the following disclaimer in the
15// documentation and/or other materials provided with the distribution.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
28// DAMAGE.
29
30#ifndef HPP_CORE_STRAIGHT_PATH_HH
31#define HPP_CORE_STRAIGHT_PATH_HH
32
33#include <hpp/core/config.hh>
34#include <hpp/core/fwd.hh>
35#include <hpp/core/path.hh>
36#include <hpp/pinocchio/liegroup-element.hh>
37
38namespace hpp {
39namespace core {
42
52 class HPP_CORE_DLLAPI StraightPath : public Path {
53 public:
54 typedef Path parent_t;
56 virtual ~StraightPath() {}
57
62 static StraightPathPtr_t create(
63 LiegroupSpacePtr_t space, vectorIn_t init, vectorIn_t end,
64 interval_t interval,
65 ConstraintSetPtr_t constraints = ConstraintSetPtr_t()) {
66 StraightPath* ptr;
67 if (constraints)
68 ptr = new StraightPath(space, init, end, interval, constraints);
69 else
70 ptr = new StraightPath(space, init, end, interval);
71 StraightPathPtr_t shPtr(ptr);
72 ptr->init(shPtr);
73 ptr->checkPath();
74 return shPtr;
75 }
76
81 static StraightPathPtr_t create(
82 LiegroupElementConstRef init, LiegroupElementConstRef end,
83 interval_t interval,
84 ConstraintSetPtr_t constraints = ConstraintSetPtr_t()) {
85 assert(init.space() == end.space());
86 return create(init.space(), init.vector(), end.vector(), interval,
87 constraints);
88 }
89
94 static StraightPathPtr_t create(
95 const DevicePtr_t& device, ConfigurationIn_t init, ConfigurationIn_t end,
96 value_type length,
97 ConstraintSetPtr_t constraints = ConstraintSetPtr_t()) {
98 return create(device, init, end, interval_t(0, length), constraints);
99 }
100
106 static StraightPathPtr_t create(
107 const DevicePtr_t& device, ConfigurationIn_t init, ConfigurationIn_t end,
108 interval_t interval,
109 ConstraintSetPtr_t constraints = ConstraintSetPtr_t());
110
113 static StraightPathPtr_t createCopy(const StraightPathPtr_t& path) {
114 StraightPath* ptr = new StraightPath(*path);
115 StraightPathPtr_t shPtr(ptr);
116 ptr->init(shPtr);
117 ptr->checkPath();
118 return shPtr;
119 }
120
124 static StraightPathPtr_t createCopy(const StraightPathPtr_t& path,
125 const ConstraintSetPtr_t& constraints) {
126 StraightPath* ptr = new StraightPath(*path, constraints);
127 StraightPathPtr_t shPtr(ptr);
128 ptr->init(shPtr);
129 ptr->checkPath();
130 return shPtr;
131 }
132
137 virtual PathPtr_t copy() const { return createCopy(weak_.lock()); }
138
143 virtual PathPtr_t copy(const ConstraintSetPtr_t& constraints) const {
144 return createCopy(weak_.lock(), constraints);
145 }
146
151 void initialConfig(ConfigurationIn_t initial) {
152 assert(initial.size() == initial_.size());
153 initial_ = initial;
154 }
155
160 void endConfig(ConfigurationIn_t end) {
161 assert(end.size() == end_.size());
162 end_ = end;
163 }
164
166 Configuration_t initial() const { return initial_; }
167
169 Configuration_t end() const { return end_; }
170
171 protected:
173 virtual std::ostream& print(std::ostream& os) const;
174
176 StraightPath(LiegroupSpacePtr_t space, vectorIn_t init, vectorIn_t end,
177 interval_t interval);
178
180 StraightPath(LiegroupSpacePtr_t space, vectorIn_t init, vectorIn_t end,
181 interval_t interval, ConstraintSetPtr_t constraints);
182
184 StraightPath(const StraightPath& path);
185
187 StraightPath(const StraightPath& path, const ConstraintSetPtr_t& constraints);
188
189 void init(StraightPathPtr_t self) {
190 parent_t::init(self);
191 weak_ = self;
192 checkPath();
193 }
194
195 virtual bool impl_compute(ConfigurationOut_t result, value_type param) const;
197 virtual void impl_derivative(vectorOut_t result, const value_type& t,
198 size_type order) const;
199
200 virtual void impl_velocityBound(vectorOut_t result, const value_type&,
201 const value_type&) const;
202
207 PathPtr_t impl_extract(const interval_t& subInterval) const;
208
209 protected:
210 LiegroupSpacePtr_t space_;
211 Configuration_t initial_;
212 Configuration_t end_;
213
214 private:
215 StraightPathWkPtr_t weak_;
216
217 protected:
218 StraightPath() {}
219
220 private:
221 HPP_SERIALIZABLE();
222}; // class StraightPath
224} // namespace core
225} // namespace hpp
226
227BOOST_CLASS_EXPORT_KEY(hpp::core::StraightPath)
228
229#endif // HPP_CORE_STRAIGHT_PATH_HH
hpp::core::Path
Definition path.hh:71
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
hpp::core::StraightPath::initial_
Configuration_t initial_
Definition straight-path.hh:211
hpp::core::StraightPath::impl_compute
virtual bool impl_compute(ConfigurationOut_t result, value_type param) const
Function evaluation without applying constraints.
hpp::core::StraightPath::~StraightPath
virtual ~StraightPath()
Destructor.
Definition straight-path.hh:56
hpp::core::StraightPath::StraightPath
StraightPath(const StraightPath &path)
Copy constructor.
hpp::core::StraightPath::initial
Configuration_t initial() const
Get the initial configuration.
Definition straight-path.hh:166
hpp::core::StraightPath::endConfig
void endConfig(ConfigurationIn_t end)
Definition straight-path.hh:160
hpp::core::StraightPath::impl_derivative
virtual void impl_derivative(vectorOut_t result, const value_type &t, size_type order) const
Virtual implementation of derivative.
hpp::core::StraightPath::print
virtual std::ostream & print(std::ostream &os) const
Print path in a stream.
hpp::core::StraightPath::init
void init(StraightPathPtr_t self)
Definition straight-path.hh:189
hpp::core::StraightPath::end
Configuration_t end() const
Get the final configuration.
Definition straight-path.hh:169
hpp::core::StraightPath::StraightPath
StraightPath(const StraightPath &path, const ConstraintSetPtr_t &constraints)
Copy constructor with constraints.
hpp::core::StraightPath::create
static StraightPathPtr_t create(const DevicePtr_t &device, ConfigurationIn_t init, ConfigurationIn_t end, value_type length, ConstraintSetPtr_t constraints=ConstraintSetPtr_t())
Definition straight-path.hh:94
hpp::core::StraightPath::impl_velocityBound
virtual void impl_velocityBound(vectorOut_t result, const value_type &, const value_type &) const
hpp::core::StraightPath::copy
virtual PathPtr_t copy(const ConstraintSetPtr_t &constraints) const
Definition straight-path.hh:143
hpp::core::StraightPath::space_
LiegroupSpacePtr_t space_
Definition straight-path.hh:210
hpp::core::StraightPath::StraightPath
StraightPath(LiegroupSpacePtr_t space, vectorIn_t init, vectorIn_t end, interval_t interval, ConstraintSetPtr_t constraints)
Constructor.
hpp::core::StraightPath::StraightPath
StraightPath(LiegroupSpacePtr_t space, vectorIn_t init, vectorIn_t end, interval_t interval)
Constructor.
hpp::core::StraightPath::createCopy
static StraightPathPtr_t createCopy(const StraightPathPtr_t &path)
Definition straight-path.hh:113
hpp::core::StraightPath::copy
virtual PathPtr_t copy() const
Definition straight-path.hh:137
hpp::core::StraightPath::end_
Configuration_t end_
Definition straight-path.hh:212
hpp::core::StraightPath::create
static StraightPathPtr_t create(LiegroupElementConstRef init, LiegroupElementConstRef end, interval_t interval, ConstraintSetPtr_t constraints=ConstraintSetPtr_t())
Definition straight-path.hh:81
hpp::core::StraightPath::parent_t
Path parent_t
Definition straight-path.hh:54
hpp::core::StraightPath::create
static StraightPathPtr_t create(LiegroupSpacePtr_t space, vectorIn_t init, vectorIn_t end, interval_t interval, ConstraintSetPtr_t constraints=ConstraintSetPtr_t())
Definition straight-path.hh:62
hpp::core::StraightPath::StraightPath
StraightPath()
Definition straight-path.hh:218
hpp::core::StraightPath::create
static StraightPathPtr_t create(const DevicePtr_t &device, ConfigurationIn_t init, ConfigurationIn_t end, interval_t interval, ConstraintSetPtr_t constraints=ConstraintSetPtr_t())
hpp::core::StraightPath::impl_extract
PathPtr_t impl_extract(const interval_t &subInterval) const
hpp::core::StraightPath::initialConfig
void initialConfig(ConfigurationIn_t initial)
Definition straight-path.hh:151
hpp::core::StraightPath::createCopy
static StraightPathPtr_t createCopy(const StraightPathPtr_t &path, const ConstraintSetPtr_t &constraints)
Definition straight-path.hh:124
hpp::pinocchio::LiegroupElementConstBase
hpp::pinocchio::LiegroupElementConstBase::vector
const vector_type & vector() const
hpp::pinocchio::LiegroupElementConstBase::space
const LiegroupSpacePtr_t & space() const
config.hh
HPP_CORE_DLLAPI
#define HPP_CORE_DLLAPI
Definition config.hh:88
fwd.hh
liegroup-element.hh
hpp
hpp::core::value_type
pinocchio::value_type value_type
Definition fwd.hh:174
hpp::core::StraightPathPtr_t
shared_ptr< StraightPath > StraightPathPtr_t
Definition fwd.hh:200
hpp::core::vectorIn_t
pinocchio::vectorIn_t vectorIn_t
Definition fwd.hh:221
hpp::core::vectorOut_t
pinocchio::vectorOut_t vectorOut_t
Definition fwd.hh:222
hpp::core::ConfigurationOut_t
pinocchio::ConfigurationOut_t ConfigurationOut_t
Definition fwd.hh:109
hpp::core::LiegroupSpacePtr_t
constraints::LiegroupSpacePtr_t LiegroupSpacePtr_t
Definition fwd.hh:172
hpp::core::ConfigurationIn_t
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition fwd.hh:108
hpp::core::interval_t
std::pair< value_type, value_type > interval_t
Definition fwd.hh:175
hpp::core::size_type
pinocchio::size_type size_type
Definition fwd.hh:173
hpp::core::Configuration_t
pinocchio::Configuration_t Configuration_t
Definition fwd.hh:107
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
path.hh
HPP_SERIALIZABLE
#define HPP_SERIALIZABLE()