Gazebo | Ignition | Community
Ask Your Question

Revision history [back]


This is possible, I will give you a template:

Here is a plugin example in the sdf file:

    <plugin name='plugin_name' filename=''>

For example in the Load function of the plugin you can get the parameter as following:

void PluginName::Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
double param;

if (!_sdf->HasElement("sdf_parameter"))
    // if parameter tag does NOT exist
    std::cout << "Missing parameter <sdf_parameter> in PluginName, default to 0" << std::endl;
    param = 0;
    // if parameter tag exists, get its value
else param = _sdf->GetElement("sdf_parameter")->GetValueDouble();

Cheers, Andrei