moveit2
The MoveIt Motion Planning Framework for ROS 2.
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cached_ik_kinematics_plugin::IKCache Class Reference

A cache of inverse kinematic solutions. More...

#include <cached_ik_kinematics_plugin.h>

Collaboration diagram for cached_ik_kinematics_plugin::IKCache:
Collaboration graph
[legend]

Classes

struct  Options
 
struct  Pose
 class to represent end effector pose More...
 

Public Types

using IKEntry = std::pair< std::vector< Pose >, std::vector< double > >
 

Public Member Functions

 IKCache ()
 
 ~IKCache ()
 
 IKCache (const IKCache &)=delete
 
const IKEntrygetBestApproximateIKSolution (const Pose &pose) const
 
const IKEntrygetBestApproximateIKSolution (const std::vector< Pose > &poses) const
 
void initializeCache (const std::string &robot_id, const std::string &group_name, const std::string &cache_name, const unsigned int num_joints, const Options &opts=Options())
 
void updateCache (const IKEntry &nearest, const Pose &pose, const std::vector< double > &config) const
 
void updateCache (const IKEntry &nearest, const std::vector< Pose > &poses, const std::vector< double > &config) const
 
void verifyCache (kdl_kinematics_plugin::KDLKinematicsPlugin &fk) const
 

Protected Member Functions

double configDistance2 (const std::vector< double > &config1, const std::vector< double > &config2) const
 
void saveCache () const
 

Protected Attributes

unsigned int num_joints_
 
double min_pose_distance_
 
double min_config_distance2_
 
unsigned int max_cache_size_
 
std::filesystem::path cache_file_name_
 
std::vector< IKEntryik_cache_
 
NearestNeighborsGNAT< IKEntry * > ik_nn_
 
unsigned int last_saved_cache_size_ { 0 }
 
std::mutex lock_
 

Detailed Description

A cache of inverse kinematic solutions.

Definition at line 56 of file cached_ik_kinematics_plugin.h.

Member Typedef Documentation

◆ IKEntry

using cached_ik_kinematics_plugin::IKCache::IKEntry = std::pair<std::vector<Pose>, std::vector<double> >

the IK cache entries are simply a pair formed by a vector of poses (one for each end effector) and a configuration that achieves those poses

Definition at line 92 of file cached_ik_kinematics_plugin.h.

Constructor & Destructor Documentation

◆ IKCache() [1/2]

cached_ik_kinematics_plugin::IKCache::IKCache ( )

Definition at line 53 of file ik_cache.cpp.

Here is the call graph for this function:

◆ ~IKCache()

cached_ik_kinematics_plugin::IKCache::~IKCache ( )

Definition at line 64 of file ik_cache.cpp.

Here is the call graph for this function:

◆ IKCache() [2/2]

cached_ik_kinematics_plugin::IKCache::IKCache ( const IKCache )
delete

Member Function Documentation

◆ configDistance2()

double cached_ik_kinematics_plugin::IKCache::configDistance2 ( const std::vector< double > &  config1,
const std::vector< double > &  config2 
) const
protected

compute the distance between two joint configurations

Definition at line 148 of file ik_cache.cpp.

Here is the caller graph for this function:

◆ getBestApproximateIKSolution() [1/2]

const IKCache::IKEntry & cached_ik_kinematics_plugin::IKCache::getBestApproximateIKSolution ( const Pose pose) const

get the entry from the IK cache that best matches a given pose

Definition at line 159 of file ik_cache.cpp.

Here is the call graph for this function:

◆ getBestApproximateIKSolution() [2/2]

const IKCache::IKEntry & cached_ik_kinematics_plugin::IKCache::getBestApproximateIKSolution ( const std::vector< Pose > &  poses) const

get the entry from the IK cache that best matches a given vector of poses

Definition at line 170 of file ik_cache.cpp.

Here is the call graph for this function:

◆ initializeCache()

void cached_ik_kinematics_plugin::IKCache::initializeCache ( const std::string &  robot_id,
const std::string &  group_name,
const std::string &  cache_name,
const unsigned int  num_joints,
const Options opts = Options() 
)

initialize cache, read from disk if found

Definition at line 70 of file ik_cache.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveCache()

void cached_ik_kinematics_plugin::IKCache::saveCache ( ) const
protected

save current state of cache to disk

Definition at line 224 of file ik_cache.cpp.

Here is the caller graph for this function:

◆ updateCache() [1/2]

void cached_ik_kinematics_plugin::IKCache::updateCache ( const IKEntry nearest,
const Pose pose,
const std::vector< double > &  config 
) const

insert (pose,config) as an entry if it's different enough from the most similar cache entry

Definition at line 181 of file ik_cache.cpp.

Here is the call graph for this function:

◆ updateCache() [2/2]

void cached_ik_kinematics_plugin::IKCache::updateCache ( const IKEntry nearest,
const std::vector< Pose > &  poses,
const std::vector< double > &  config 
) const

insert (pose,config) as an entry if it's different enough from the most similar cache entry

Definition at line 194 of file ik_cache.cpp.

Here is the call graph for this function:

◆ verifyCache()

void cached_ik_kinematics_plugin::IKCache::verifyCache ( kdl_kinematics_plugin::KDLKinematicsPlugin fk) const

verify with forward kinematics that the cache entries are correct

Definition at line 260 of file ik_cache.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ cache_file_name_

std::filesystem::path cached_ik_kinematics_plugin::IKCache::cache_file_name_
protected

file name for loading / saving cache

Definition at line 134 of file cached_ik_kinematics_plugin.h.

◆ ik_cache_

std::vector<IKEntry> cached_ik_kinematics_plugin::IKCache::ik_cache_
mutableprotected

the IK methods are declared const in the base class, but the wrapped methods need to modify the cache, so the next four members are mutable cache of IK solutions

Definition at line 142 of file cached_ik_kinematics_plugin.h.

◆ ik_nn_

NearestNeighborsGNAT<IKEntry*> cached_ik_kinematics_plugin::IKCache::ik_nn_
mutableprotected

nearest neighbor data structure over IK cache entries

Definition at line 144 of file cached_ik_kinematics_plugin.h.

◆ last_saved_cache_size_

unsigned int cached_ik_kinematics_plugin::IKCache::last_saved_cache_size_ { 0 }
mutableprotected

size of the cache when it was last saved

Definition at line 146 of file cached_ik_kinematics_plugin.h.

◆ lock_

std::mutex cached_ik_kinematics_plugin::IKCache::lock_
mutableprotected

mutex for changing IK cache

Definition at line 148 of file cached_ik_kinematics_plugin.h.

◆ max_cache_size_

unsigned int cached_ik_kinematics_plugin::IKCache::max_cache_size_
protected

maximum size of the cache

Definition at line 132 of file cached_ik_kinematics_plugin.h.

◆ min_config_distance2_

double cached_ik_kinematics_plugin::IKCache::min_config_distance2_
protected

... or the configurations are at least minConfigDistance2_^.5 apart.

Definition at line 130 of file cached_ik_kinematics_plugin.h.

◆ min_pose_distance_

double cached_ik_kinematics_plugin::IKCache::min_pose_distance_
protected

for all cache entries, the poses are at least minPoseDistance_ apart ...

Definition at line 128 of file cached_ik_kinematics_plugin.h.

◆ num_joints_

unsigned int cached_ik_kinematics_plugin::IKCache::num_joints_
protected

number of joints in the system

Definition at line 125 of file cached_ik_kinematics_plugin.h.


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