libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
localpath.hpp
1 #ifndef LOCALPATH_HPP
2 #define LOCALPATH_HPP
3 
4 #include "API/ConfigSpace/configuration.hpp"
5 
6 #include "Localpath-pkg.h"
7 
8 class Robot;
9 
15 class LocalPath
16 {
17 public:
28  LocalPath(std::tr1::shared_ptr<Configuration> B, std::tr1::shared_ptr<Configuration> E);
29 
33  LocalPath(LocalPath& path, double& pathDelta, bool lastValidConfig = true);
34 
39  LocalPath(const LocalPath& path);
40 
45  LocalPath(Robot* R, p3d_localpath* lpPtr);
46 
50  ~LocalPath();
51 
52  //Accessor
57  p3d_localpath* getLocalpathStruct(bool multi_sol = false);
58 
63  std::tr1::shared_ptr<Configuration> getBegin();
68  std::tr1::shared_ptr<Configuration> getEnd();
69 
74  // Graph* getGraph();
79  Robot* getRobot();
80 
85  int getNbColTest();
86 
91  int getNbCostTest();
92  void setNbCostTest(double nbCostTest){_NbCostTest = nbCostTest;}
93 
98  bool getEvaluated();
99 
104  p3d_localpath_type getType();
105 
111  std::tr1::shared_ptr<Configuration> getLastValidConfig(double& p);
112 
117  _Evaluated = false;
118  }
119 
124  bool isValid();
125 
132  bool unvalidLocalpathTest(Robot* R, int* ntest);
133 
138  bool classicTest();
139 
144  double length();
145 
149  double getParamMax();
150 
157  std::tr1::shared_ptr<Configuration> configAtDist(double dist);
158 
165  std::tr1::shared_ptr<Configuration> configAtParam(double param);
166 
173  double stayWithInDistance(double u, bool goForward, double* distance);
174 
179  double getResolution(double step = 0.0);
180 
184  unsigned int getNumberOfCostSegments();
185 
189  std::vector<std::pair<double, double> > getCostProfile();
190 
195  double whenCostIntegralPasses(double thresh);
196 
198  double cost();
199 
200  double getAverageCost();
201  void setAverageCost(double averageCost){_AverageCost=averageCost;}
202 
204  void setCost(double cost) { _Cost = cost; _costEvaluated = true; }
206  void setMaxCost(double cost){_MaxCost = cost;}
207  double getMaxCost() const;
208 
210  double getReverseCost() const { return reverseCost; }
211 
213  void setReverseCost(double cost) { reverseCost = cost; }
214 
216  void resetCostComputed() { _costEvaluated = false; }
217 
219  void setIkSol(int* iksol) { _ikSol = iksol; }
220 
222  std::tr1::shared_ptr<LocalPath> buildReversePath();
223 
225  void print();
226 
227 protected:
228  Robot* _Robot;
229 
230  std::tr1::shared_ptr<Configuration> _Begin;
231  std::tr1::shared_ptr<Configuration> _End;
232 
233 private:
234 
235  p3d_localpath* _LocalPath;
236  bool _Valid;
237  bool _Evaluated;
238  double _lastValidParam;
239  std::tr1::shared_ptr<Configuration> _lastValidConfig;
240  bool _lastValidEvaluated;
241  int _NbColTest;
242 
243  int* _ikSol;
244 
245  bool _costEvaluated;
246  double _Cost;
247  bool _ResolEvaluated;
248  double _Resolution;
249 
251  p3d_localpath_type _Type;
252 
253 
254 
255  double _AverageCost;
256  double _MaxCost;
257  int _NbCostTest;
258 
260  double reverseCost;
261 };
262 
263 typedef std::tr1::shared_ptr<LocalPath> localPathPtr_t;
264 
265 #endif
double getReverseCost() const
get the cost of the reverse local path.
Definition: localpath.hpp:210
void setLocalpathAsNotTested()
Set the localpath as untested.
Definition: localpath.hpp:116
std::tr1::shared_ptr< Configuration > getEnd()
obtient la configuration finale
Definition: localpath.cpp:200
p3d_localpath_type getType()
obtient le type de LocalPath
Definition: localpath.cpp:215
double stayWithInDistance(double u, bool goForward, double *distance)
Stay within dist From a parameter along the LocalPath and distance a vector of distance in WorkSapce ...
Definition: localpath.cpp:383
int getNbCostTest()
Returns the number of Colision test done to test the local path.
Definition: localpath.cpp:297
double length()
obtient la longueur du LocaPath
Definition: localpath.cpp:310
int getNbColTest()
Returns the number of Colision test done to test the local path.
Definition: localpath.cpp:284
Classe représentant un chemin local.
Definition: localpath.hpp:15
void print()
Print the variables inside the local path.
Definition: localpath.cpp:561
std::tr1::shared_ptr< LocalPath > buildReversePath()
Return the reverse path and update its cost.
Definition: localpath.cpp:552
bool getEvaluated()
teste si le LocalPath à été évalué
Definition: localpath.cpp:210
double whenCostIntegralPasses(double thresh)
Return param at which integral of cost is higher than the input (going from begin to end) ...
Definition: localpath.cpp:463
This class holds a the robot represented by a kinematic chain.
Definition: robot.hpp:42
double getParamMax()
Equivalent to the length when using linear interpolation.
Definition: localpath.cpp:328
void setMaxCost(double cost)
Set the maximal cost found along the local path.
Definition: localpath.hpp:206
void setCost(double cost)
Set the cost of the local path.
Definition: localpath.hpp:204
double cost()
Compute the total cost of the path.
Definition: localpath.cpp:510
p3d_localpath * getLocalpathStruct(bool multi_sol=false)
obtient la structure p3d_localpath stockée
Definition: localpath.cpp:174
unsigned int getNumberOfCostSegments()
Get number of cost segments.
Definition: localpath.cpp:431
LocalPath(std::tr1::shared_ptr< Configuration > B, std::tr1::shared_ptr< Configuration > E)
constructors and destructors
Definition: localpath.cpp:32
void setIkSol(int *iksol)
Set the ik sol to be used in the local planner.
Definition: localpath.hpp:219
double getResolution(double step=0.0)
Cost resolution for integral and work along LocalPath.
Definition: localpath.cpp:411
void resetCostComputed()
When reset the next cost query will compute it.
Definition: localpath.hpp:216
std::tr1::shared_ptr< Configuration > configAtDist(double dist)
obtient une Configuration se trouvant à une distance donnée du début du LocalPath ...
Definition: localpath.cpp:336
bool classicTest()
Test the localpath using the classic method as opposed to dichotomic test.
Definition: localpath.cpp:235
std::tr1::shared_ptr< Configuration > getLastValidConfig(double &p)
obtient la dernière Configuration valide le long du LocalPath
Definition: localpath.cpp:227
Robot * getRobot()
obtient le Graph pour lequel le LocalPath est créé
Definition: localpath.cpp:205
std::vector< std::pair< double, double > > getCostProfile()
Returns the cost profile of the localPath.
Definition: localpath.cpp:440
std::tr1::shared_ptr< Configuration > configAtParam(double param)
obtient une Configuration se trouvant sur le LocalPath à un paramètre donnée
Definition: localpath.cpp:364
~LocalPath()
Destructor.
Definition: localpath.cpp:165
std::tr1::shared_ptr< Configuration > getBegin()
obtient la configuration initiale
Definition: localpath.cpp:195
bool isValid()
teste si le LocalPath est valide
Definition: localpath.cpp:259
void setReverseCost(double cost)
Set the cost of the reverse local path.
Definition: localpath.hpp:213
bool unvalidLocalpathTest(Robot *R, int *ntest)
test si le LocalPath est valide
Definition: localpath.cpp:402