Common In All System Plugin
Common In All System Plugin¶
1) Go to a standalone plugin folder:
2) Build:
3) Export plugin path (so Gazebo Sim can find it):
4) Launch Gazebo Sim with an SDF:
Notes:
- "-v 4" prints debug logs (useful while developing)
- If Gazebo can’t find the plugin, re-check GZ_SIM_SYSTEM_PLUGIN_PATH and that build succeeded.
Code related¶
_entity of Configure()¶
_entity is the entity it attached to world,model,light etc
void PrintEntitySystemPlugin::Configure(const Entity &_entity,
const std::shared_ptr<const sdf::Element> &_sdf,
EntityComponentManager &_ecm,
EventManager &/*_eventMgr*/)

_entity is world entity 
here it _entity is model entity
Plugin in XML¶
need register the plugin with all the class it inhertited
// Register the plugin with Gazebo Sim
GZ_ADD_PLUGIN(gz::sim::systems::PrintEntitySystemPlugin,
gz::sim::System,
gz::sim::ISystemConfigure,
gz::sim::ISystemPreUpdate)
alias
GZ_ADD_PLUGIN_ALIAS(gz::sim::systems::PrintEntitySystemPlugin,
"gz::sim::systems::PrintEntitySystemPlugin")
Important: only name=gz::sim::systems::PrintEntitySystemPlugin allowed for plugin you can't put any other name because it how we define on the alis GZ_ADD_PLUGIN_ALIAS(...)
so
<!-- custom plugin attach to world-->
<plugin
filename="PrintEntitySystemPlugin"
name="gz::sim::systems::PrintEntitySystemPlugin">
</plugin>
filename= PrintEntitySystemPlugin
or
filename= libPrintEntitySystemPlugin.so
so no other name is allowed
comes from CMakeList.txt