Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to understand if my plugin is loaded in gazebo?

Hi again,

I created a ModelPlugin to simulate a motor with spring in a R robot. When I compile the plugin, it works and a file .so is generated. The I add the plugin in my URDF file in this way :

  <gazebo>
    <plugin name="motor_spring_plugin" filename="libmotor_spring_plugin.so">
    </plugin>
 </gazebo>

When I run gazebo with roslaunch there is no error and the robot appears. However I'm not able to understand if my plugin is effectively loaded in my model. How can I test it?

Moreover in this plugin I created a ros_node subscriber in the Load() function:

 public: void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
{

    if (!ros::isInitialized()) //check if ros is initialized properly
        {
          ROS_FATAL("ROS has not been initialized!");
          return;
        }


  ros::NodeHandle n;
  ros::Subscriber sub=n.subscribe("chatter", 1000, &MotorSpring::Callback, this);
      ...something... 
 this->UpdateConnection=event::Events::ConnectWorldUpdateBegin(boost::bind(&MotorSpring::OnUpdate,this,_1));

}

(the Callback function is defined as public function) Is it true?

When gazebo is running, if I start rostopic list from terminal, the topic chatter doesn't appear.

Why? It is caused by the whole plugin or I made some mistakes in the ros piece of code?

Thank you