ISeeML  1.0
FscPath.hpp
1 //
2 // Definition of iSeeML::rob::FscPath, class of FSC paths
3 // (Forward-only Sub-optimal Continuous-curvature paths).
4 //
5 
6 // To only include this definition once
7 #ifndef ISEEML_FSC_PATH_HH
8 #define ISEEML_FSC_PATH_HH
9 
10 
11 // This class needs the definition of iSeeML::rob::DubinsLikePath.
12 #include <iSeeML/rob/DubinsLikePath.hpp>
13 
14 
27  // === Object's Fields ==========================================
28 
30  double MaximumCurvDerivative;
31 
40 
49  double LimDefl;
50 
51 
57  double TurnRadius;
58 
64  double TurnAngle;
66 
67  // Array of nbPossiblePaths Dubins' paths.
68  static FscPath computationArray[nbPossiblePaths];
69 
70 public:
75  static const string ClassName;
76 
77 
78  // === Constructors and Destructors =============================
79 
92  FscPath() : DubinsLikePath(lsl, 0), MaximumCurvDerivative(0),
93  LimDefl(0), TurnRadius(-1), TurnAngle(-M_PI) {}
94 
110  const double& maxCurv, const double& maxCDer,
111  const double& length1, const double& length2,
112  const double& length3) :
113  // Max curv., Max curv.'s deriv. and type are directly given
114  DubinsLikePath(type, fabs(maxCurv)),
115  MaximumCurvDerivative( fabs(maxCDer) ) {
116  // the rest is computed (values and pieces)
117  computeValues(maxCurv, maxCDer,
118  LimDefl, TurnRadius, TurnAngle);
119  definePieces(start, length1, length2, length3); }
120 
144  const double& maxCurv, const double& maxCDer,
145  const double& limDefl, const double& turnRad,
146  const double& turnAng, const double& length1,
147  const double& length2, const double& length3) :
148  // Max curv., Max curv.'s deriv. and type are directly given
149  DubinsLikePath(type, fabs(maxCurv)),
150  MaximumCurvDerivative(fabs(maxCDer)), LimDefl( fabs(limDefl) ),
151  TurnRadius( fabs(turnRad) ), TurnAngle( fabs(turnAng) ) {
152  definePieces(start, length1, length2, length3); }
153 
166  const iSeeML::rob::OrPtConfig& goal,
167  const double& maxCurv, const double& maxCDer) :
168  // set main fields values
169  DubinsLikePath((Type) -1, fabs(maxCurv)),
170  MaximumCurvDerivative( fabs(maxCDer) ) {
171  // compute the other fields values
172  computeValues(maxCurv, maxCDer,
173  LimDefl, TurnRadius, TurnAngle);
174  connect(start, goal); }
175 
197  const iSeeML::rob::OrPtConfig& goal,
198  const double& maxCurv, const double& maxCDer,
199  const double& limDefl,
200  const double& turnRad, const double& turnAng) :
201  // set main fields values
202  DubinsLikePath((Type) -1, fabs(maxCurv)),
203  MaximumCurvDerivative(fabs(maxCDer)), LimDefl( fabs(limDefl) ),
204  TurnRadius( fabs(turnRad) ), TurnAngle( fabs(turnAng) )
205  // compute the other fields values
206  { connect(start, goal); }
207 
208 
213  FscPath(const FscPath& other) : DubinsLikePath(other),
214  MaximumCurvDerivative( other.maxCurvDeriv() ),
215  LimDefl( other.limDefl() ), TurnRadius( other.turnRadius() ),
216  TurnAngle( other.turnAngle() ) {}
217 
218 
219  // === Description Methods ======================================
220 
239  static void computeValues(const double& maxCurv,
240  const double& maxCDer, double& limDefl,
241  double& turnRad, double& turnAng);
242 
243 
252  { return *( (iSeeML::Object*) (new FscPath(*this)) ); }
253 
254 
263  void writeTo(ostream& O) const;
264 
265 
271  double maxCurvDeriv() const { return MaximumCurvDerivative; }
272 
273 
288  double limDefl() const { return LimDefl; }
289 
290 
300  double turnRadius() const { return TurnRadius; }
301 
313  double turnAngle() const { return TurnAngle; }
314 
315 protected:
324  bool isShortTurn(const double& defl) const
325  { return( fabs(defl) <= limDefl() ); }
326 
335  int turnNbPieces(const double& defl) const
336  { return( isZero(defl) ? 1 : isShortTurn(defl) ? 2 : 3 ); }
337 
338 
357  virtual bool getConnection(const double& dist,
358  double& length, double& angle) const;
359 
360 
361  // === Modification Methods =====================================
362 
383  void addTurn(int& index, const iSeeML::rob::OrPtConfig **start,
384  const double& defl);
385 
386 public:
387  // === Operators ================================================
388 
395  FscPath& operator=(const FscPath& other) {
397  MaximumCurvDerivative = other.maxCurvDeriv();
398  LimDefl = other.limDefl(); TurnRadius = other.turnRadius();
399  TurnAngle = other.turnAngle(); return *this; }
400 
401 
402  // === Various Methods ==========================================
403 
418  void computeCenters(const iSeeML::rob::OrPtConfig& start,
419  const iSeeML::rob::OrPtConfig& goal,
421  const;
422 
423 protected:
424  // cf. DubinsLikePath
426  // fill the array with clones of the current path
427  int i; for(i = 0; i < nbPossiblePaths; i++)
428  computationArray[i] = *this;
429  // return it
430  return( (DubinsLikePath*) computationArray ); }
431 
452  (iSeeML::rob::DubinsLikePath* paths, const int index) const {
453  FscPath *array = (FscPath *) paths;
454 #ifdef ISEEML_CHECK_FSC_PATH_PRECOND
455  if ( (index < 0) || (index >= nbPossiblePaths) )
456  cerr << ClassName << "::getConnection: abnormal index"
457  << " parameter (" << index << ")!" << endl;
458 #endif
459  const int i =
460 #ifdef ISEEML_CHECK_ARRAY_ELEMT
461  index < 0 ? 0 : index > nbPossiblePaths ? nbPossiblePaths :
462 #endif
463  index;
464  return array[i]; }
465 
466 }; // end of class iSeeML::rob::FscPath
467 
468 #endif // end of definition
469 
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
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
double limDefl() const
Description method, giving the limit deflection: a turn of lower (but not zero) deflection is degener...
Definition: FscPath.hpp:288
Objects of this class are Forward-only Sub-optimal Continuous-curvature (FSC) paths, made of circular arcs, pieces of clothoid and line segments.
Definition: FscPath.hpp:26
double turnAngle() const
Description method, giving the constant angle between the turning circle&#39;s tangent and the orientatio...
Definition: FscPath.hpp:313
iSeeML::Object & clone() const
Description method, giving a copy of the current FSC path.
Definition: FscPath.hpp:251
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...
bool isShortTurn(const double &defl) const
Description method, checking whether the given length is too short with respect to the maximum curvat...
Definition: FscPath.hpp:324
This class defines a standard robotic configuration, containing the position of a reference point and...
Definition: OrPtConfig.hpp:45
static const string ClassName
The class name is public, as this class can be instanced.
Definition: FscPath.hpp:75
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.
FscPath(const iSeeML::rob::OrPtConfig &start, const Type &type, const double &maxCurv, const double &maxCDer, const double &length1, const double &length2, const double &length3)
The &#39;forward&#39; constructor: a FSC path is built from its starting oriented point, its type...
Definition: FscPath.hpp:109
FscPath(const iSeeML::rob::OrPtConfig &start, const iSeeML::rob::OrPtConfig &goal, const double &maxCurv, const double &maxCDer, const double &limDefl, const double &turnRad, const double &turnAng)
The complete &#39;goto&#39; constructor: a FSC path is built, starting from a given iSeeML::rob::OrPtConfig a...
Definition: FscPath.hpp:196
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: FscPath.hpp:452
Path made of a left turn, a straight line and a left turn.
Definition: DubinsLikePath.hpp:49
int turnNbPieces(const double &defl) const
Description method, computing the number of pieces needed for a turn of given deflection.
Definition: FscPath.hpp:335
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
void writeTo(ostream &O) const
Description method, writing a description of the path in a given output stream.
FscPath(const iSeeML::rob::OrPtConfig &start, const iSeeML::rob::OrPtConfig &goal, const double &maxCurv, const double &maxCDer)
The &#39;goto&#39; constructor: a FSC path is built, starting from a given iSeeML::rob::OrPtConfig and reachi...
Definition: FscPath.hpp:165
static void computeValues(const double &maxCurv, const double &maxCDer, double &limDefl, double &turnRad, double &turnAng)
Description method, computing from maximum curvature and maximum curvature&#39;s derivative the values of...
double turnRadius() const
Description method, giving the radius of the turning circle (the circle of all the configurations whi...
Definition: FscPath.hpp:300
the number of possible paths (6).
Definition: DubinsLikePath.hpp:64
FscPath & operator=(const FscPath &other)
Copy operator (default one is not correct).
Definition: FscPath.hpp:395
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...
FscPath(const FscPath &other)
The copy constructor.
Definition: FscPath.hpp:213
FscPath(const iSeeML::rob::OrPtConfig &start, const Type &type, const double &maxCurv, const double &maxCDer, const double &limDefl, const double &turnRad, const double &turnAng, const double &length1, const double &length2, const double &length3)
The complete &#39;forward&#39; constructor: a FSC path is built from its starting oriented point...
Definition: FscPath.hpp:143
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...
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
static bool isZero(const double &x)
Method comparing a double to zero.
Definition: Object.hpp:288
double maxCurvDeriv() const
Description method, giving the path&#39;s maximum curvature&#39;s derivative.
Definition: FscPath.hpp:271
iSeeML::rob::DubinsLikePath * connectArray() const
Various method, returning an array of nbPossiblePaths Dubins-like paths, initialised as clones of the...
Definition: FscPath.hpp:425
const Type & type() const
Description method, giving the path&#39;s type (from lsl to rlr).
Definition: DubinsLikePath.hpp:171
FscPath()
The default constructor should only be used for array initializations: it generates a path starting f...
Definition: FscPath.hpp:92
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