Tesseract
Motion Planning Environment
Loading...
Searching...
No Matches
kinematics_plugin_factory.h
Go to the documentation of this file.
1
26#ifndef TESSERACT_KINEMATICS_KINEMATICS_PLUGIN_FACTORY_H
27#define TESSERACT_KINEMATICS_KINEMATICS_PLUGIN_FACTORY_H
28
31#include <string>
32#include <memory>
33#include <map>
34#include <yaml-cpp/yaml.h>
36
43
44// clang-format off
45#define TESSERACT_ADD_FWD_KIN_PLUGIN(DERIVED_CLASS, ALIAS) \
46 TESSERACT_ADD_PLUGIN_SECTIONED(DERIVED_CLASS, ALIAS, FwdKin)
47
48#define TESSERACT_ADD_INV_KIN_PLUGIN(DERIVED_CLASS, ALIAS) \
49 TESSERACT_ADD_PLUGIN_SECTIONED(DERIVED_CLASS, ALIAS, InvKin)
50// clang-format on
51
53{
55class KinematicsPluginFactory;
56
59{
60public:
61 using Ptr = std::shared_ptr<InvKinFactory>;
62 using ConstPtr = std::shared_ptr<const InvKinFactory>;
63
64 virtual ~InvKinFactory() = default;
65
74 virtual InverseKinematics::UPtr create(const std::string& solver_name,
77 const KinematicsPluginFactory& plugin_factory,
78 const YAML::Node& config) const = 0;
79
80protected:
81 static const std::string SECTION_NAME;
82 friend class PluginLoader;
83};
84
87{
88public:
89 using Ptr = std::shared_ptr<FwdKinFactory>;
90 using ConstPtr = std::shared_ptr<const FwdKinFactory>;
91
92 virtual ~FwdKinFactory() = default;
93
102 virtual ForwardKinematics::UPtr create(const std::string& solver_name,
105 const KinematicsPluginFactory& plugin_factory,
106 const YAML::Node& config) const = 0;
107
108protected:
109 static const std::string SECTION_NAME;
110 friend class PluginLoader;
111};
112
114{
115public:
122
128
133 KinematicsPluginFactory(const tesseract_common::fs::path& config);
134
139 KinematicsPluginFactory(const std::string& config);
140
145 void addSearchPath(const std::string& path);
146
151 std::set<std::string> getSearchPaths() const;
152
157 void addSearchLibrary(const std::string& library_name);
158
163 std::set<std::string> getSearchLibraries() const;
164
171 void addFwdKinPlugin(const std::string& group_name,
172 const std::string& solver_name,
174
179 std::map<std::string, tesseract_common::PluginInfoContainer> getFwdKinPlugins() const;
180
186 void removeFwdKinPlugin(const std::string& group_name, const std::string& solver_name);
187
194 void setDefaultFwdKinPlugin(const std::string& group_name, const std::string& solver_name);
195
201 std::string getDefaultFwdKinPlugin(const std::string& group_name) const;
202
209 void addInvKinPlugin(const std::string& group_name,
210 const std::string& solver_name,
212
217 std::map<std::string, tesseract_common::PluginInfoContainer> getInvKinPlugins() const;
218
224 void removeInvKinPlugin(const std::string& group_name, const std::string& solver_name);
225
232 void setDefaultInvKinPlugin(const std::string& group_name, const std::string& solver_name);
233
239 std::string getDefaultInvKinPlugin(const std::string& group_name) const;
240
249 ForwardKinematics::UPtr createFwdKin(const std::string& group_name,
250 const std::string& solver_name,
253
262 InverseKinematics::UPtr createInvKin(const std::string& group_name,
263 const std::string& solver_name,
266
273 ForwardKinematics::UPtr createFwdKin(const std::string& solver_name,
277
284 InverseKinematics::UPtr createInvKin(const std::string& solver_name,
288
293 void saveConfig(const tesseract_common::fs::path& file_path) const;
294
299 YAML::Node getConfig() const;
300
301private:
302 mutable std::map<std::string, FwdKinFactory::Ptr> fwd_kin_factories_;
303 mutable std::map<std::string, InvKinFactory::Ptr> inv_kin_factories_;
304 std::map<std::string, tesseract_common::PluginInfoContainer> fwd_plugin_info_;
305 std::map<std::string, tesseract_common::PluginInfoContainer> inv_plugin_info_;
307};
308
309} // namespace tesseract_kinematics
310#endif // TESSERACT_KINEMATICS_KINEMATICS_PLUGIN_FACTORY_H
This is a utility class for loading plugins within Tesseract.
Definition: plugin_loader.h:57
std::unique_ptr< ForwardKinematics > UPtr
Definition: forward_kinematics.h:55
Define a forward kinematics plugin which the factory can create an instance.
Definition: kinematics_plugin_factory.h:87
std::shared_ptr< FwdKinFactory > Ptr
Definition: kinematics_plugin_factory.h:89
static const std::string SECTION_NAME
Definition: kinematics_plugin_factory.h:109
virtual ForwardKinematics::UPtr create(const std::string &solver_name, const tesseract_scene_graph::SceneGraph &scene_graph, const tesseract_scene_graph::SceneState &scene_state, const KinematicsPluginFactory &plugin_factory, const YAML::Node &config) const =0
Create Inverse Kinematics Object.
friend class PluginLoader
Definition: kinematics_plugin_factory.h:110
std::shared_ptr< const FwdKinFactory > ConstPtr
Definition: kinematics_plugin_factory.h:90
Define a inverse kinematics plugin which the factory can create an instance.
Definition: kinematics_plugin_factory.h:59
std::shared_ptr< const InvKinFactory > ConstPtr
Definition: kinematics_plugin_factory.h:62
friend class PluginLoader
Definition: kinematics_plugin_factory.h:82
std::shared_ptr< InvKinFactory > Ptr
Definition: kinematics_plugin_factory.h:61
virtual InverseKinematics::UPtr create(const std::string &solver_name, const tesseract_scene_graph::SceneGraph &scene_graph, const tesseract_scene_graph::SceneState &scene_state, const KinematicsPluginFactory &plugin_factory, const YAML::Node &config) const =0
Create Inverse Kinematics Object.
static const std::string SECTION_NAME
Definition: kinematics_plugin_factory.h:81
std::unique_ptr< InverseKinematics > UPtr
Definition: inverse_kinematics.h:55
Definition: kinematics_plugin_factory.h:114
void addInvKinPlugin(const std::string &group_name, const std::string &solver_name, tesseract_common::PluginInfo plugin_info)
Add a inverse kinematics plugin to the manager.
Definition: kinematics_plugin_factory.cpp:152
void setDefaultInvKinPlugin(const std::string &group_name, const std::string &solver_name)
Set a groups default inverse kinematics solver.
Definition: kinematics_plugin_factory.cpp:184
std::map< std::string, InvKinFactory::Ptr > inv_kin_factories_
Definition: kinematics_plugin_factory.h:303
KinematicsPluginFactory & operator=(KinematicsPluginFactory &&)=default
std::map< std::string, tesseract_common::PluginInfoContainer > getFwdKinPlugins() const
Get the map of forward kinematic plugins.
Definition: kinematics_plugin_factory.cpp:99
std::map< std::string, tesseract_common::PluginInfoContainer > inv_plugin_info_
Definition: kinematics_plugin_factory.h:305
std::map< std::string, tesseract_common::PluginInfoContainer > fwd_plugin_info_
Definition: kinematics_plugin_factory.h:304
std::set< std::string > getSearchLibraries() const
Get the plugin search libraries.
Definition: kinematics_plugin_factory.cpp:90
std::set< std::string > getSearchPaths() const
Get the plugin search paths.
Definition: kinematics_plugin_factory.cpp:83
YAML::Node getConfig() const
Get the plugin information config as a yaml node.
Definition: kinematics_plugin_factory.cpp:333
InverseKinematics::UPtr createInvKin(const std::string &group_name, const std::string &solver_name, const tesseract_scene_graph::SceneGraph &scene_graph, const tesseract_scene_graph::SceneState &scene_state) const
Get inverse kinematics object given group name and solver name.
Definition: kinematics_plugin_factory.cpp:270
void addFwdKinPlugin(const std::string &group_name, const std::string &solver_name, tesseract_common::PluginInfo plugin_info)
Add a forward kinematics plugin to the manager.
Definition: kinematics_plugin_factory.cpp:92
std::map< std::string, FwdKinFactory::Ptr > fwd_kin_factories_
Definition: kinematics_plugin_factory.h:302
void setDefaultFwdKinPlugin(const std::string &group_name, const std::string &solver_name)
Set a groups default forward kinematics solver.
Definition: kinematics_plugin_factory.cpp:124
KinematicsPluginFactory & operator=(const KinematicsPluginFactory &)=default
std::map< std::string, tesseract_common::PluginInfoContainer > getInvKinPlugins() const
Get the map of inverse kinematic plugins.
Definition: kinematics_plugin_factory.cpp:159
KinematicsPluginFactory(const KinematicsPluginFactory &)=default
KinematicsPluginFactory()
Definition: kinematics_plugin_factory.cpp:45
KinematicsPluginFactory(KinematicsPluginFactory &&)=default
void removeInvKinPlugin(const std::string &group_name, const std::string &solver_name)
remove inverse kinematics plugin from the manager
Definition: kinematics_plugin_factory.cpp:164
ForwardKinematics::UPtr createFwdKin(const std::string &group_name, const std::string &solver_name, const tesseract_scene_graph::SceneGraph &scene_graph, const tesseract_scene_graph::SceneState &scene_state) const
Get forward kinematics object given group name and solver name.
Definition: kinematics_plugin_factory.cpp:213
void removeFwdKinPlugin(const std::string &group_name, const std::string &solver_name)
remove forward kinematics plugin from the manager
Definition: kinematics_plugin_factory.cpp:104
tesseract_common::PluginLoader plugin_loader_
Definition: kinematics_plugin_factory.h:306
void addSearchPath(const std::string &path)
Add location for the plugin loader to search.
Definition: kinematics_plugin_factory.cpp:81
void addSearchLibrary(const std::string &library_name)
Add a library to search for plugin name.
Definition: kinematics_plugin_factory.cpp:85
std::string getDefaultFwdKinPlugin(const std::string &group_name) const
Get the default forward kinematics solver for a group.
Definition: kinematics_plugin_factory.cpp:139
std::string getDefaultInvKinPlugin(const std::string &group_name) const
Get the default forward inverse solver for a group.
Definition: kinematics_plugin_factory.cpp:199
void saveConfig(const tesseract_common::fs::path &file_path) const
Save the plugin information to a yaml config file.
Definition: kinematics_plugin_factory.cpp:326
Definition: graph.h:125
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
Forward kinematics functions.
A basic scene graph using boost.
auto scene_graph
Definition: ikfast_kinematics_7dof_unit.cpp:51
Inverse kinematics functions.
tesseract_scene_graph::SceneState scene_state
Definition: kinematics_factory_unit.cpp:265
Common Tesseract Macros.
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
Definition: create_convex_hull.cpp:36
Definition: forward_kinematics.h:44
Plugin Loader to be used throughout Tesseract for loading plugins.
tesseract_common::fs::path file_path(__FILE__)
This holds a state of the scene.
The Plugin Information struct.
Definition: types.h:104
This holds a state of the scene.
Definition: scene_state.h:54
Common Tesseract Types.