libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
costOptimization.hpp
1 /*
2  * costOptimization.hpp
3  *
4  * Created on: Jun 25, 2009
5  * Author: jmainpri
6  */
7 
8 #ifndef COST_OPTIMIZATION_HPP_
9 #define COST_OPTIMIZATION_HPP_
10 
11 #include "API/ConfigSpace/configuration.hpp"
12 #include "planner/TrajectoryOptim/Classic/smoothing.hpp"
13 
18 namespace API
19 {
20  class CostOptimization : public Smoothing
21  {
22  public:
23 
28  CostOptimization(const Trajectory& T);
29  CostOptimization(Robot* R,p3d_traj* t);
30 
32 
36  void printDebugInfo();
37 
41  bool deformInCollision() { return m_inCollision; }
42 
46  void setCheat() { m_cheat = true; }
47 
51  double getMinCost() { return m_mincost; }
52 
57  bool oneLoopDeform();
58 
65 
70  static double getLastDescendingConfParam( LocalPath& directionPath );
71 
76  bool connectConfiguration( confPtr_t q, double step );
77 
81  static confPtr_t perturbCurrent( confPtr_t qCurrPt, confPtr_t qRandPt, double step, bool descent );
82 
86  void runDeformation( int nbIteration , int idRun=0 );
87 
88 
89  protected:
90 
94  confPtr_t cheat();
95 
100  void debugShowTraj(double lPrev,double lNext, confPtr_t qNew , int color);
101 
108  std::vector<confPtr_t> get3RandSuccesConfAlongTraj(
109  double& prevDistPt,
110  double& randDistPt,
111  double& nextDistPt,
112  double step);
113 
118  std::vector<confPtr_t> getClosestConfOnTraj(
119  double& prevDistPt,
120  double& randDistPt,
121  double& nextDistPt,
122  confPtr_t ptrConf,
123  double step);
124 
125 
126  private:
127 
128  bool m_cheat;
129  double m_mincost;
130  unsigned int m_nbErrors;
131  std::vector<double> m_Errors;
132  bool m_DeformBiased;
133  bool m_inCollision;
134  bool m_descent;
135  int m_shortcutRatio;
136 
137  // bool oneLoopShortCut(double step);
138  };
139 }
140 
141 #endif /* COST_OPTIMIZATION_HPP_ */
bool connectConfiguration(confPtr_t q, double step)
Adds a configuration to the trajectory by starting from the end of the trajectory.
Definition: costOptimization.cpp:749
static double getLastDescendingConfParam(LocalPath &directionPath)
Stops at the last descending configuration on the cost map.
Definition: costOptimization.cpp:446
confPtr_t cheat()
Cheat for Justin.
Definition: costOptimization.cpp:491
double getMinCost()
Get the minimal cost.
Definition: costOptimization.hpp:51
void debugShowTraj(double lPrev, double lNext, confPtr_t qNew, int color)
Create new trajectories to show in debug mode also calls the g3d_draw function to plot in the OpenGl ...
Definition: costOptimization.cpp:528
void setCheat()
Set the cheat.
Definition: costOptimization.hpp:46
Definition: costOptimization.hpp:20
Classe représentant un chemin local.
Definition: localpath.hpp:15
bool oneLoopDeformRecompute()
One loop of the deformation strategy with recomputing of the trajectory portion cost as it might chan...
Definition: costOptimization.cpp:253
Definition: smoothing.hpp:23
This class holds a the robot represented by a kinematic chain.
Definition: robot.hpp:42
std::vector< confPtr_t > getClosestConfOnTraj(double &prevDistPt, double &randDistPt, double &nextDistPt, confPtr_t ptrConf, double step)
Returns the 3 configurations that are the closest to the input configuration.
Definition: costOptimization.cpp:630
bool oneLoopDeform()
One loop of the deformation strategy.
Definition: costOptimization.cpp:71
void runDeformation(int nbIteration, int idRun=0)
This is the main function to deform a trajectory it iterativly modifies the current trajectory...
Definition: costOptimization.cpp:792
Definition: trajectory.hpp:40
void printDebugInfo()
Prints debug information.
Definition: costOptimization.cpp:600
std::vector< confPtr_t > get3RandSuccesConfAlongTraj(double &prevDistPt, double &randDistPt, double &nextDistPt, double step)
Returns 3 random configurations along the trajtectory.
Definition: costOptimization.cpp:725
static confPtr_t perturbCurrent(confPtr_t qCurrPt, confPtr_t qRandPt, double step, bool descent)
Expand the configuration to a ne.
Definition: costOptimization.cpp:415
bool deformInCollision()
Returns true if the new trajectory is in collision.
Definition: costOptimization.hpp:41
CostOptimization()
Constructors and Destructors of the class.
Definition: costOptimization.cpp:38