Tesseract
Motion Planning Environment
Loading...
Searching...
No Matches
contact_managers_plugin_factory.h
Go to the documentation of this file.
1
26#ifndef TESSERACT_COLLISION_CONTACT_MANAGERS_PLUGIN_FACTORY_H
27#define TESSERACT_COLLISION_CONTACT_MANAGERS_PLUGIN_FACTORY_H
28
31#include <string>
32#include <memory>
33#include <map>
34#include <yaml-cpp/yaml.h>
36
41
42// clang-format off
43#define TESSERACT_ADD_DISCRETE_MANAGER_PLUGIN(DERIVED_CLASS, ALIAS) \
44 TESSERACT_ADD_PLUGIN_SECTIONED(DERIVED_CLASS, ALIAS, DiscColl)
45
46#define TESSERACT_ADD_CONTINUOUS_MANAGER_PLUGIN(DERIVED_CLASS, ALIAS) \
47 TESSERACT_ADD_PLUGIN_SECTIONED(DERIVED_CLASS, ALIAS, ContColl)
48// clang-format on
49
50namespace tesseract_collision
51{
53class ContactManagersPluginFactory;
54
57{
58public:
59 using Ptr = std::shared_ptr<DiscreteContactManagerFactory>;
60 using ConstPtr = std::shared_ptr<const DiscreteContactManagerFactory>;
61
62 virtual ~DiscreteContactManagerFactory() = default;
63
69 virtual DiscreteContactManager::UPtr create(const std::string& name, const YAML::Node& config) const = 0;
70
71protected:
72 static const std::string SECTION_NAME;
73 friend class PluginLoader;
74};
75
78{
79public:
80 using Ptr = std::shared_ptr<ContinuousContactManagerFactory>;
81 using ConstPtr = std::shared_ptr<const ContinuousContactManagerFactory>;
82
84
90 virtual ContinuousContactManager::UPtr create(const std::string& solver_name, const YAML::Node& config) const = 0;
91
92protected:
93 static const std::string SECTION_NAME;
94 friend class PluginLoader;
95};
96
98{
99public:
106
112
117 ContactManagersPluginFactory(const tesseract_common::fs::path& config);
118
123 ContactManagersPluginFactory(const std::string& config);
124
129 void addSearchPath(const std::string& path);
130
135 std::set<std::string> getSearchPaths() const;
136
141 void clearSearchPaths();
142
147 void addSearchLibrary(const std::string& library_name);
148
153 std::set<std::string> getSearchLibraries() const;
154
160
167
173
179
184 void removeDiscreteContactManagerPlugin(const std::string& name);
185
190 void setDefaultDiscreteContactManagerPlugin(const std::string& name);
191
196 std::string getDefaultDiscreteContactManagerPlugin() const;
197
204
210
216
221 void removeContinuousContactManagerPlugin(const std::string& name);
222
227 void setDefaultContinuousContactManagerPlugin(const std::string& name);
228
234
241
249
256
264
269 void saveConfig(const boost::filesystem::path& file_path) const;
270
275 YAML::Node getConfig() const;
276
277private:
278 mutable std::map<std::string, DiscreteContactManagerFactory::Ptr> discrete_factories_;
279 mutable std::map<std::string, ContinuousContactManagerFactory::Ptr> continuous_factories_;
283};
284} // namespace tesseract_collision
285#endif // TESSERACT_COLLISION_CONTACT_MANAGERS_PLUGIN_FACTORY_H
Definition: contact_managers_plugin_factory.h:98
std::string getDefaultDiscreteContactManagerPlugin() const
Get the default discrete contact manager.
Definition: contact_managers_plugin_factory.cpp:142
ContactManagersPluginFactory(const ContactManagersPluginFactory &)=default
std::map< std::string, DiscreteContactManagerFactory::Ptr > discrete_factories_
Definition: contact_managers_plugin_factory.h:278
std::map< std::string, ContinuousContactManagerFactory::Ptr > continuous_factories_
Definition: contact_managers_plugin_factory.h:279
tesseract_common::PluginLoader plugin_loader_
Definition: contact_managers_plugin_factory.h:282
bool hasContinuousContactManagerPlugins() const
Check if it has continuous contact manager plugins.
Definition: contact_managers_plugin_factory.cpp:160
void addDiscreteContactManagerPlugin(const std::string &name, tesseract_common::PluginInfo plugin_info)
Add a discrete contact manager plugin.
Definition: contact_managers_plugin_factory.cpp:103
ContactManagersPluginFactory()
Definition: contact_managers_plugin_factory.cpp:47
ContactManagersPluginFactory & operator=(const ContactManagersPluginFactory &)=default
void setDefaultDiscreteContactManagerPlugin(const std::string &name)
Set a default discrete contact manager.
Definition: contact_managers_plugin_factory.cpp:132
bool hasDiscreteContactManagerPlugins() const
Check if it has discrete contact manager plugins.
Definition: contact_managers_plugin_factory.cpp:109
DiscreteContactManager::UPtr createDiscreteContactManager(const std::string &name) const
Get discrete contact manager object given name.
Definition: contact_managers_plugin_factory.cpp:205
ContactManagersPluginFactory(ContactManagersPluginFactory &&)=default
YAML::Node getConfig() const
Get the plugin information config as a yaml node.
Definition: contact_managers_plugin_factory.cpp:297
void clearSearchLibraries()
Clean the search libraries.
Definition: contact_managers_plugin_factory.cpp:101
void clearSearchPaths()
Clear the search paths.
Definition: contact_managers_plugin_factory.cpp:89
void setDefaultContinuousContactManagerPlugin(const std::string &name)
Set a default continuous contact manager.
Definition: contact_managers_plugin_factory.cpp:183
tesseract_common::PluginInfoContainer discrete_plugin_info_
Definition: contact_managers_plugin_factory.h:280
void addSearchLibrary(const std::string &library_name)
Add a library to search for plugin name.
Definition: contact_managers_plugin_factory.cpp:91
ContactManagersPluginFactory & operator=(ContactManagersPluginFactory &&)=default
std::set< std::string > getSearchPaths() const
Get the plugin search paths.
Definition: contact_managers_plugin_factory.cpp:87
tesseract_common::PluginInfoMap getContinuousContactManagerPlugins() const
Get the map of continuous contact manager plugin.
Definition: contact_managers_plugin_factory.cpp:165
std::set< std::string > getSearchLibraries() const
Get the plugin search libraries.
Definition: contact_managers_plugin_factory.cpp:96
void removeDiscreteContactManagerPlugin(const std::string &name)
Remove discrete contact manager plugin.
Definition: contact_managers_plugin_factory.cpp:119
std::string getDefaultContinuousContactManagerPlugin() const
Get the default continuous contact manager.
Definition: contact_managers_plugin_factory.cpp:193
void addSearchPath(const std::string &path)
Add location for the plugin loader to search.
Definition: contact_managers_plugin_factory.cpp:85
void addContinuousContactManagerPlugin(const std::string &name, tesseract_common::PluginInfo plugin_info)
Add a continuous contact manager plugin.
Definition: contact_managers_plugin_factory.cpp:154
void removeContinuousContactManagerPlugin(const std::string &name)
Remove continuous contact manager plugin.
Definition: contact_managers_plugin_factory.cpp:170
tesseract_common::PluginInfoContainer continuous_plugin_info_
Definition: contact_managers_plugin_factory.h:281
tesseract_common::PluginInfoMap getDiscreteContactManagerPlugins() const
Get the map of discrete contact manager plugin.
Definition: contact_managers_plugin_factory.cpp:114
void saveConfig(const boost::filesystem::path &file_path) const
Save the plugin information to a yaml config file.
Definition: contact_managers_plugin_factory.cpp:290
ContinuousContactManager::UPtr createContinuousContactManager(const std::string &name) const
Get continuous contact manager object given name.
Definition: contact_managers_plugin_factory.cpp:248
Define a continuous contact manager plugin which the factory can create an instance.
Definition: contact_managers_plugin_factory.h:78
std::shared_ptr< ContinuousContactManagerFactory > Ptr
Definition: contact_managers_plugin_factory.h:80
friend class PluginLoader
Definition: contact_managers_plugin_factory.h:94
std::shared_ptr< const ContinuousContactManagerFactory > ConstPtr
Definition: contact_managers_plugin_factory.h:81
virtual ContinuousContactManager::UPtr create(const std::string &solver_name, const YAML::Node &config) const =0
Create Inverse Kinematics Object.
static const std::string SECTION_NAME
Definition: contact_managers_plugin_factory.h:93
std::unique_ptr< ContinuousContactManager > UPtr
Definition: continuous_contact_manager.h:47
Define a discrete contact manager plugin which the factory can create an instance.
Definition: contact_managers_plugin_factory.h:57
std::shared_ptr< DiscreteContactManagerFactory > Ptr
Definition: contact_managers_plugin_factory.h:59
static const std::string SECTION_NAME
Definition: contact_managers_plugin_factory.h:72
std::shared_ptr< const DiscreteContactManagerFactory > ConstPtr
Definition: contact_managers_plugin_factory.h:60
friend class PluginLoader
Definition: contact_managers_plugin_factory.h:73
virtual DiscreteContactManager::UPtr create(const std::string &name, const YAML::Node &config) const =0
Create Discrete Contact Manager Object.
std::unique_ptr< DiscreteContactManager > UPtr
Definition: discrete_contact_manager.h:49
This is a utility class for loading plugins within Tesseract.
Definition: plugin_loader.h:57
tesseract_collision::CollisionCheckConfig config(5, request, tesseract_collision::CollisionEvaluatorType::LVS_DISCRETE, 0.5)
Definition: tesseract_common_serialization_unit.cpp:154
const YAML::Node & plugin_info
Definition: contact_managers_factory_unit.cpp:156
This is the continuous contact manager base class.
This is the discrete contact manager base class.
Common Tesseract Macros.
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
Definition: create_convex_hull.cpp:36
Definition: bullet_cast_bvh_manager.h:49
std::map< std::string, PluginInfo > PluginInfoMap
A map of PluginInfo to user defined name.
Definition: types.h:130
Plugin Loader to be used throughout Tesseract for loading plugins.
tesseract_common::fs::path file_path(__FILE__)
The Plugin Information struct.
Definition: types.h:104
Common Tesseract Types.