Parasol Planning Library (PPL)
ObstacleBasedSampler Class Reference

Obstacle-based sampling. More...

#include <ObstacleBasedSampler.h>

Inheritance diagram for ObstacleBasedSampler:
Inheritance graph
[legend]
Collaboration diagram for ObstacleBasedSampler:
Collaboration graph
[legend]

Public Types

Motion Planning Types
typedef MPBaseObject::GroupCfgType GroupCfgType
 
typedef std::map< Robot *, const Boundary * > BoundaryMap
 
- Public Types inherited from SamplerMethod
typedef MPBaseObject::GroupCfgType GroupCfgType
 
typedef std::vector< Cfg >::iterator InputIterator
 
typedef std::back_insert_iterator< std::vector< Cfg > > OutputIterator
 
typedef std::vector< GroupCfgType >::iterator GroupInputIterator
 
typedef std::back_insert_iterator< std::vector< GroupCfgType > > GroupOutputIterator
 
typedef std::map< Robot *, const Boundary * > BoundaryMap
 A map from robots to sampling boundaries. More...
 
- Public Types inherited from MPBaseObject
typedef DefaultWeight< CfgWeightType
 
typedef GenericStateGraph< Cfg, WeightTypeRoadmapType
 
typedef GroupCfg< RoadmapTypeGroupCfgType
 
typedef GroupLocalPlan< RoadmapTypeGroupWeightType
 
typedef GroupRoadmap< GroupCfgType, GroupWeightTypeGroupRoadmapType
 

Public Member Functions

Construction
 ObstacleBasedSampler (string _vcLabel="", string _dmLabel="", int _free=1, int _coll=0, double _step=0, bool _useBBX=true, string _pointSelection="cspace")
 
 ObstacleBasedSampler (XMLNode &_node)
 
virtual ~ObstacleBasedSampler ()=default
 
MPBaseObject Overrides
virtual void Print (ostream &_os) const override
 
- Public Member Functions inherited from SamplerMethod
 SamplerMethod ()=default
 
 SamplerMethod (XMLNode &_node)
 
virtual ~SamplerMethod ()=0
 
virtual void Sample (size_t _numNodes, size_t _maxAttempts, const Boundary *const _boundary, OutputIterator _valid, OutputIterator _invalid)
 
virtual void Sample (size_t _numNodes, size_t _maxAttempts, const Boundary *const _boundary, OutputIterator _valid)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
virtual void Sample (size_t _numNodes, size_t _maxAttempts, const Boundary *const _robotBoundary, const Boundary *const _eeBoundary, OutputIterator _valid, OutputIterator _invalid)
 
virtual void Sample (size_t _numNodes, size_t _maxAttempts, const Boundary *const _robotBoundary, const Boundary *const _eeBoundary, OutputIterator _valid)
 
virtual void Filter (InputIterator _first, InputIterator _last, size_t _maxAttempts, const Boundary *const _boundary, OutputIterator _valid, OutputIterator _invalid)
 
void Filter (InputIterator _first, InputIterator _last, size_t _maxAttempts, const Boundary *const _boundary, OutputIterator _valid)
 
virtual void Sample (size_t _numNodes, size_t _maxAttempts, const Boundary *const _boundary, GroupOutputIterator _valid, GroupOutputIterator _invalid)
 
virtual void Sample (size_t _numNodes, size_t _maxAttempts, const Boundary *const _boundary, GroupOutputIterator _valid)
 
virtual void Sample (size_t _numNodes, size_t _maxAttempts, const BoundaryMap &_boundary, GroupOutputIterator _valid, GroupOutputIterator _invalid)
 
virtual void Sample (size_t _numNodes, size_t _maxAttempts, const BoundaryMap &_boundary, GroupOutputIterator _valid)
 
virtual void Filter (GroupInputIterator _first, GroupInputIterator _last, size_t _maxAttempts, const Boundary *const _boundary, GroupOutputIterator _valid, GroupOutputIterator _invalid)
 
void Filter (GroupInputIterator _first, GroupInputIterator _last, size_t _maxAttempts, const Boundary *const _boundary, GroupOutputIterator _valid)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
- Public Member Functions inherited from MPBaseObject
 MPBaseObject (const std::string &_label="", const std::string &_name="", bool _debug=false)
 
 MPBaseObject (XMLNode &_node)
 
virtual ~MPBaseObject ()
 
virtual void Initialize ()
 
const std::string & GetName () const
 Get the class name for this object. More...
 
