Home | Tutorials | Wiki | Issues
Ask Your Question
0

What part of the sdf file is sdf::ElementPtr in the load() function?

asked 2017-06-18 10:30:40 -0600

michael1234 gravatar image

Suppose we have a Sdf file .world, like this one:

<?xml version="1.0" ?>
<sdf version="1.5">
  <world name="default">

    <model name="my_velodyne">
      <include>
        <uri>model://velodyne_hdl32</uri>
      </include>

      <!-- Attach the plugin to this model -->
      <plugin name="velodyne_control" filename="libvelodyne_plugin.so">
        <velocity>25</velocity> 
      </plugin>
    </model>

  </world>
</sdf>

When the load() function is called, for example:

#include <gazebo/gazebo.hh>
#include <gazebo/physics/physics.hh>

namespace gazebo
{
  class VelodynePlugin : public ModelPlugin
  {
    /// \brief Constructor
    public: VelodynePlugin() {}

    public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf)
    {
    }
};

  // Tell Gazebo about this plugin, so that Gazebo can call Load on this plugin.
  GZ_REGISTER_MODEL_PLUGIN(VelodynePlugin)
}

What part of the Sdf file is sdf::ElementPtr _sdf?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-06-19 08:47:29 -0600

sloretz gravatar image

I believe _sdf is the <plugin>...</plugin> element. It helps plugins load parameters from the SDF file. The Random Velocity Plugin tutorial has some code that makes use of the sdf::ElementPtr.

edit flag offensive delete link more

Comments

Thanks sloretz!

michael1234 gravatar imagemichael1234 ( 2017-06-20 09:30:48 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-06-18 10:30:40 -0600

Seen: 1,527 times

Last updated: Jun 19 '17