hpp-core  4.9.0
Implement basic classes for canonical path planning for kinematic chains.
reeds-shepp-path.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2016 CNRS
3 // Authors: Joseph Mirabel
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_REEDS_SHEPP_PATH_HH
20 # define HPP_CORE_REEDS_SHEPP_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 HPP_CORE_DLLAPI ReedsSheppPath : public PathVector
47  {
48  public:
50 
52  virtual ~ReedsSheppPath () {}
53 
60  ConfigurationIn_t init,
62  value_type extraLength,
63  value_type rho,
64  size_type xyId, size_type rzId,
65  const std::vector<JointPtr_t> wheels);
66 
73  static ReedsSheppPathPtr_t create (const DevicePtr_t& device,
74  ConfigurationIn_t init,
76  value_type extraLength,
77  value_type rho,
78  size_type xyId, size_type rzId,
79  const std::vector<JointPtr_t> wheels,
80  ConstraintSetPtr_t constraints);
81 
85  {
86  ReedsSheppPath* ptr = new ReedsSheppPath (*path);
87  ReedsSheppPathPtr_t shPtr (ptr);
88  ptr->init (shPtr);
89  return shPtr;
90  }
91 
95  static ReedsSheppPathPtr_t createCopy
96  (const ReedsSheppPathPtr_t& path, const ConstraintSetPtr_t& constraints)
97  {
98  ReedsSheppPath* ptr = new ReedsSheppPath (*path, constraints);
99  ReedsSheppPathPtr_t shPtr (ptr);
100  ptr->init (shPtr);
101  return shPtr;
102  }
103 
105  virtual PathPtr_t copy () const
106  {
107  return createCopy (weak_.lock ());
108  }
109 
114  virtual PathPtr_t copy (const ConstraintSetPtr_t& constraints) const
115  {
116  return createCopy (weak_.lock (), constraints);
117  }
118 
120  inline DevicePtr_t device () const
121  {
122  return device_;
123  }
124 
126  inline Configuration_t initial () const
127  {
128  return initial_;
129  }
130 
132  inline Configuration_t end () const
133  {
134  return end_;
135  }
136 
137  protected:
139  virtual std::ostream& print (std::ostream &os) const;
141  ReedsSheppPath (const DevicePtr_t& robot, ConfigurationIn_t init,
142  ConfigurationIn_t end, value_type extraLength,
143  value_type rho,
144  size_type xyId, size_type rzId,
145  const std::vector<JointPtr_t> wheels);
146 
148  ReedsSheppPath (const DevicePtr_t& robot, ConfigurationIn_t init,
149  ConfigurationIn_t end, value_type extraLength,
150  value_type rho, size_type xyId, size_type rzId,
151  const std::vector<JointPtr_t> wheels,
152  ConstraintSetPtr_t constraints);
153 
155  ReedsSheppPath (const ReedsSheppPath& path);
156 
158  ReedsSheppPath (const ReedsSheppPath& path,
159  const ConstraintSetPtr_t& constraints);
160 
161  void init (ReedsSheppPathPtr_t self);
162 
164  virtual void impl_derivative (vectorOut_t result, const value_type& t,
165  size_type order) const;
166 
167  private:
168  typedef Eigen::Matrix<value_type, 5, 1> Lengths_t;
169 
170  // Compute path
171  void buildReedsShepp (const JointPtr_t rz,
172  const std::vector<JointPtr_t> wheels);
173  // Setup path
174  void setupPath (const std::size_t& typeId, double t, double u=0.,
175  double v=0., double w=0., double x=0.);
176 
177  void CSC (const vector2_t& xy, const vector2_t& csPhi, const double& phi);
178  void CCC (const vector2_t& xy, const vector2_t& csPhi, const double& phi);
179  void CCCC (const vector2_t& xy, const vector2_t& csPhi, const double& phi);
180  void CCSC (const vector2_t& xy, const vector2_t& csPhi, const double& phi);
181  void CCSCC(const vector2_t& xy, const vector2_t& csPhi, const double& phi);
182 
183 
184  DevicePtr_t device_;
185  Configuration_t initial_;
186  Configuration_t end_;
187  const size_type xyId_,rzId_;
188  size_type dxyId_,drzId_;
189  std::size_t typeId_;
190  Lengths_t lengths_;
191  // Distance traveled by the center of the rear wheel axis
192  value_type rsLength_;
193  // Extra length to take into account the motion of other joints:
194  // Length of path = rsLength_ + extraLength_
195  value_type extraLength_;
196  // Minimal radius of curvature
197  value_type rho_;
198  ReedsSheppPathWkPtr_t weak_;
199  }; // class ReedsSheppPath
201  } // namespace core
202 } // namespace hpp
203 #endif // HPP_CORE_REEDS_SHEPP_PATH_HH
boost::shared_ptr< Path > PathPtr_t
Definition: fwd.hh:170
boost::shared_ptr< Device > DevicePtr_t
pinocchio::DevicePtr_t DevicePtr_t
Definition: fwd.hh:114
pinocchio::ConfigurationIn_t ConfigurationIn_t
Definition: fwd.hh:97
boost::shared_ptr< ConstraintSet > ConstraintSetPtr_t
Definition: fwd.hh:110
virtual PathPtr_t copy(const ConstraintSetPtr_t &constraints) const
Definition: reeds-shepp-path.hh:114
ObjectFactory * create(ObjectFactory *parent=NULL, const XMLElement *element=NULL)
pinocchio::size_type size_type
Definition: fwd.hh:156
pinocchio::JointPtr_t JointPtr_t
Definition: fwd.hh:133
boost::shared_ptr< ReedsSheppPath > ReedsSheppPathPtr_t
Definition: fwd.hh:184
DevicePtr_t device() const
Return the internal robot.
Definition: reeds-shepp-path.hh:120
Definition: reeds-shepp-path.hh:46
void init(ReedsSheppPathPtr_t self)
virtual ~ReedsSheppPath()
Destructor.
Definition: reeds-shepp-path.hh:52
virtual PathPtr_t copy() const
Return a shared pointer to a copy of this object.
Definition: reeds-shepp-path.hh:105
Configuration_t end() const
Get the final configuration.
Definition: reeds-shepp-path.hh:132
pinocchio::value_type value_type
Definition: fwd.hh:157
Concatenation of several paths.
Definition: path-vector.hh:32
core::PathVector parent_t
Definition: reeds-shepp-path.hh:49
Transform3f t
Eigen::Matrix< value_type, 2, 1 > vector2_t
Definition: fwd.hh:200
static ReedsSheppPathPtr_t createCopy(const ReedsSheppPathPtr_t &path)
Definition: reeds-shepp-path.hh:84
pinocchio::vectorOut_t vectorOut_t
Definition: fwd.hh:203
Configuration_t initial() const
Get the initial configuration.
Definition: reeds-shepp-path.hh:126
pinocchio::Configuration_t Configuration_t
Definition: fwd.hh:96