const std::string & GetLabel () const
 Get the unique label for this object. More...
 
std::string GetNameAndLabel () const
 Get the unique string identifier for this object "m_name::m_label". More...
 
void SetLabel (const std::string &)
 Set the unique label for this object. More...
 
void SetMPLibrary (MPLibrary *) noexcept
 Set the owning MPLibrary. More...
 
MPLibraryGetMPLibrary () const noexcept
 Get the owning MPLibrary. More...
 
bool IsRunning () const noexcept
 Check the library's running flag. More...
 
MPProblemGetMPProblem () const noexcept
 Get the library's current MPProblem. More...
 
EnvironmentGetEnvironment () const noexcept
 Get the current environment. More...
 
MPTaskGetTask () const noexcept
 Get the current task. More...
 
GroupTaskGetGroupTask () const noexcept
 Get the current group task. More...
 
MPSolutionTypeGetMPSolution () const noexcept
 
RoadmapTypeGetRoadmap (Robot *const _r=nullptr) const noexcept
 Get the current free-space roadmap. More...
 
GroupRoadmapTypeGetGroupRoadmap (RobotGroup *const _g=nullptr) const noexcept
 Get the current free-space group roadmap. More...
 
RoadmapTypeGetBlockRoadmap (Robot *const _r=nullptr) const noexcept
 Get the current obstacle-space roadmap. More...
 
PathGetPath (Robot *const _r=nullptr) const noexcept
 
GroupPathGetGroupPath (RobotGroup *const _g=nullptr) const noexcept
 Get the current best group path. More...
 
StatClassGetStatClass () const noexcept
 Get the current StatClass. More...
 
LocalObstacleMapGetLocalObstacleMap () const noexcept
 Get the local obstacle map. More...
 

Protected Member Functions

Helpers
virtual bool Sampler (Cfg &_cfg, const Boundary *const _boundary, std::vector< Cfg > &_result, std::vector< Cfg > &_collision)
 
virtual bool Sampler (GroupCfgType &_cfg, const Boundary *const _boundary, std::vector< GroupCfgType > &_result, std::vector< GroupCfgType > &_invalid)
 
virtual bool Sampler (GroupCfgType &_cfg, const BoundaryMap &_boundaryMap, std::vector< GroupCfgType > &_result, std::vector< GroupCfgType > &_collision)
 
void GenerateShells (const Boundary *const _boundary, Cfg &_cFree, Cfg &_cColl, Cfg &_incr, std::vector< Cfg > &_result, std::vector< Cfg > &_collision)
 
void GenerateShells (const Boundary *const _boundary, GroupCfgType &_cFree, GroupCfgType &_cColl, GroupCfgType &_incr, std::vector< GroupCfgType > &_result, std::vector< GroupCfgType > &_collision)
 
void GenerateShells (const BoundaryMap &_boundaryMap, GroupCfgType &_cFree, GroupCfgType &_cColl, GroupCfgType &_incr, std::vector< GroupCfgType > &_result, std::vector< GroupCfgType > &_collision)
 
Cfg ChooseCenterOfMass (MultiBody *_mBody)
 
Cfg ChooseRandomVertex (MultiBody *_mBody)
 
Vector3d ChoosePointOnTriangle (Vector3d _p, Vector3d _q, Vector3d _r)
 
Cfg ChooseRandomWeightedTriangle (MultiBody *_mBody)
 
Cfg ChooseRandomTriangle (MultiBody *_mBody)
 
Cfg ChooseExtremeVertex (MultiBody *_mBody)
 
virtual Cfg ChooseASample (Cfg &_cfg)
 
virtual GroupCfgType ChooseASample (GroupCfgType &_cfg)
 
Cfg ChooseASampleOtherMethods ()
 
Cfg GetCfgWithParams (const Vector3d &_v)
 
bool GroupInBounds (GroupCfgType &_groupCfg, const BoundaryMap &_boundaryMap)
 
bool GroupInBounds (GroupCfgType &_groupCfg, const Boundary *const _boundary)
 
- Protected Member Functions inherited from SamplerMethod
virtual bool Sampler (Cfg &_cfg, const Boundary *const _robotBoundary, const Boundary *const _eeBoundary, std::vector< Cfg > &_valid, std::vector< Cfg > &_invalid)
 
- Protected Member Functions inherited from MPBaseObject
void SetName (const std::string &_s)
 
const std::string & GetBaseFilename () const
 

Additional Inherited Members

- Protected Attributes inherited from MPBaseObject
bool m_debug
 Print debug info? More...
 

