RobWorkProject
21.8.23

The DistanceCalculator implements an efficient way of calculating different distances between two objects, each represented by a frame. More...
#include <DistanceCalculator.hpp>
Public Types  
typedef rw::core::Ptr< DistanceCalculator >  Ptr 
smart pointer type to this class  
typedef rw::core::Ptr< const DistanceCalculator >  CPtr 
smart pointer type to this const class  
Public Member Functions  
DistanceCalculator (rw::kinematics::Frame *root, rw::core::Ptr< rw::models::WorkCell > workcell, rw::core::Ptr< rw::proximity::DistanceStrategy > strategy, const rw::kinematics::State &initial_state)  
Distance calculations for a given tree, collision setup and primitive distance calculator. Uses proximity strategy given by the workcell. More...  
DistanceCalculator (rw::core::Ptr< rw::models::WorkCell > workcell, rw::core::Ptr< rw::proximity::DistanceStrategy > strategy)  
Construct distance calculator for a WorkCell with an associated distance calculator strategy. More...  
DistanceCalculator (const kinematics::FramePairList &pairs, rw::core::Ptr< rw::proximity::DistanceStrategy > strategy)  
Constructs distance calculator for a selected set of frames. More...  
virtual  ~DistanceCalculator () 
Destructor.  
rw::proximity::DistanceStrategy::Result  distance (const kinematics::State &state, std::vector< rw::proximity::DistanceStrategy::Result > *result=0) const 
Calculates the distances between frames in the tree. More...  
rw::proximity::DistanceStrategy::Result  distanceOMP (const kinematics::State &state, std::vector< rw::proximity::DistanceStrategy::Result > *result=0) const 
rw::proximity::DistanceStrategy::Result  distance (const kinematics::State &state, const kinematics::Frame *frame, std::vector< rw::proximity::DistanceStrategy::Result > *result=0) const 
Calculates the distance between frame and the rest of the tree. More...  
void  setDistanceStrategy (rw::core::Ptr< rw::proximity::DistanceStrategy > strategy) 
Set the primitive distance calculator to strategy. More...  
bool  addDistanceModel (const rw::kinematics::Frame *frame, const rw::geometry::Geometry &faces) 
Adds distance model to frame. More...  
void  clearCache () 
Clears the cache of the distance models.  
double  getComputationTime () 
int  getCount () 
void  resetComputationTimeAndCount () 
The DistanceCalculator implements an efficient way of calculating different distances between two objects, each represented by a frame.
A list of frame pairs is contained within the distance calculater, that specifies which frames are to be checked against each other. The method of used for distance calculation relies on the DistanceStrategy chosen.
The DistanceCalculator supports switching between multiple strategies
DistanceCalculator  (  rw::kinematics::Frame *  root, 
rw::core::Ptr< rw::models::WorkCell >  workcell,  
rw::core::Ptr< rw::proximity::DistanceStrategy >  strategy,  
const rw::kinematics::State &  initial_state  
) 
Distance calculations for a given tree, collision setup and primitive distance calculator. Uses proximity strategy given by the workcell.
strategy must be nonNULL.
root must be nonNULL.
Ownership of root is not taken.
root  [in]  the root of the Frame tree. 
workcell  [in]  the workcell to do the distance calculations in. 
strategy  [in]  the primitive strategy of distance calculations. 
initial_state  [in]  the work cell state to use for the initial traversal of the tree. 
DistanceCalculator  (  rw::core::Ptr< rw::models::WorkCell >  workcell, 
rw::core::Ptr< rw::proximity::DistanceStrategy >  strategy  
) 
Construct distance calculator for a WorkCell with an associated distance calculator strategy.
The DistanceCalculator extracts information about the tree and the CollisionSetup from workcell.
workcell  [in] the workcell to check 
strategy  [in] the distance calculation strategy to use 
DistanceCalculator  (  const kinematics::FramePairList &  pairs, 
rw::core::Ptr< rw::proximity::DistanceStrategy >  strategy  
) 
Constructs distance calculator for a selected set of frames.
The list pairs specifies which framepairs to be used for distance checking.
strategy must be nonNULL.
Ownership of root is not taken.
pairs  [in] Pairs of frame to check 
strategy  [in] the distance calculation strategy to use 
bool addDistanceModel  (  const rw::kinematics::Frame *  frame, 
const rw::geometry::Geometry &  faces  
) 
Adds distance model to frame.
The distance model is constructed based on the list of faces given.
frame  [in] frame to which the distance model should associate 
faces  [in] list of faces from which to construct the model 
rw::proximity::DistanceStrategy::Result distance  (  const kinematics::State &  state, 
const kinematics::Frame *  frame,  
std::vector< rw::proximity::DistanceStrategy::Result > *  result = 0 

)  const 
Calculates the distance between frame and the rest of the tree.
state  [in] The state for which to calculate distances. 
frame  [in] The frame for which distances are to be calculated 
result  [out] If nonNULL, the distance results are written to result. 
rw::proximity::DistanceStrategy::Result distance  (  const kinematics::State &  state, 
std::vector< rw::proximity::DistanceStrategy::Result > *  result = 0 

)  const 
Calculates the distances between frames in the tree.
state  [in] The state for which to calculate distances. 
result  [out] If nonNULL, the distance results are written to result. 
void setDistanceStrategy  (  rw::core::Ptr< rw::proximity::DistanceStrategy >  strategy  ) 
Set the primitive distance calculator to strategy.
strategy must be nonNULL.
Ownership of the strategy is not taken.
strategy  [in]  the primitive distance calculator to use. 