Simox  2.3.49
Saba::ShortcutProcessor Class Reference

The ShortcutProcessor searches shortcuts in C-Space to produce smooth trajectories. More...

Inheritance diagram for Saba::ShortcutProcessor:
Saba::PathProcessor

Public Member Functions

 ShortcutProcessor (CSpacePathPtr path, CSpaceSampledPtr cspace, bool verbose=false)
 
virtual ~ShortcutProcessor ()
 
virtual CSpacePathPtr optimize (int optimizeSteps)
 A wrapper to the standard interface. Calls shortenSolutionRandom(). More...
 
CSpacePathPtr shortenSolutionRandom (int shortenLoops=300, int maxSolutionPathDist=30)
 
void doPathPruning ()
 
bool selectCandidatesRandom (int &storeStartIndex, int &storeEndIndex, int maxSolutionPathDist=30)
 
bool validShortcut (int startIndex, int endIndex)
 
int doShortcut (int startIndex, int endIndex)
 
- Public Member Functions inherited from Saba::PathProcessor
 PathProcessor (CSpacePathPtr p, bool verbose=false)
 
virtual ~PathProcessor ()
 
virtual void stopExecution ()
 Stop the execution from outside. More...
 
CSpacePathPtr getOptimizedPath ()
 

Protected Member Functions

bool initSolution ()
 
int tryRandomShortcut (int maxSolutionPathDist)
 

Protected Attributes

CSpaceSampledPtr cspace
 
- Protected Attributes inherited from Saba::PathProcessor
CSpacePathPtr optimizedPath
 
CSpacePathPtr path
 
unsigned int dim
 
bool verbose
 
bool stopOptimization
 

Detailed Description

The ShortcutProcessor searches shortcuts in C-Space to produce smooth trajectories.

Constructor & Destructor Documentation

Saba::ShortcutProcessor::ShortcutProcessor ( CSpacePathPtr  path,
CSpaceSampledPtr  cspace,
bool  verbose = false 
)
Saba::ShortcutProcessor::~ShortcutProcessor ( )
virtual

Member Function Documentation

void Saba::ShortcutProcessor::doPathPruning ( )

Goes through path and checks if direct shortcut between node before to node behind current node is collision free. Has to be called multiple times in order to get a good result. Slow method, shortenSolutionRandom() gets similar results but is much faster.

int Saba::ShortcutProcessor::doShortcut ( int  startIndex,
int  endIndex 
)

Erase all intermediate points and add a straight line shortcut instead.

Returns
Number of saved points.
bool Saba::ShortcutProcessor::initSolution ( )
protected
CSpacePathPtr Saba::ShortcutProcessor::optimize ( int  optimizeSteps)
virtual

A wrapper to the standard interface. Calls shortenSolutionRandom().

Implements Saba::PathProcessor.

bool Saba::ShortcutProcessor::selectCandidatesRandom ( int &  storeStartIndex,
int &  storeEndIndex,
int  maxSolutionPathDist = 30 
)

This method randomly choses a start and endpoint. The linear path between can be checked for validity in order to check for a shortcut.

CSpacePathPtr Saba::ShortcutProcessor::shortenSolutionRandom ( int  shortenLoops = 300,
int  maxSolutionPathDist = 30 
)

Creates a shortened CSpace path.

Parameters
shortenLoopsCalls tryRandomShort() shortenLoops times
maxSolutionPathDistThe max solution path dist.
Returns
The local instance of the optimized solution.
int Saba::ShortcutProcessor::tryRandomShortcut ( int  maxSolutionPathDist)
protected
bool Saba::ShortcutProcessor::validShortcut ( int  startIndex,
int  endIndex 
)

Checks linear path between start and end index. Therefore the cspace is queried.

Returns
If true is returned the shortcut is valid.

Field Documentation

CSpaceSampledPtr Saba::ShortcutProcessor::cspace
protected