Gazebo | Ignition | Community
Ask Your Question

Getting parameters from SDF

asked 2015-02-03 11:27:41 -0500

rahhwang gravatar image

updated 2015-02-03 11:29:46 -0500

How can I get parameters from the sdf from within a plugin? Specifically, I am trying to get the initial pose from a model. Based what I've seen in other code, I've tried something like


class ModelMovePath : public ModelPlugin
    public: void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
            // Store the pointer to the model
            this->model = _parent;
           string pose = _sdf->GetElement("pose");


But neither "pose" or "model" seem to be elements or parameters of the sdf.I looked at the sdf website, but am still having some trouble. Is there more detailed documentation anywhere on how to read parameters from sdf?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-02-04 18:21:47 -0500

scpeters gravatar image

The ModelPlugin::Load function will receive the sdf elements given as children of the <plugin> tag. See the pioneer2dx model and the corresponding code in DiffDrivePlugin.

edit flag offensive delete link more

Question Tools


Asked: 2015-02-03 11:27:41 -0500

Seen: 1,231 times

Last updated: Feb 04 '15