libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
API::CostOptimization Class Reference
Inheritance diagram for API::CostOptimization:
API::Smoothing API::Trajectory

Public Member Functions

 CostOptimization ()
 Constructors and Destructors of the class.
 
 CostOptimization (const Trajectory &T)
 
 CostOptimization (Robot *R, p3d_traj *t)
 
void printDebugInfo ()
 Prints debug information.
 
bool deformInCollision ()
 Returns true if the new trajectory is in collision.
 
void setCheat ()
 Set the cheat.
 
double getMinCost ()
 Get the minimal cost.
 
bool oneLoopDeform ()
 One loop of the deformation strategy. More...
 
bool oneLoopDeformRecompute ()
 One loop of the deformation strategy with recomputing of the trajectory portion cost as it might change. More...
 
bool connectConfiguration (confPtr_t q, double step)
 Adds a configuration to the trajectory by starting from the end of the trajectory. More...
 
void runDeformation (int nbIteration, int idRun=0)
 This is the main function to deform a trajectory it iterativly modifies the current trajectory, with random perturbations this function consisiton of n deformation rounds which sample a configuration to create a deviation from the initial path, check its cost and keep the best trajectory out of the current and newly created trajectory. More...
 
- Public Member Functions inherited from API::Smoothing
 Smoothing ()
 Class constructors and destructors.
 
 Smoothing (const Trajectory &T)
 
 Smoothing (Robot *R, traj *t)
 
int getRunId ()
 Get the run Id.
 
void setRunId (int id)
 Set the run Id.
 
void setStep (double step)
 Set a fixed deformation step.
 
void resetStep ()
 Use automatic step computation.
 
double getTime ()
 Get the time spent in optimization.
 
int getIteration ()
 Get iteration.
 
void setContextName (std::string name)
 Set Context name.
 
void saveOptimToFile (std::string str)
 Save the optimization to a file. More...
 
void removeRedundantNodes ()
 Go through all nodes in a deterministic manner.
 
void setSortedIndex ()
 Set the sorted indexes by cost.
 
confPtr_t getRandConfAlongTraj (double &randDist, bool use_bias)
 Get a random confiruation along the trajectroy that can be biased.
 
bool oneLoopShortCut ()
 One loop of the random shortcut. More...
 
bool oneLoopShortCutRecompute ()
 One loop of the random shortcut with recomputation of the trajectory cost. More...
 
void runShortCut (int nbIteration, int idRun=0)
 Runs the shortcut method for a certain number of iterations. More...
 
int removeUselessNodes ()
 Deterministic shortcut.
 
- Public Member Functions inherited from API::Trajectory
 Trajectory (Robot *R)
 
 Trajectory (Robot *R, traj *t)
 
 Trajectory (std::vector< confPtr_t > &C)
 
 Trajectory (const Trajectory &T)
 
Trajectoryoperator= (const Trajectory &t)
 
bool operator== (const Trajectory &t) const
 
bool operator!= (const Trajectory &t) const
 
void copyPaths (std::vector< LocalPath * > &vect)
 
std::vector
< std::tr1::shared_ptr
< Configuration > > 
getTowConfigurationAtParam (double param1, double param2, uint &lp1, uint &lp2)
 
std::pair< bool, std::vector
< LocalPath * > > 
extractSubPortion (double param1, double param2, unsigned int &first, unsigned int &last, bool check_for_coll=true)
 
Trajectory extractSubTrajectoryOfLocalPaths (unsigned int id_start, unsigned int id_end)
 Extract sub trajectory. More...
 
Trajectory extractSubTrajectory (double param1, double param2, bool check_for_coll=true)
 
bool concat (const Trajectory &traj)
 
bool replacePortionOfLocalPaths (unsigned int id1, unsigned int id2, std::vector< LocalPath * > paths, bool freeMemory=true)
 
bool replacePortion (double param1, double param2, std::vector< LocalPath * > paths, bool freeMemory=true)
 
bool replaceBegin (double param, const std::vector< LocalPath * > &paths)
 
bool replaceEnd (double param, const std::vector< LocalPath * > &paths)
 
bool cutTrajInSmallLP (unsigned int nLP)
 
bool cutTrajInSmallLPSimple (unsigned int nLP)
 
