load yaml parameters to my gazebo body

asked 2017-12-27 10:46:56 -0500

gq38071112 gravatar image

I am trying to load some yaml parameters in my model,here is my code. The variable N is supposed to be 6, but it shows always a random number and seems like the parameter loading is not succesfull. What is wrong with my code. how can I fix it

namespace gazebo {

class DronePlugin : public ModelPlugin

{ int N=6;

public: DronePlugin() {}

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

this->model = _model;

if (!ros::isInitialized())

{ int argc = 0; char **argv = NULL;

ros::init(argc, argv, "gazebo_client",

  ros::init_options::NoSigintHandler);

this->rosNode.reset(new ros::NodeHandle("gazebo_client"));

this->rosNode->param("rotor_number", N, N); }

edit retag flag offensive close merge delete