Skip to content

System Plugin Intefaces

official gazebo sim doc link

comman line in any system plugin

class MoveModel :
    // This class is a system.
    public gz::sim::System,
    public gz::sim::ISystemConfigure,
    public gz::sim::ISystemPreUpdate,
    //public gz::sim::ISystemUpdate,
    //public gz::sim::ISystemPostUpdate
// Register the plugin with Gazebo Sim
GZ_ADD_PLUGIN(gz::sim::systems::MoveModel,
              gz::sim::System,
              gz::sim::ISystemConfigure,
              gz::sim::ISystemPreUpdate)

Note: in inheriting which class what function needs to be defined

  • gz::sim::ISystemConfigure -> Configure()
  • gz::sim::ISystemPreUpdate -> PreUpdate()
  • public gz::sim::ISystemUpdate -> Update()
  • public gz::sim::ISystemPostUpdate -> PostUpdate()




void Configure(const Entity &_entity,
                   const std::shared_ptr<const sdf::Element> &_sdf,
                   EntityComponentManager &_ecm,
                   EventManager &_eventMgr) override;

void PreUpdate(const UpdateInfo &_info,
                  EntityComponentManager &_ecm) override;

void Update(const UpdateInfo &_info, EntityComponentManager &_ecm) override;

void PostUpdate(const UpdateInfo &_info, const EntityComponentManager &_ecm) override;  

pure virtual function

class api: ISystemConfigure,ISystemPreUpdate,ISystemUpdate, ISystemPostUpdate

all of the above are pure virtual funtion because of which all need to defined in the derive class

Decide on interfaces to implement

The first step of implementing a system plugin is to determine the subset of available interfaces to implement. Aside from the base System object, there are currently four additional available interfaces:

plugin-flow

  1. ISystemConfigure
    • read-write access
    • Executed once
    • SDF file parameters define
  2. ISystemPreUpdate
    • read-write access
    • modify state before physics runs
  3. ISystemUpdate
    • read-write access
    • Used for physics simulation step (i.e., simulates what happens at time gz::sim::UpdateInfo::simTime).
  4. ISystemPostUpdate
    • read-only access
    • Used to read out results at the end of a simulation step to be used for sensor or controller updates.
  5. ISystemReset
    • read-write access
    • Executed once the moment the plugin is reseted.