Gazebo中的差动驱动机器人提供基本控制器。需要一个定义明确的差动驱动器机器人才能使用此插件。
<gazebo>
<plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
<!-- 插件数据topic更新速度 Hz -->
<updateRate> 50 </updateRate>
<!-- 左关节的名称,默认为`left_joint` -->
<leftJoint>base_link_left_wheel_joint</leftJoint>
<!-- 右关节的名称,默认为`right_joint` -->
<rightJoint>base_link_right_wheel_joint</rightJoint>
<!-- 一个轮子的中心到另一个轮子的中心的距离,以米为单位,默认为0.34 m -->
<wheelSeparation>0.5380</wheelSeparation>
<!-- 车轮直径(以米为单位)默认为0.15 m -->
<wheelDiameter>0.2410</wheelDiameter>
<!-- 车轮加速度, in rad/s^2, 默认 0.0 rad/s^2 -->
<wheelAcceleration>1.0</wheelAcceleration>
<!-- 车轮可产生的最大扭矩, in Nm, 默认 5 Nm -->
<wheelTorque>20</wheelTorque>
<!-- 接收geometry_msgs / Twist消息命令的主题, 默认为 `cmd_vel` -->
<commandTopic>cmd_vel</commandTopic>
<!-- 发布nav_msgs / Odometry消息的主题, 默认为 `odom` -->
<odometryTopic>odom</odometryTopic>
<!-- 里程表框架, 默认为 `odom` -->
<odometryFrame>odom</odometryFrame>
<!-- 可从机器人框架中计算里程, defaults to `base_footprint` -->
<robotBaseFrame>base_footprint</robotBaseFrame>
<!-- 里程计测量来源, 0 for 编码器, 1 for WORLD, 默认为 WORLD -->
<odometrySource>1</odometrySource>
<!-- 设置为true以发布车轮TF的变换, 默认为 false -->
<publishWheelTF>true</publishWheelTF>
<!-- 设置为true以发布里程表的转换, 默认为 true -->
<publishOdom>true</publishOdom>
<!-- 设置为true可以在车轮关节的/joint_states上发布sensor_msgs /JointState, 默认为false -->
<publishWheelJointState>true</publishWheelJointState>
<!-- 设置为true以交换左右车轮, 默认为true -->
<legacyMode>false</legacyMode>
</plugin>
</gazebo>