uint cutPortionInSmallLP (std::vector< LocalPath * > &portion, uint nLP)
 
void push_back (confPtr_t q)
 
bool push_back (std::tr1::shared_ptr< LocalPath > path)
 
double collisionCost ()
 
std::vector< std::pair< double,
double > > 
getCostProfile ()
 
double computeSubPortionIntergralCost (std::vector< LocalPath * > &portion)
 
double computeSubPortionCost (std::vector< LocalPath * > &portion)
 
double computeSubPortionCost (std::vector< LocalPath * >::iterator first, std::vector< LocalPath * >::iterator last)
 
double computeSubPortionMaxCost (std::vector< LocalPath * > &portion)
 
double ReComputeSubPortionCost (std::vector< LocalPath * > &portion, int &nb_cost_tests)
 
double computeSubPortionCostVisib (std::vector< LocalPath * > &portion)
 
double costOfPortion (double param1, double param2)
 
double extractCostPortion (double param1, double param2)
 
double cost ()
 
double computeCostComplete ()
 
double costComplete ()
 
double costNoRecompute ()
 
double costRecomputed ()
 
double costStatistics (TrajectoryStatistics &stat)
 
double costDeltaAlongTraj ()
 
double costNPoints (const int n_points)
 
double costSum ()
 
std::vector< double > getCostAlongTrajectory (int nbSample)
 
void resetCostComputed ()
 
bool isEmpty ()
 
void clear ()
 
confPtr_t operator[] (const int &i) const
 
confPtr_t configAtParam (double param, unsigned int *id_localpath=NULL) const
 
double paramAtConfig (confPtr_t config, double step=-1) const
 
LocalPathgetLocalPathPtrOf (confPtr_t conf) const
 
double distanceToTraj (confPtr_t config, double step=-1)
 
std::vector< confPtr_t > getNConfAtParam (double delta)
 
std::vector< confPtr_t > getVectorOfConfiguration ()
 
uint getIdOfPathAt (double param)
 
LocalPathgetLocalPathPtrAt (unsigned int id) const
 
int getNbOfPaths () const
 
int getNbOfViaPoints () const
 
bool isValid ()
 
void resetIsValid ()
 
void updateRange ()
 
double computeSubPortionRange (const std::vector< LocalPath * > &portion) const
 
bool replaceP3dTraj ()
 
p3d_traj * replaceP3dTraj (p3d_traj *trajPt)
 
p3d_traj * replaceHumanP3dTraj (Robot *rob, p3d_traj *trajPt)
 
void printAllLocalpathCost ()
 
void draw (int nbKeyFrame)
 
void print ()
 
int meanCollTest ()
 
bool makeBSplineTrajectory ()
 
void setColor (int col)
 
unsigned int getHighestCostId () const
 
RobotgetRobot () const
 
int size () const
 
confPtr_t getBegin () const
 
confPtr_t getEnd () const
 
std::vector< LocalPath * > getCourbe () const
 
std::vector< LocalPath * > & getCourbe ()
 
double getRangeMax () const
 

Static Public Member Functions

static double getLastDescendingConfParam (LocalPath &directionPath)
 Stops at the last descending configuration on the cost map. More...
 
static confPtr_t perturbCurrent (confPtr_t qCurrPt, confPtr_t qRandPt, double step, bool descent)
 Expand the configuration to a ne. More...
 

Protected Member Functions

confPtr_t cheat ()
 Cheat for Justin. More...
 
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 display.
 
std::vector< confPtr_t > get3RandSuccesConfAlongTraj (double &prevDistPt, double &randDistPt, double &nextDistPt, double step)
 Returns 3 random configurations along the trajtectory. More...
 
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. More...
 
- Protected Member Functions inherited from API::Smoothing
bool checkStopConditions (unsigned int iter)
 stops the trajectory optimization More...
 
std::vector< confPtr_t > get2RandomConf (double step, double &secondDist, double &firstDist)
 gets randomly two random configurations
 
std::vector< confPtr_t > getConfAtStepAlongTraj (double step, double firstDist, double secondDist)
 gets randomly n configurations on the traj between firstDist and secondDist
 
bool partialShortcut ()
 PatialShortCut : intependently shortcut each DoFs. More...
 
bool isLowerCostLargePortion (double lFirst, double lSecond, std::vector< LocalPath * > &paths)
 Compute the subportion of with entire outer localpaths. More...
 
