ISeeML  1.0
DubinsPath.hpp
1 //
2 // Definition of iSeeML::rob::DubinsPath, class of Dubins' paths
3 // (optimal forward-only paths with discontinuous curvature
4 // profile).
5 //
6 
7 // To only include this definition once
8 #ifndef ISEEML_DUBINS_HH
9 #define ISEEML_DUBINS_HH
10 
11 
12 // This class needs the definition of iSeeML::rob::DubinsLikePath.
13 #include <iSeeML/rob/DubinsLikePath.hpp>
14 
15 
27  // === Object's Fields ==========================================
28 
29  // Array of nbPossiblePaths Dubins' paths.
30  static DubinsPath computationArray[nbPossiblePaths];
31 
32 public:
37  static const string ClassName;
38 
39 
40  // === Constructors and Destructors =============================
41 
50 
64  const double& maxCurv, const double& length1,
65  const double& length2, const double& length3) :
66  // Maximum curvature and type are directly given
67  DubinsLikePath(type, fabs(maxCurv))
68  { definePieces(start, length1, length2, length3); }
69 
79  const double& maxCurv) :
80  DubinsLikePath((Type) -1, fabs(maxCurv))
81  { connect(start, goal); }
82 
83 
88  DubinsPath(const DubinsPath& other) : DubinsLikePath(other) {}
89 
90 
91  // === Description Methods ======================================
92 
102  { return *( (iSeeML::Object*) (new DubinsPath(*this)) ); }
103 
104 
113  void writeTo(ostream& O) const;
114 
115 
126  double turnRadius() const { return( 1 / maxCurv() ); }
127 
128 protected:
137  int turnNbPieces(const double& defl) const {
138  return( isZero(defl) ? 0 : 1 ); }
139 
140 
160  virtual bool getConnection(const double& dist,
161  double& length, double& angle) const;
162 
163 
164  // === Modification Methods =====================================
165 
187  void addTurn(int& index, const iSeeML::rob::OrPtConfig **start,
188  const double& defl);
189 
190 public:
191  // === Operators ================================================
192 
200  { DubinsLikePath::operator=(other); return *this; }
201 
202 
203  // === Various Methods ==========================================
204 
220  void computeCenters(const iSeeML::rob::OrPtConfig& start,
221  const iSeeML::rob::OrPtConfig& goal,
223  const;
224 
225 protected:
226  // cf. DubinsLikePath
228  // fill the array with clones of the current path
229  int i; for(i = 0; i < nbPossiblePaths; i++)
230  computationArray[i] = *this;
231  // return it
232  return( (DubinsLikePath*) computationArray ); }
233 
254  const int index) const {
255  DubinsPath *array = (DubinsPath *) paths;
256 #ifdef ISEEML_CHECK_DUBINS_PATH_PRECOND
257  if ( (index < 0) || (index >= nbPossiblePaths) )
258  cerr << ClassName << "::getConnection: abnormal index"
259  << " parameter (" << index << ")!" << endl;
260 #endif
261  const int i =
262 #ifdef ISEEML_CHECK_ARRAY_ELEMT
263  index < 0 ? 0 : index > nbPossiblePaths ? nbPossiblePaths :
264 #endif
265  index;
266  return array[i]; }
267 
268 }; // end of class iSeeML::rob::DubinsPath
269 
270 
271 #endif // end of definition
272 
Type
Dubins-like paths can be of six types: their first and last parts are turns, their middle part is tan...
Definition: DubinsLikePath.hpp:47
This class defines Dubins like paths, which are similar to Dubins paths.
Definition: DubinsLikePath.hpp:33
double turnRadius() const
Description method, giving the radius of the turning circle (the circle of all the configurations whi...
Definition: DubinsPath.hpp:126
This class is the base class of ISeeML: every class of ISeeML inherits this one.
Definition: Object.hpp:47
const iSeeML::rob::OrPtConfig & start() const
Description method, giving the path&#39;s starting configuration (first piece&#39;s starting configuration)...
Definition: CompoundPath.hpp:79
void addTurn(int &index, const iSeeML::rob::OrPtConfig **start, const double &defl)
Modification method, adding to the pieces of a path a turn starting at a given configuration, with a given curvature sign and length.
void writeTo(ostream &O) const
Description method, writing a description of the path in a given output stream.
static const string ClassName
The class name is public, as this class can be instanced.
Definition: DubinsPath.hpp:37
void connect(const iSeeML::rob::OrPtConfig &start, const iSeeML::rob::OrPtConfig &goal)
Modification method, defining type and pieces of a Dubins&#39; like path in order to connect two given co...
int turnNbPieces(const double &defl) const
Description method, computing the number of pieces (0 or 1) needed for a turn of given deflection...
Definition: DubinsPath.hpp:137
iSeeML::rob::DubinsLikePath * connectArray() const
Various method, returning an array of nbPossiblePaths Dubins-like paths, initialised as clones of the...
Definition: DubinsPath.hpp:227
This class defines a standard robotic configuration, containing the position of a reference point and...
Definition: OrPtConfig.hpp:45
virtual bool getConnection(const double &dist, double &length, double &angle) const
Description method, trying to compute the length of the line segment connecting the turning circles a...
DubinsPath(const iSeeML::rob::OrPtConfig &start, const Type &type, const double &maxCurv, const double &length1, const double &length2, const double &length3)
The &#39;forward&#39; constructor: a Dubins&#39; path is built from its starting oriented point, its type, its maximum curvature and its parts&#39; lengths.
Definition: DubinsPath.hpp:63
This class defines Dubins&#39; paths, made of circular arcs tangentially connected by line segments...
Definition: DubinsPath.hpp:26
void computeCenters(const iSeeML::rob::OrPtConfig &start, const iSeeML::rob::OrPtConfig &goal, iSeeML::geom::Point centers[nbTurningCircles]) const
Various method, computing the set of circle centers used to turn from starting configuration of the c...
Path made of a left turn, a straight line and a left turn.
Definition: DubinsLikePath.hpp:49
double length() const
Description method, giving the path&#39;s length (sum of the pieces&#39; length).
Definition: CompoundPath.hpp:126
This class defines 2D geometric points, defined by their Cartesian coordinates.
Definition: Point.hpp:29
DubinsPath(const iSeeML::rob::OrPtConfig &start, const iSeeML::rob::OrPtConfig &goal, const double &maxCurv)
The &#39;goto&#39; constructor: a Dubins&#39; path is built, starting from a given iSeeML::rob::OrPtConfig and re...
Definition: DubinsPath.hpp:78
the number of possible paths (6).
Definition: DubinsLikePath.hpp:64
iSeeML::Object & clone() const
Description method, giving a copy of the current Dubins&#39; path.
Definition: DubinsPath.hpp:101
DubinsPath(const DubinsPath &other)
The copy constructor.
Definition: DubinsPath.hpp:88
iSeeML::rob::DubinsLikePath & getSolution(iSeeML::rob::DubinsLikePath *paths, const int index) const
Various method, getting in an array of Dubins-like paths the element of given index.
Definition: DubinsPath.hpp:253
void definePieces(const iSeeML::rob::OrPtConfig &start, const double &defl1, const double &lenDefl, const double &defl3)
const double & maxCurv() const
Description method, giving the path&#39;s maximum curvature.
Definition: DubinsLikePath.hpp:177
DubinsPath & operator=(const DubinsPath &other)
Copy operator (default one is not correct).
Definition: DubinsPath.hpp:199
static bool isZero(const double &x)
Method comparing a double to zero.
Definition: Object.hpp:288
const Type & type() const
Description method, giving the path&#39;s type (from lsl to rlr).
Definition: DubinsLikePath.hpp:171
DubinsPath()
The default constructor should only be used for array initializations: it generates a path starting f...
Definition: DubinsPath.hpp:49
the number of usefull turning circles (4).
Definition: DubinsLikePath.hpp:66
DubinsLikePath & operator=(const DubinsLikePath &other)
Copy operator (default one is not correct).
Definition: DubinsLikePath.hpp:471