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

Adding transmission tags to actuate the model

To actuate the robot using ROS controllers, we should define the <transmission> element to link actuators to joints. Here is the macro defined for transmission:

   <xacro:macro name="transmission_block" params="joint_name"> 
    <transmission name="tran1"> 
      <type>transmission_interface/SimpleTransmission</type> 
      <joint name="${joint_name}"> 
                  <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface> 
      </joint> 
      <actuator name="motor1"> 
       <mechanicalReduction>1</mechanicalReduction> 
      </actuator> 
    </transmission> 
   </xacro:macro> 

Here, <joint name = ""> is the joint in which we link the actuators. The <type> element is the type of transmission. Currently, transmission_interface/SimpleTransmission is only supported. The <hardwareInterface> element is the type of hardware interface to load (position, velocity, or effort interfaces). In the proposed example, a position control hardware interface has been used. The hardware interface is loaded by the gazebo_ros_control plugin; we look at this plugin in the next section.