moveit2
The MoveIt Motion Planning Framework for ROS 2.
Public Types | Public Member Functions | Protected Attributes | List of all members
cached_ik_kinematics_plugin::GreedyKCenters< _T > Class Template Reference

An instance of this class can be used to greedily select a given number of representatives from a set of data points that are all far apart from each other. More...

#include <GreedyKCenters.h>

Public Types

using DistanceFunction = std::function< double(const _T &, const _T &)>
 The definition of a distance function. More...
 
using Matrix = Eigen::MatrixXd
 A matrix type for storing distances between points and centers. More...
 

Public Member Functions

 GreedyKCenters ()=default
 
 GreedyKCenters (const GreedyKCenters &)=default
 
 GreedyKCenters (GreedyKCenters &&) noexcept=default
 
GreedyKCentersoperator= (const GreedyKCenters &)=default
 
GreedyKCentersoperator= (GreedyKCenters &&) noexcept=default
 
virtual ~GreedyKCenters ()=default
 
void setDistanceFunction (const DistanceFunction &distFun)
 Set the distance function to use. More...
 
const DistanceFunctiongetDistanceFunction () const
 Get the distance function used. More...
 
void kcenters (const std::vector< _T > &data, unsigned int k, std::vector< unsigned int > &centers, Matrix &dists)
 Greedy algorithm for selecting k centers. More...
 

Protected Attributes

DistanceFunction distFun_
 The used distance function. More...
 
std::mt19937 generator_ { std::random_device{}() }
 

Detailed Description

template<typename _T>
class cached_ik_kinematics_plugin::GreedyKCenters< _T >

An instance of this class can be used to greedily select a given number of representatives from a set of data points that are all far apart from each other.

Definition at line 51 of file GreedyKCenters.h.

Member Typedef Documentation

◆ DistanceFunction

template<typename _T >
using cached_ik_kinematics_plugin::GreedyKCenters< _T >::DistanceFunction = std::function<double(const _T&, const _T&)>

The definition of a distance function.

Definition at line 55 of file GreedyKCenters.h.

◆ Matrix

template<typename _T >
using cached_ik_kinematics_plugin::GreedyKCenters< _T >::Matrix = Eigen::MatrixXd

A matrix type for storing distances between points and centers.

Definition at line 57 of file GreedyKCenters.h.

Constructor & Destructor Documentation

◆ GreedyKCenters() [1/3]

template<typename _T >
cached_ik_kinematics_plugin::GreedyKCenters< _T >::GreedyKCenters ( )
default

◆ GreedyKCenters() [2/3]

template<typename _T >
cached_ik_kinematics_plugin::GreedyKCenters< _T >::GreedyKCenters ( const GreedyKCenters< _T > &  )
default

◆ GreedyKCenters() [3/3]

template<typename _T >
cached_ik_kinematics_plugin::GreedyKCenters< _T >::GreedyKCenters ( GreedyKCenters< _T > &&  )
defaultnoexcept

◆ ~GreedyKCenters()

template<typename _T >
virtual cached_ik_kinematics_plugin::GreedyKCenters< _T >::~GreedyKCenters ( )
virtualdefault

Member Function Documentation

◆ getDistanceFunction()

template<typename _T >
const DistanceFunction& cached_ik_kinematics_plugin::GreedyKCenters< _T >::getDistanceFunction ( ) const
inline

Get the distance function used.

Definition at line 73 of file GreedyKCenters.h.

◆ kcenters()

template<typename _T >
void cached_ik_kinematics_plugin::GreedyKCenters< _T >::kcenters ( const std::vector< _T > &  data,
unsigned int  k,
std::vector< unsigned int > &  centers,
Matrix dists 
)
inline

Greedy algorithm for selecting k centers.

Parameters
dataa vector of data points
kthe desired number of centers
centersa vector of length k containing the indices into data of the k centers
distsa matrix such that dists(i,j) is the distance between data[i] and data[center[j]]

Definition at line 86 of file GreedyKCenters.h.

◆ operator=() [1/2]

template<typename _T >
GreedyKCenters& cached_ik_kinematics_plugin::GreedyKCenters< _T >::operator= ( const GreedyKCenters< _T > &  )
default

◆ operator=() [2/2]

template<typename _T >
GreedyKCenters& cached_ik_kinematics_plugin::GreedyKCenters< _T >::operator= ( GreedyKCenters< _T > &&  )
defaultnoexcept

◆ setDistanceFunction()

template<typename _T >
void cached_ik_kinematics_plugin::GreedyKCenters< _T >::setDistanceFunction ( const DistanceFunction distFun)
inline

Set the distance function to use.

Definition at line 67 of file GreedyKCenters.h.

Member Data Documentation

◆ distFun_

template<typename _T >
DistanceFunction cached_ik_kinematics_plugin::GreedyKCenters< _T >::distFun_
protected

The used distance function.

Definition at line 128 of file GreedyKCenters.h.

◆ generator_

template<typename _T >
std::mt19937 cached_ik_kinematics_plugin::GreedyKCenters< _T >::generator_ { std::random_device{}() }
protected

Random number generator used to select first center

Definition at line 131 of file GreedyKCenters.h.


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