double interpolateOneDoF (unsigned int ithActiveDoF, double init, double goal, double alpha)
 Interpolates a Configuration. More...
 
void changeIthActiveDofValueOnConf (Configuration &q, unsigned int ithActiveDoF, double value)
 Change the Ith Active Dof on Conf. More...
 
void debugShowTraj (double lPrev, double lNext)
 Show the trajectory while being deformed.
 
double getBiasedParamOnTraj ()
 Get a parameter on the trajectory which is biased to the high cost parts of the trajectory.
 
double closestResolutionToStep (double length, double step)
 Compute the resolution of a path. More...
 
double gainOfLastIterations (unsigned int n)
 Compute the gain of the last n succueded iterations. More...
 
void computeStats ()
 compute the stats
 
void storeCostAndGain (double NewCost, double CurCost)
 Store the cost and gain of the iteration in double vectors.
 

Additional Inherited Members

- Protected Attributes inherited from API::Smoothing
int m_runId
 
std::string m_ContextName
 
std::vector< double > m_Selected
 
int m_nbBiased
 
int m_nbReallyBiased
 
double m_currentCost
 
double m_time
 
bool m_useAutoStep
 
double m_step
 
std::vector< std::pair< double,
std::vector< confPtr_t > > > 
m_convergence_trajs
 
std::vector< std::pair< double,
TrajectoryStatistics > > 
m_convergence_rate
 
std::vector< double > m_OptimCost
 
std::vector< double > m_GainCost
 
int m_Iteration
 
bool m_IterationSucceded
 
std::vector< double > m_GainOfIterations
 
unsigned int m_MaxNumberOfIterations
 
- Protected Attributes inherited from API::Trajectory
Robotm_Robot
 
unsigned int HighestCostId
 
bool isHighestCostIdSet
 

Member Function Documentation

shared_ptr< Configuration > CostOptimization::cheat ( )
protected

Cheat for Justin.

Bias to one specific configuration.

bool CostOptimization::connectConfiguration ( confPtr_t  q,
double  step 
)

Adds a configuration to the trajectory by starting from the end of the trajectory.

Connects a configuration to the trajectory it starts at the end of the trajectory.

vector< confPtr_t > CostOptimization::get3RandSuccesConfAlongTraj ( double &  prevDistPt,
double &  randDistPt,
double &  nextDistPt,
double  step 
)
protected

Returns 3 random configurations along the trajtectory.

Gets 3 random configurations on the trajectory the selection is biased depending on an internal parameter The process is as follows, first a configuration is sampled (the one in the middle) then the two others are selected at a parameter prevDist, and nextDist away from the sampled configuration.

Parameters
thestep between the 3 configuration
Returns
vector of configuration
vector< confPtr_t > CostOptimization::getClosestConfOnTraj ( double &  prevDistPt,
double &  randDistPt,
double &  nextDistPt,
confPtr_t  ptrConf,
double  step 
)
protected

Returns the 3 configurations that are the closest to the input configuration.

Parameters
double CostOptimization::getLastDescendingConfParam ( LocalPath directionPath)
static

Stops at the last descending configuration on the cost map.

Compute descent on cost map.

bool CostOptimization::oneLoopDeform ( )

One loop of the deformation strategy.

Parameters
stepis the distance between 2 configurations
bool CostOptimization::oneLoopDeformRecompute ( )

One loop of the deformation strategy with recomputing of the trajectory portion cost as it might change.

Parameters
stepis the distance between 2 configurations
confPtr_t CostOptimization::perturbCurrent ( confPtr_t  qCurrPt,
confPtr_t  qRandPt,
double  step,
bool  descent 
)
static

Expand the configuration to a ne.

Perturb the current configuration Finds a conf between current and random that satifies the joint limits.

void CostOptimization::runDeformation ( int  nbIteration,
int  idRun = 0 
)

This is the main function to deform a trajectory it iterativly modifies the current trajectory, with random perturbations this function consisiton of n deformation rounds which sample a configuration to create a deviation from the initial path, check its cost and keep the best trajectory out of the current and newly created trajectory.

Parameters
nbIterationthe number of iteration to go for
idRunthe id of the run

The documentation for this class was generated from the following files: