Mastering ROS for Robotics Programming(Second Edition)
上QQ阅读APP看书,第一时间看更新

Adding the gazebo_ros_control plugin

After adding the transmission tags, we should add the gazebo_ros_control plugin in the simulation model to parse the transmission tags and assign appropriate hardware interfaces and the control manager. The following code adds the gazebo_ros_control plugin to the xacro file:

  <!-- ros_control plugin --> 
  <gazebo> 
    <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so"> 
      <robotNamespace>/seven_dof_arm</robotNamespace> 
    </plugin> 
  </gazebo> 

Here, the <plugin> element specifies the plugin name to be loaded, which is libgazebo_ros_control.so. The <robotNamespace> element can be given as the name of the robot; if we are not specifying the name, it will automatically load the name of the robot from the URDF. We can also specify the controller update rate (<controlPeriod>), the location of robot_description (URDF) on the parameter server (<robotParam>), and the type of robot hardware interface (<robotSimType>). The default hardware interfaces are JointStateInterface, EffortJointInterface, and VelocityJointInterface.