Summary
GraphProviderPlugin is currently hardcoded as a built-in plugin in gateway_node.cpp:491:
plugin_mgr_->add_plugin(std::make_unique<GraphProviderPlugin>());
This couples the graph provider to the gateway binary. The plugin framework already supports dynamic .so loading via dlopen (see test_gateway_plugin.cpp for the pattern and gateway_params.yaml for YAML config). The graph provider should follow the same pattern so users can opt-in/out without recompiling.
Proposed solution
- Create a separate build target for the graph provider as a MODULE shared library (like
test_gateway_plugin.so), e.g. ros2_medkit_graph_provider_plugin.so
- Add
extern "C" exports: plugin_api_version(), create_plugin(), get_introspection_provider()
- Remove the hardcoded
add_plugin from gateway_node.cpp and the #include of graph_provider_plugin.hpp
- Remove
graph_provider_plugin.cpp from gateway_lib static library sources in CMakeLists.txt
- Document loading in
gateway_params.yaml and docs/tutorials/plugin-system.rst:
plugins: ["graph_provider"]
plugins.graph_provider.path: "/opt/ros2_medkit/lib/libros2_medkit_graph_provider_plugin.so"
- Keep
diagnostic_msgs dependency scoped to the plugin .so, not the gateway core
Follows the existing pattern established by the update plugin and test plugin (test_gateway_plugin.cpp:117-131).
Additional context
Introduced in PR #270. Currently the graph provider includes gateway_node.hpp and uses dynamic_cast<GatewayNode *> to access entity cache and fault manager - these couplings should go through PluginContext instead when extracting to .so.
Summary
GraphProviderPluginis currently hardcoded as a built-in plugin ingateway_node.cpp:491:plugin_mgr_->add_plugin(std::make_unique<GraphProviderPlugin>());This couples the graph provider to the gateway binary. The plugin framework already supports dynamic
.soloading viadlopen(seetest_gateway_plugin.cppfor the pattern andgateway_params.yamlfor YAML config). The graph provider should follow the same pattern so users can opt-in/out without recompiling.Proposed solution
test_gateway_plugin.so), e.g.ros2_medkit_graph_provider_plugin.soextern "C"exports:plugin_api_version(),create_plugin(),get_introspection_provider()add_pluginfromgateway_node.cppand the#includeofgraph_provider_plugin.hppgraph_provider_plugin.cppfromgateway_libstatic library sources in CMakeLists.txtgateway_params.yamlanddocs/tutorials/plugin-system.rst:diagnostic_msgsdependency scoped to the plugin .so, not the gateway coreFollows the existing pattern established by the update plugin and test plugin (
test_gateway_plugin.cpp:117-131).Additional context
Introduced in PR #270. Currently the graph provider includes
gateway_node.hppand usesdynamic_cast<GatewayNode *>to access entity cache and fault manager - these couplings should go throughPluginContextinstead when extracting to .so.