RobWorkProject  23.9.11-
Public Types | Public Member Functions | List of all members
DistanceCalculator Class Reference

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< DistanceCalculatorPtr
 smart pointer type to this class
 
typedef rw::core::Ptr< const DistanceCalculatorCPtr
 smart pointer type to this const class
 

Public Member Functions

 DistanceCalculator (rw::core::Ptr< 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 rw::core::Ptr< 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::core::Ptr< 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 ()
 

Detailed Description

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

Constructor & Destructor Documentation

◆ DistanceCalculator() [1/3]

Distance calculations for a given tree, collision setup and primitive distance calculator. Uses proximity strategy given by the workcell.

strategy must be non-NULL.

root must be non-NULL.

Ownership of root is not taken.

Parameters
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() [2/3]

Construct distance calculator for a WorkCell with an associated distance calculator strategy.

The DistanceCalculator extracts information about the tree and the CollisionSetup from workcell.

Parameters
workcell[in] the workcell to check
strategy[in] the distance calculation strategy to use

◆ DistanceCalculator() [3/3]

Constructs distance calculator for a selected set of frames.

The list pairs specifies which frame-pairs to be used for distance checking.

strategy must be non-NULL.

Ownership of root is not taken.

Parameters
pairs[in] Pairs of frame to check
strategy[in] the distance calculation strategy to use

Member Function Documentation

◆ addDistanceModel()

bool addDistanceModel ( const rw::core::Ptr< 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.

Parameters
frame[in] frame to which the distance model should associate
faces[in] list of faces from which to construct the model
Returns
true if a distance model was succesfully created and linked with the frame; false otherwise.

◆ distance() [1/2]

rw::proximity::DistanceStrategy::Result distance ( const kinematics::State state,
const rw::core::Ptr< kinematics::Frame frame,
std::vector< rw::proximity::DistanceStrategy::Result > *  result = 0 
) const

Calculates the distance between frame and the rest of the tree.

Parameters
state[in] The state for which to calculate distances.
frame[in] The frame for which distances are to be calculated
result[out] If non-NULL, the distance results are written to result.
Returns
the shortest distance between frame and frame tree

◆ distance() [2/2]

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.

Parameters
state[in] The state for which to calculate distances.
result[out] If non-NULL, the distance results are written to result.
Returns
the shortest distance between frame and frame tree

◆ setDistanceStrategy()

void setDistanceStrategy ( rw::core::Ptr< rw::proximity::DistanceStrategy strategy)

Set the primitive distance calculator to strategy.

strategy must be non-NULL.

Ownership of the strategy is not taken.

Parameters
strategy[in] - the primitive distance calculator to use.

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