Simox  2.3.74.0
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)
 
 ~ShortcutProcessor () override
 
CSpacePathPtr optimize (int optimizeSteps) override
 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

◆ ShortcutProcessor()

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

◆ ~ShortcutProcessor()

Saba::ShortcutProcessor::~ShortcutProcessor ( )
overridedefault

Member Function Documentation

◆ doPathPruning()

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.

◆ doShortcut()

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

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

Returns
Number of saved points.

◆ initSolution()

bool Saba::ShortcutProcessor::initSolution ( )
protected

◆ optimize()

CSpacePathPtr Saba::ShortcutProcessor::optimize ( int  optimizeSteps)
overridevirtual

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

Implements Saba::PathProcessor.

◆ selectCandidatesRandom()

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.

◆ shortenSolutionRandom()

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.

◆ tryRandomShortcut()

int Saba::ShortcutProcessor::tryRandomShortcut ( int  maxSolutionPathDist)
protected

◆ validShortcut()

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

◆ cspace

CSpaceSampledPtr Saba::ShortcutProcessor::cspace
protected