Detailed Description

Obstacle-based sampling.

OBPRM samples by pushing random configurations along a random ray until they change validity, keeping the best free configuration.

Todo:
Implement GetCenterOfMass function in the ChooseCenterOfMass class

Member Typedef Documentation

◆ BoundaryMap

typedef std::map<Robot*, const Boundary*> ObstacleBasedSampler::BoundaryMap

◆ GroupCfgType

Constructor & Destructor Documentation

◆ ObstacleBasedSampler() [1/2]

ObstacleBasedSampler::ObstacleBasedSampler ( string  _vcLabel = "",
string  _dmLabel = "",
int  _free = 1,
int  _coll = 0,
double  _step = 0,
bool  _useBBX = true,
string  _pointSelection = "cspace" 
)

◆ ObstacleBasedSampler() [2/2]

ObstacleBasedSampler::ObstacleBasedSampler ( XMLNode _node)

◆ ~ObstacleBasedSampler()

virtual ObstacleBasedSampler::~ObstacleBasedSampler ( )
virtualdefault

Member Function Documentation

◆ ChooseASample() [1/2]

Cfg ObstacleBasedSampler::ChooseASample ( Cfg _cfg)
protectedvirtual

Checks m_pointSelection and returns an appropriate Cfg

Parameters
_cfgConfiguration of the sample
Returns
Configuration of the sample

◆ ChooseASample() [2/2]

ObstacleBasedSampler::GroupCfgType ObstacleBasedSampler::ChooseASample ( GroupCfgType _cfg)
protectedvirtual

Checks m_pointSelection and returns an appropriate GroupCfgType

Parameters
_cfgGroup configuration of the sample
Returns
Group configuration chosen from the Extreme Vertex method

◆ ChooseASampleOtherMethods()

Cfg ObstacleBasedSampler::ChooseASampleOtherMethods ( )
protected

Call the various sample method other than cspace method

Returns
Configuration obtained according to the m_pointSelection

◆ ChooseCenterOfMass()

Cfg ObstacleBasedSampler::ChooseCenterOfMass ( MultiBody _mBody)
protected

Returns a Cfg at the center of mass of the MultiBody

Parameters
_mBodyMultibody of the obstacle
Returns
Configuration corresponding to the center of mass of the Multibody

◆ ChooseExtremeVertex()

Cfg ObstacleBasedSampler::ChooseExtremeVertex ( MultiBody _mBody)
protected

Chooses a random extreme vertex of the MultiBody

Parameters
_mBodyMultibody of the obstacle
Returns
Configuration chosen from the Extreme Vertex method

◆ ChoosePointOnTriangle()

Vector3d ObstacleBasedSampler::ChoosePointOnTriangle ( Vector3d  _p,
Vector3d  _q,
Vector3d  _r 
)
protected

Returns a point inside the triangle determined by the vectors

Parameters
_pThe first 3d point of a triangle
_qThe second 3d point of a triangle
_rThe Third 3d point of a triangle
Returns
Configuration chosen from the Point On Triangle method

◆ ChooseRandomTriangle()

Cfg ObstacleBasedSampler::ChooseRandomTriangle ( MultiBody _mBody)
protected

Chooses a random point in a random triangle in the MultiBody

Parameters
_mBodyMultibody of the obstacle
Returns
Configuration chosen from the Random Triangle method

◆ ChooseRandomVertex()

Cfg ObstacleBasedSampler::ChooseRandomVertex ( MultiBody _mBody)
protected
Parameters
_mBodyMultibody of the obstacle
Returns
Configuration chosen from the Random Vertex method

◆ ChooseRandomWeightedTriangle()

Cfg ObstacleBasedSampler::ChooseRandomWeightedTriangle ( MultiBody _mBody)
protected

Chooses a random point on a random triangle (weighted by area) in the MultiBody

Parameters
_mBodyMultibody of the obstacle
Returns
Configuration chosen from the Random Weighted Triangle method

◆ GenerateShells() [1/3]

void ObstacleBasedSampler::GenerateShells ( const Boundary *const  _boundary,
Cfg _cFree,
Cfg _cColl,
Cfg _incr,
std::vector< Cfg > &  _result,
std::vector< Cfg > &  _collision 
)
protected

Generates and adds shells to their containers for a single robot in a single boundary case

Parameters
_boundaryBoundary of the environment
_cFreeThe configuration in the Free Configuration Space
_cCollThe configuration in the Collision Configuration Space
_incrThe amount of increments in the specified direction.
_resultA vector that stores Free Configuration Space
_collisionA vector that stores Collision Configuration Space

