Parasol Planning Library (PPL)
|
#include <ClearanceUtilities.h>
Public Types | |
Motion Planning Types | |
typedef MPBaseObject::WeightType | WeightType |
typedef MPBaseObject::RoadmapType | RoadmapType |
typedef RoadmapType::VID | VID |
Public Types inherited from MPBaseObject | |
typedef DefaultWeight< Cfg > | WeightType |
typedef GenericStateGraph< Cfg, WeightType > | RoadmapType |
typedef GroupCfg< RoadmapType > | GroupCfgType |
typedef GroupLocalPlan< RoadmapType > | GroupWeightType |
typedef GroupRoadmap< GroupCfgType, GroupWeightType > | GroupRoadmapType |
Public Member Functions | |
Construction | |
ClearanceUtility (string _vcLabel="", string _dmLabel="", bool _exactClearance=false, bool _exactPenetration=false, size_t _clearanceRays=10, size_t _penetrationRays=10, double _approxStepSize=MAX_DBL, double _approxResolution=MAX_DBL, bool _useBBX=true, bool _positionalDofsOnly=true, bool _debug=false) | |
ClearanceUtility (XMLNode &_node) | |
virtual | ~ClearanceUtility ()=default |
MPBaseObject Overrides | |
virtual void | Print (ostream &_os) const override |
virtual void | Initialize () override |
Accessors | |
const string & | GetDistanceMetricLabel () const |
const string & | GetValidityCheckerLabel () const |
void | SetValidityCheckerLabel (const string &_s) |
bool | GetExactClearance () const |
double | GetPositionResolution () const |
double | GetOrientationResolution () const |
bool | IsInitialized () const |
Clearance Functions | |
bool | CollisionInfo (Cfg &_cfg, Cfg &_clrCfg, const Boundary *const _b, CDInfo &_cdInfo, const bool &_useOppValidityWitness=true) |
bool | ExactCollisionInfo (Cfg &_cfg, Cfg &_clrCfg, const Boundary *const _b, CDInfo &_cdInfo, const bool _useOppValidityWitness=true) |
bool | ApproxCollisionInfo (Cfg &_cfg, Cfg &_clrCfg, const Boundary *const _b, CDInfo &_cdInfo, const bool &_useOppValidityWitness=true) |
bool | FindApproximateWitness (const std::size_t &_numRays, std::vector< Ray< Cfg > > &_rays, const Cfg &_sampledCfg, const bool &_initValidity, const Boundary *const _b, std::pair< size_t, Cfg > &_candidate, const bool &_useOppValidityWitness=true) |
void | MakeRays (const Cfg &_sampledCfg, const std::size_t &_numRays, std::vector< Ray< Cfg > > &_rays) |
bool | ValidateCandidate (const std::pair< size_t, Cfg > &_cand, const std::vector< Ray< Cfg > > &_rays, const Boundary *const _b, const bool &_useOppValidityWitness=true) |
ClearanceStats | RoadmapClearance () |
ClearanceStats | PathClearance (vector< VID > &_path) |
ClearanceStats | PathClearance (vector< Cfg > &_path) |
vector< double > | EdgeClearance (const Cfg &_c1, const Cfg &_c2, const WeightType &_weight) |
const bool | GetNearestVertexWitness (Cfg &_cfg, CDInfo &_cdInfo, const Boundary *const _b) |
void | SetRobot (Robot *_robot) |
Public Member Functions inherited from MPBaseObject | |
MPBaseObject (const std::string &_label="", const std::string &_name="", bool _debug=false) | |
MPBaseObject (XMLNode &_node) | |
virtual | ~MPBaseObject () |
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... | |
MPLibrary * | GetMPLibrary () const noexcept |
Get the owning MPLibrary. More... | |
bool | IsRunning () const noexcept |
Check the library's running flag. More... | |
MPProblem * | GetMPProblem () const noexcept |
Get the library's current MPProblem. More... | |
Environment * | GetEnvironment () const noexcept |
Get the current environment. More... | |
MPTask * | GetTask () const noexcept |
Get the current task. More... | |
GroupTask * | GetGroupTask () const noexcept |
Get the current group task. More... | |
MPSolutionType * | GetMPSolution () const noexcept |
RoadmapType * | GetRoadmap (Robot *const _r=nullptr) const noexcept |
Get the current free-space roadmap. More... | |
GroupRoadmapType * | GetGroupRoadmap (RobotGroup *const _g=nullptr) const noexcept |
Get the current free-space group roadmap. More... | |
RoadmapType * | GetBlockRoadmap (Robot *const _r=nullptr) const noexcept |
Get the current obstacle-space roadmap. More... | |
Path * | GetPath (Robot *const _r=nullptr) const noexcept |
GroupPath * | GetGroupPath (RobotGroup *const _g=nullptr) const noexcept |
Get the current best group path. More... | |
StatClass * | GetStatClass () const noexcept |
Get the current StatClass. More... | |
LocalObstacleMap * | GetLocalObstacleMap () const noexcept |
Get the local obstacle map. More... | |
Protected Member Functions | |
bool | AdjustWitnessToEnsureValidity (const Cfg &_cfg, const bool _initValidity, Cfg &_witnessCfg, const Boundary *const _b, const bool _useOppValidityWitness=true) |
Protected Member Functions inherited from MPBaseObject | |
void | SetName (const std::string &_s) |
const std::string & | GetBaseFilename () const |
Protected Attributes | |
int | abcd = 0 |
Internal State | |
string | m_vcLabel {"cd4"} |
Validity checker method label. More... | |
string | m_dmLabel {"euclidean"} |
Distance metric method label. More... | |
bool | m_useBBX {true} |
Use bounding box as obstacle? More... | |
bool | m_positionalDofsOnly {true} |
Use only positional dofs? More... | |
bool | m_exactClearance {false} |
Use exact clearance calculations? More... | |
bool | m_exactPenetration {false} |
Use exact penetration calculations? More... | |
size_t | m_clearanceRays {10} |
Number of rays for approximate clearance. More... | |
size_t | m_penetrationRays {10} |
Number of rays for approximate penetration. More... | |
double | m_rayTickResolution |
The resolution for rayTicks. More... | |
double | m_orientationResolution |
The orientation resolution. More... | |
double | m_maxRayMagnitude |
How far out a ray will be attempted. More... | |
size_t | m_maxRayIterations |
The maximum number of ray iterations. More... | |
double | m_orientationResFactor {1.} |
The orientation resolution factor. More... | |
double | m_positionalResFactor {1.} |
The position resoluiton factor. More... | |
double | m_maSearchResolutionFactor {1} |
The search resolution factor. More... | |
bool | m_initialized {false} |
Robot * | m_robot |
Protected Attributes inherited from MPBaseObject | |
bool | m_debug |
Print debug info? More... | |
Computes clearance and penetration of configurations with respect to obstacles.
ClearanceUtility::ClearanceUtility | ( | string | _vcLabel = "" , |
string | _dmLabel = "" , |
||
bool | _exactClearance = false , |
||
bool | _exactPenetration = false , |
||
size_t | _clearanceRays = 10 , |
||
size_t | _penetrationRays = 10 , |
||
double | _approxStepSize = MAX_DBL , |
||
double | _approxResolution = MAX_DBL , |
||
bool | _useBBX = true , |
||
bool | _positionalDofsOnly = true , |
||
bool | _debug = false |
||
) |
Construct a ClearanceUtility object
_vcLabel | The validity checker to use. |
_dmLabel | The distance metric to use. |
_exactClearance | Use exact clearance or not. |
_exactPenetration | Use exact penetration or not. |
_clearanceRays | The number of clearance rays to use. |
_penetrationRays | The number of penetration rays to use. |
_approxStepSize | The approximate step size to use. |
_approxResolution | The approximate resolution to use. |
_useBBX | Use BBX or not. |
_positionalDofsOnly | Use only positional DOFs. |
_debug | Set to debug mode or not. |
ClearanceUtility::ClearanceUtility | ( | XMLNode & | _node | ) |
Construct a ClearanceUtility object from an XML node
_node | The XML node to use |
|
virtualdefault |
|
protected |
Adjusts a witness from a nearby witness point to a point of guaranteed validity, based on _initValidity and _useOppValidityWitness. this is a helper function called by ExactCollisionInfo.
_cfg | The sampled configuration to we wish to push |
_initValidity | The initial validity of _cfg |
_witnessCfg | The candidiate witness configuration |
_b | The boundary to use |
_useOppValidityWitness | Whether _cfg and _witness should be the the same validity or not |
bool ClearanceUtility::ApproxCollisionInfo | ( | Cfg & | _cfg, |
Cfg & | _clrCfg, | ||
const Boundary *const | _b, | ||
CDInfo & | _cdInfo, | ||
const bool & | _useOppValidityWitness = true |
||
) |
Calculate the approximate clearance using a series of rays. The specified number of rays are pushed outward until they change in validity. The shortest ray is stored as the witness.
_cfg | The configuration to push |
_clrCfg | Place holder for the clearance configuration |
_b | The boundary |
_cdInfo | Collision detector information reference |
_useOppValidityWitness | Whether the witness should be of opposite validity to _cfg. |
bool ClearanceUtility::CollisionInfo | ( | Cfg & | _cfg, |
Cfg & | _clrCfg, | ||
const Boundary *const | _b, | ||
CDInfo & | _cdInfo, | ||
const bool & | _useOppValidityWitness = true |
||
) |
Calculate clearance information as well as the closest witness approximately or exactly.
_cfg | The configuration to push |
_clrCfg | Place holder for the clearance configuration |
_b | The boundary |
_cdInfo | Collision detector information reference |
_useOppValidityWitness | Whether the witness should be of opposite validity to _cfg. |
std::vector< double > ClearanceUtility::EdgeClearance | ( | const Cfg & | _c1, |
const Cfg & | _c2, | ||
const WeightType & | _weight | ||
) |
Calculate path clearance statistics including averages, mins, and maxes for clearance across the edge
_c1 | The source vertex. |
_c2 | The target vertex. |
_weight | The weight of the edge. |
bool ClearanceUtility::ExactCollisionInfo | ( | Cfg & | _cfg, |
Cfg & | _clrCfg, | ||
const Boundary *const | _b, | ||
CDInfo & | _cdInfo, | ||
const bool | _useOppValidityWitness = true |
||
) |
Calculate clearance information exactly by taking the validity checker results against obstacles to the bounding box.
_cfg | The configuration to push |
_clrCfg | Place holder for the clearance configuration |
_b | The boundary |
_cdInfo | Collision detector information reference |
_useOppValidityWitness | Whether the witness should be of opposite validity to _cfg. |
bool ClearanceUtility::FindApproximateWitness | ( | const std::size_t & | _numRays, |
std::vector< Ray< Cfg > > & | _rays, | ||
const Cfg & | _sampledCfg, | ||
const bool & | _initValidity, | ||
const Boundary *const | _b, | ||
std::pair< size_t, Cfg > & | _candidate, | ||
const bool & | _useOppValidityWitness = true |
||
) |
Helpers for ApproxCollisionInfo (should maybe be protected): Find the witness of an initial sample of any validity. A witness here is defined as the nearest point of obstacle boundary. @TODO Make the user have the option to have same or opposite validity for witnesses.
_numRays | The number of rays to search for the nearest witness |
_rays | The container for the rays, if empty will be populated |
_sampledCfg | The sampled configuration to eventually push |
_initValidity | The initial validity of the _sampledCfg |
_b | The boundary to use |
_candidate | Container for candidate witness : _candidate.first is the index of the candidate ray within _rays and _candidate.second is the candidate configuration. |
_useOppValidityWitness | Whether the witness should be of opposite validity to _sampledCfg |
|
inline |
Get the label of the distance metric
|
inline |
Get whether exact clearance is used or not
const bool ClearanceUtility::GetNearestVertexWitness | ( | Cfg & | _cfg, |
CDInfo & | _cdInfo, | ||
const Boundary *const | _b | ||
) |
This function places the nearest vertex of the environment and the corresponding robot vertex into _cdInfo. This function is only used by the exact version of collision info.
_cfg | The sampled configuration to push |
_cdInfo | The container for collision detection information. The nearest configuration of the environment (witness candidate) and the point on the robot which corresponds to this config will be stored in _cdInfo if successful. |
_b | The boundary to use |
|
inline |
Get the orientation resolution
|
inline |
Get the position resolution
|
inline |
Get the label of the validity checker
|
overridevirtual |
Initialize this object for the current MPProblem. This should reset any internal state of the algorithms so that they are ready for execution. It is also the place to initialize any state that depends on the current problem.
Reimplemented from MPBaseObject.
|
inline |
Get whether the object is initialized or not
void ClearanceUtility::MakeRays | ( | const Cfg & | _sampledCfg, |
const std::size_t & | _numRays, | ||
std::vector< Ray< Cfg > > & | _rays | ||
) |
Generates the rays for the witness finding. This is a helper function of FindApproximateWitness which will only be called if the _rays parameter passed into FindapproximateWitness is empty.
_sampledCfg | The sampled configuration we wish to push |
_numRays | The number of rays to search for the nearest witness |
_rays | The container for the rays generated. |
@TODO expand to 3D, and then to N dimensions for uniform distribution: there are only approximate algorithms to do this "fib lattices"
ClearanceStats ClearanceUtility::PathClearance | ( | vector< Cfg > & | _path | ) |
Calculate path clearance statistics including averages, mins, and maxes for clearance across the path
_path | The path to use. |
ClearanceStats ClearanceUtility::PathClearance | ( | vector< VID > & | _path | ) |
Calculate path clearance statistics including averages, mins, and maxes for clearance across the path
_path | The path to use. |
|
overridevirtual |
Print the internal state of this object
_os | The std::ostream to print to. |
Reimplemented from MPBaseObject.
Reimplemented in MedialAxisUtility.
ClearanceStats ClearanceUtility::RoadmapClearance | ( | ) |
Calculate roadmap clearance statistics including averages, mins, and maxes for clearance across roadmaps, paths, and edges.
void ClearanceUtility::SetRobot | ( | Robot * | _robot | ) |
|
inline |
Set the label of the validity checker
_s | The label of the validity checker to use. |
bool ClearanceUtility::ValidateCandidate | ( | const std::pair< size_t, Cfg > & | _cand, |
const std::vector< Ray< Cfg > > & | _rays, | ||
const Boundary *const | _b, | ||
const bool & | _useOppValidityWitness = true |
||
) |
A final sanity check to be performed on the witness candidate. Compares the candidate cfg with the "previous" ticked configuration. The appropriate direction of the tick is dependent on whether opposite validity is true or not.
_cand | The information for the candidate witness, has two parts. _cand.first is the index of the ray (within _rays) which lead to the candidate witness. _cand.second is the actual configuration of the candidate witness. |
_rays | The vector which stores all rays that were explored. |
_b | The boundary being used. |
useOppValidityWitness | Whether we are asserting that the witness should be of opposite validity to the sampled configuration. |
|
protected |
|
protected |
Number of rays for approximate clearance.
|
protected |
Distance metric method label.
|
protected |
Use exact clearance calculations?
|
protected |
Use exact penetration calculations?
|
protected |
A boolean to determine whether initialize has been called on the utility or not yet. This is important, as there are MPLibrary things we need that are not available at construction time:
|
protected |
The search resolution factor.
|
protected |
The maximum number of ray iterations.
|
protected |
How far out a ray will be attempted.
|
protected |
The orientation resolution factor.
|
protected |
The orientation resolution.
|
protected |
Number of rays for approximate penetration.
|
protected |
Use only positional dofs?
|
protected |
The position resoluiton factor.
|
protected |
The resolution for rayTicks.
|
protected |
|
protected |
Use bounding box as obstacle?
|
protected |
Validity checker method label.