hpp-core  6.0.0
Implement basic classes for canonical path planning for kinematic chains.
constant-curvature.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2017 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_STEERING_METHOD_CONSTANT_CURVATURE_HH
31 #define HPP_CORE_STEERING_METHOD_CONSTANT_CURVATURE_HH
32 
33 #include <hpp/core/fwd.hh>
34 #include <hpp/core/path.hh>
36 
37 namespace hpp {
38 namespace core {
39 namespace steeringMethod {
41 class ConstantCurvature : public Path {
42  public:
43  typedef Path parent_t;
44  virtual ~ConstantCurvature() {}
62  value_type curveLength, value_type pathLength, value_type curvature,
63  size_type xyId, size_type rzId, const JointPtr_t rz,
64  const std::vector<JointPtr_t> wheels,
66 
69 
72  const ConstantCurvaturePtr_t& other,
74 
76  virtual PathPtr_t copy() const;
77 
81  virtual PathPtr_t copy(const ConstraintSetPtr_t& constraints) const {
82  return createCopy(weak_.lock(), constraints);
83  }
84 
86  inline Configuration_t initial() const { return initial_; }
87 
89  inline Configuration_t end() const { return end_; }
90 
91  virtual PathPtr_t reverse() const;
92 
93  struct Wheels_t {
94  value_type value; // Constant value of the wheel angle
96  Wheels_t() : j() {}
97  };
98 
99  protected:
101  virtual std::ostream& print(std::ostream& os) const;
102 
118  ConfigurationIn_t end, value_type curveLength,
119  value_type pathLength, value_type curvature, size_type xyId,
120  size_type rzId, const JointPtr_t rz,
121  const std::vector<JointPtr_t> wheels);
122 
139  ConfigurationIn_t end, value_type curveLength,
140  value_type pathLength, value_type curvature, size_type xyId,
141  size_type rzId, const JointPtr_t rz,
142  const std::vector<JointPtr_t> wheels,
144 
147 
151 
152  virtual bool impl_compute(ConfigurationOut_t result, value_type param) const;
154  virtual void impl_derivative(vectorOut_t result, const value_type& param,
155  size_type order) const;
157  virtual void impl_velocityBound(vectorOut_t bound, const value_type& param0,
158  const value_type& param1) const;
159 
161  virtual PathPtr_t impl_extract(const interval_t& paramInterval) const;
162 
164  void init(const ConstantCurvatureWkPtr_t& weak) {
165  parent_t::init(weak);
166  weak_ = weak;
167  }
168 
170  ConstantCurvature() : curvature_(0), xyId_(0), rzId_(0) {}
171 
172  private:
177  void setWheelJoints(const JointPtr_t rz,
178  const std::vector<JointPtr_t> wheels);
179 
180  DevicePtr_t robot_;
181  Configuration_t initial_;
182  Configuration_t end_;
183  value_type curveLength_;
184  const value_type curvature_;
185  const size_type xyId_, rzId_;
186  size_type dxyId_, drzId_;
187  value_type forward_;
188  std::vector<Wheels_t> wheels_;
189  ConstantCurvatureWkPtr_t weak_;
190 
191  HPP_SERIALIZABLE();
192 }; // class ConstantCurvature
193 } // namespace steeringMethod
194 } // namespace core
195 } // namespace hpp
196 
197 #endif // HPP_CORE_STEERING_METHOD_CONSTANT_CURVATURE_HH
Definition: path.hh:71
const ConstraintSetPtr_t & constraints() const
Get constraints the path is subject to.
Definition: path.hh:204
void init(const PathWkPtr_t &self)
Path of constant curvature for a carlike robot.
Definition: constant-curvature.hh:41
ConstantCurvature(const ConstantCurvature &other)
Copy constructor.
virtual void impl_velocityBound(vectorOut_t bound, const value_type &param0, const value_type &param1) const
Virtual implementation of velocity bound.
static ConstantCurvaturePtr_t create(const DevicePtr_t &robot, ConfigurationIn_t init, ConfigurationIn_t end, value_type curveLength, value_type pathLength, value_type curvature, size_type xyId, size_type rzId, const JointPtr_t rz, const std::vector< JointPtr_t > wheels, const ConstraintSetPtr_t &constraints)
ConstantCurvature()
For serialization only.
Definition: constant-curvature.hh:170
ConstantCurvature(const DevicePtr_t &robot, ConfigurationIn_t init, ConfigurationIn_t end, value_type curveLength, value_type pathLength, value_type curvature, size_type xyId, size_type rzId, const JointPtr_t rz, const std::vector< JointPtr_t > wheels, ConstraintSetPtr_t constraints)
static ConstantCurvaturePtr_t createCopy(const ConstantCurvaturePtr_t &other, const ConstraintSetPtr_t &constraints)
Create instance and return shared pointer.
virtual PathPtr_t copy() const
Return a shared pointer to a copy of this.
virtual PathPtr_t impl_extract(const interval_t &paramInterval) const
Virtual implementation of path extraction.
virtual bool impl_compute(ConfigurationOut_t result, value_type param) const
Function evaluation without applying constraints.
virtual PathPtr_t copy(const ConstraintSetPtr_t &constraints) const
Definition: constant-curvature.hh:81
static ConstantCurvaturePtr_t createCopy(const ConstantCurvaturePtr_t &other)
Create instance and return shared pointer.
Configuration_t initial() const
Get the initial configuration.
Definition: constant-curvature.hh:86
virtual void impl_derivative(vectorOut_t result, const value_type &param, size_type order) const
Virtual implementation of derivative.
ConstantCurvature(const DevicePtr_t &robot, ConfigurationIn_t init, ConfigurationIn_t end, value_type curveLength, value_type pathLength, value_type curvature, size_type xyId, size_type rzId, const JointPtr_t rz, const std::vector< JointPtr_t > wheels)
Configuration_t end() const
Get the final configuration.
Definition: constant-curvature.hh:89
virtual ~ConstantCurvature()
Definition: constant-curvature.hh:44
void init(const ConstantCurvatureWkPtr_t &weak)
store weak pointer to itself
Definition: constant-curvature.hh:164
ConstantCurvature(const ConstantCurvature &other, const ConstraintSetPtr_t &constraints)
Copy constructor with constraints.
virtual std::ostream & print(std::ostream &os) const
Print path in a stream.
Path parent_t
Definition: constant-curvature.hh:43
shared_ptr< ConstantCurvature > ConstantCurvaturePtr_t
Definition: fwd.hh:43
pinocchio::value_type value_type
Definition: fwd.hh:174
pinocchio::vectorOut_t vectorOut_t
Definition: fwd.hh:222
pinocchio::ConfigurationOut_t ConfigurationOut_t
Definition: fwd.hh:109
pinocchio::JointPtr_t JointPtr_t
Definition: fwd.hh:151
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:108
std::pair< value_type, value_type > interval_t
Definition: fwd.hh:175
pinocchio::size_type size_type
Definition: fwd.hh:173
pinocchio::Configuration_t Configuration_t
Definition: fwd.hh:107
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
Definition: constant-curvature.hh:93
JointPtr_t j
Definition: constant-curvature.hh:95
Wheels_t()
Definition: constant-curvature.hh:96
value_type value
Definition: constant-curvature.hh:94