◆ GenerateShells() [2/3]

void ObstacleBasedSampler::GenerateShells ( const Boundary *const  _boundary,
GroupCfgType _cFree,
GroupCfgType _cColl,
GroupCfgType _incr,
std::vector< GroupCfgType > &  _result,
std::vector< GroupCfgType > &  _collision 
)
protected

Generates and adds shells to their containers for multiple robots in a single boundary case

Parameters
_boundaryBoundary of the environment
_cFreeThe configuration in the Free Configuration Space
_cCollThe configuration in the Collision Configuration Space
_incrThe amount of increments in the specified direction.
_resultA vector that stores Free Group Configuration Space
_collisionA vector that stores Collision Group Configuration Space

◆ GenerateShells() [3/3]

void ObstacleBasedSampler::GenerateShells ( const BoundaryMap _boundaryMap,
GroupCfgType _cFree,
GroupCfgType _cColl,
GroupCfgType _incr,
std::vector< GroupCfgType > &  _result,
std::vector< GroupCfgType > &  _collision 
)
protected

Generates and adds shells to their containers for multiple robots in each individual boundary case

Parameters
_boundaryBoundary of the environment
_cFreeThe configuration in the Free Configuration Space
_cCollThe configuration in the Collision Configuration Space
_incrThe amount of increments in the specified direction.
_resultA vector that stores Free Group Configuration Space
_collisionA vector that stores Collision Group Configuration Space

◆ GetCfgWithParams()

Cfg ObstacleBasedSampler::GetCfgWithParams ( const Vector3d &  _v)
protected

Returns a Cfg with the coordinates specified in the vector and no rotation

Parameters
_vMultibody of the obstacle
Returns
Configuration Type of the sample

◆ GroupInBounds() [1/2]

bool ObstacleBasedSampler::GroupInBounds ( GroupCfgType _groupCfg,
const Boundary *const  _boundary 
)
protected

Checks if the groupCfg is in the boundary map

Parameters
_groupCfgThe group configuration needs to be checked
_boundaryThe single boundary of every robots
Returns
true or false

◆ GroupInBounds() [2/2]

bool ObstacleBasedSampler::GroupInBounds ( GroupCfgType _groupCfg,
const BoundaryMap _boundaryMap 
)
protected

Checks if the groupCfg is in the boundary map

Parameters
_groupCfgThe group configuration needs to be checked
_boundaryMapThe map that pairs each robot and corresponding boundary
Returns
true or false

◆ Print()

void ObstacleBasedSampler::Print ( ostream &  _os) const
overridevirtual

Print internal state of this object.

Parameters
_osThe std::ostream to print to.

Reimplemented from MPBaseObject.

◆ Sampler() [1/3]

bool ObstacleBasedSampler::Sampler ( Cfg _cfg,
const Boundary *const  _boundary,
std::vector< Cfg > &  _result,
std::vector< Cfg > &  _collision 
)
protectedvirtual

Main Sampler Sampler for a single robot in a single boundary

Parameters
_cfgConfiguration Type
_boundaryBoundary of the environment
_resultA vector that stores Free Configuration Space
_collisionA vector that stores Collision Configuration Space
Returns
Success or Failure of sampling

Reimplemented from SamplerMethod.

◆ Sampler() [2/3]

bool ObstacleBasedSampler::Sampler ( GroupCfgType _cfg,
const Boundary *const  _boundary,
std::vector< GroupCfgType > &  _result,
std::vector< GroupCfgType > &  _invalid 
)
protectedvirtual

Sampler for multiple robots in a single boundary

Parameters
_cfgConfiguration Type
_boundaryBoundary of the environment
_resultA vector that stores Free Group Configuration Space
_collisionA vector that stores Collision Group Configuration Space
Returns
Success or Failure of sampling

Reimplemented from SamplerMethod.

◆ Sampler() [3/3]

bool ObstacleBasedSampler::Sampler ( GroupCfgType _cfg,
const BoundaryMap _boundaryMap,
std::vector< GroupCfgType > &  _result,
std::vector< GroupCfgType > &  _collision 
)
protectedvirtual

Sampler for multiple robots in each individual boundary

Parameters
_cfgConfiguration Type
_boundaryMapBoundaryMap of the environment
_resultA vector that stores Free Group Configuration Space
_collisionA vector that stores Collision Group Configuration Space
Returns
Success or Failure of sampling

Reimplemented from SamplerMethod.


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