hpp-core  4.9.0
Implement basic classes for canonical path planning for kinematic chains.
dubins-path.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2017 CNRS
3 // Authors: Florent Lamiraux
4 //
5 // This file is part of hpp-core
6 // hpp-core is free software: you can redistribute it
7 // and/or modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation, either version
9 // 3 of the License, or (at your option) any later version.
10 //
11 // hpp-core is distributed in the hope that it will be
12 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Lesser Public License for more details. You should have
15 // received a copy of the GNU Lesser General Public License along with
16 // hpp-core If not, see
17 // <http://www.gnu.org/licenses/>.
18 
19 #ifndef HPP_CORE_DUBINS_PATH_HH
20 # define HPP_CORE_DUBINS_PATH_HH
21 
22 # include <hpp/pinocchio/device.hh>
23 
24 # include <hpp/core/fwd.hh>
25 # include <hpp/core/config.hh>
26 # include <hpp/core/path-vector.hh>
27 
28 namespace hpp {
29  namespace core {
32 
46  class DubinsPath : public PathVector
47  {
48  public:
50 
52  virtual ~DubinsPath () {}
53 
66  value_type extraLength,
67  value_type rho,
68  size_type xyId, size_type rzId,
69  const std::vector<JointPtr_t> wheels);
80  static DubinsPathPtr_t create (const DevicePtr_t& device,
81  ConfigurationIn_t init,
83  value_type extraLength,
84  value_type rho,
85  size_type xyId, size_type rzId,
86  const std::vector<JointPtr_t> wheels,
88 
92  {
93  DubinsPath* ptr = new DubinsPath (*path);
94  DubinsPathPtr_t shPtr (ptr);
95  ptr->init (shPtr);
96  return shPtr;
97  }
98 
103  (const DubinsPathPtr_t& path, const ConstraintSetPtr_t& constraints)
104  {
105  DubinsPath* ptr = new DubinsPath (*path, constraints);
106  DubinsPathPtr_t shPtr (ptr);
107  ptr->init (shPtr);
108  return shPtr;
109  }
110 
112  virtual PathPtr_t copy () const
113  {
114  return createCopy (weak_.lock ());
115  }
116 
121  virtual PathPtr_t copy (const ConstraintSetPtr_t& constraints) const
122  {
123  return createCopy (weak_.lock (), constraints);
124  }
125 
127  inline DevicePtr_t device () const
128  {
129  return device_;
130  }
131 
133  inline Configuration_t initial () const
134  {
135  return initial_;
136  }
137 
139  inline Configuration_t end () const
140  {
141  return end_;
142  }
143 
144  protected:
146  virtual std::ostream& print (std::ostream &os) const
147  {
148  os << "DubinsPath:" << std::endl;
149  Path::print (os);
150  os << "initial configuration: " << initial_.transpose () << std::endl;
151  os << "final configuration: " << end_.transpose () << std::endl;
152  return os;
153  }
155  DubinsPath (const DevicePtr_t& robot, ConfigurationIn_t init,
156  ConfigurationIn_t end, value_type extraLength, value_type rho,
157  size_type xyId, size_type rzId,
158  const std::vector<JointPtr_t> wheels);
159 
161  DubinsPath (const DevicePtr_t& robot, ConfigurationIn_t init,
162  ConfigurationIn_t end, value_type extraLength, value_type rho,
163  size_type xyId, size_type rzId,
164  const std::vector<JointPtr_t> wheels,
165  ConstraintSetPtr_t constraints);
166 
168  DubinsPath (const DubinsPath& path);
169 
171  DubinsPath (const DubinsPath& path,
172  const ConstraintSetPtr_t& constraints);
173 
174  void init (DubinsPathPtr_t self);
175 
176  private:
177  void dubins_init_normalised (double alpha, double beta, double d);
178  void dubins_init (vector3_t q0, vector3_t q1);
179  typedef Eigen::Matrix<value_type, 3, 1> Lengths_t;
180 
181  DevicePtr_t device_;
182  Configuration_t initial_;
183  Configuration_t end_;
184  const size_type xyId_,rzId_;
185  size_type dxyId_,drzId_;
186  std::vector<JointPtr_t> wheels_;
187  std::size_t typeId_;
188  Lengths_t lengths_;
189  value_type extraLength_, rho_;
190 
191  vector3_t qi_; // the initial configuration
192  DubinsPathWkPtr_t weak_;
193 
194  }; // class DubinsPath
195 
197  } // namespace core
198 } // namespace hpp
199 #endif // HPP_CORE_DUBINS_PATH_HH
boost::shared_ptr< Path > PathPtr_t
Definition: fwd.hh:170
Configuration_t initial() const
Get the initial configuration.
Definition: dubins-path.hh:133
pinocchio::DevicePtr_t DevicePtr_t
Definition: fwd.hh:114
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:97
static DubinsPathPtr_t create(const DevicePtr_t &device, ConfigurationIn_t init, ConfigurationIn_t end, value_type extraLength, value_type rho, size_type xyId, size_type rzId, const std::vector< JointPtr_t > wheels)
boost::shared_ptr< ConstraintSet > ConstraintSetPtr_t
Definition: fwd.hh:110
pinocchio::size_type size_type
Definition: fwd.hh:156
virtual PathPtr_t copy() const
Return a shared pointer to a copy of this object.
Definition: dubins-path.hh:112
static DubinsPathPtr_t createCopy(const DubinsPathPtr_t &path)
Definition: dubins-path.hh:91
const ConstraintSetPtr_t & constraints() const
Get constraints the path is subject to.
Definition: path.hh:227
virtual ~DubinsPath()
Destructor.
Definition: dubins-path.hh:52
boost::shared_ptr< DubinsPath > DubinsPathPtr_t
Definition: fwd.hh:186
virtual PathPtr_t copy(const ConstraintSetPtr_t &constraints) const
Definition: dubins-path.hh:121
DubinsPath(const DevicePtr_t &robot, ConfigurationIn_t init, ConfigurationIn_t end, value_type extraLength, value_type rho, size_type xyId, size_type rzId, const std::vector< JointPtr_t > wheels)
Constructor.
Definition: dubins-path.hh:46
void init(DubinsPathPtr_t self)
core::PathVector parent_t
Definition: dubins-path.hh:49
pinocchio::value_type value_type
Definition: fwd.hh:157
FCL_REAL d
Concatenation of several paths.
Definition: path-vector.hh:32
virtual std::ostream & print(std::ostream &os) const
pinocchio::vector3_t vector3_t
Definition: fwd.hh:148
virtual std::ostream & print(std::ostream &os) const
Print path in a stream.
Definition: dubins-path.hh:146
Configuration_t end() const
Get the final configuration.
Definition: dubins-path.hh:139
DevicePtr_t device() const
Return the internal robot.
Definition: dubins-path.hh:127
pinocchio::Configuration_t Configuration_t
Definition: fwd.hh:96