gazebo实例学习-----LRRP_2nd_chapter9仿真失败分析

本文解决了在Ubuntu16.04+ROS Kinetic环境下学习《Learning ROS for Robotics Programming 2nd edition》第九章时遇到的警告问题。通过修改URDF文件、调整gazebo插件配置以及改变启动顺序等步骤,成功消除了警告并使案例运行正常。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

    在Ubuntu 16.04+ROS kinetic环境学习《Learning_ROS_for_Robotics_Programming_2nd_edition》的chapter 9 The Navigation Stack –Beyond Setups时候出现如下警告导致无法成功运行本章案例。


1 错误记录

(1)执行如下命令:

roslaunch chapter9_tutorials chapter9_configuration_gazebo.launch

roslaunch chapter9_tutorials move_base.launch


(2)错误信息

1)Warning

第一条:

[ WARN] [1480983367.577704599]: The root link base_footprint has an inertia specified in the URDF, but KDL does not support a root link with an inertia.  As a workaround, you can add an extra dummy link to your URDF

【分析】:现象看是URDF问题,从URDF入手解决

第二条:

[ WARN] [1480981421.815460738, 6.221000000]: Timed out waiting for transform from base_footprint to map to become available before running costmap, tf error: . canTransform returned after 6.221 timeout was 0.1


【分析】:从现象看是tf问题,使用常见分析命令roswtf,rosrun tf tf_monitor,rosrun tf tf_eco src des等看看;

            同时看看各个node的输入是否都正常获取,没有的话分析下是订阅主题名称不对,还是主题上根本就无消息出来。

2) Rviz界面左侧显示红色失败


2 解决措施


2.1 修改文件chapter7_tutorials/robot1_description/urdf/robot1_base_04.xacro

注释掉如下红色,解决上面第一条警告:

<link name="base_footprint">
           <visual>
            <geometry>
                      <box size="0.001 0.001 0.001"/>
                 </geometry>
            <origin rpy="0 0 0" xyz="0 0 0"/>
           </visual>
        <!-- <xacro:default_inertial mass="0.0001"/> -->
</link>

修改如下红色用于解决第二条警告,以及rviz失败问题

  <!-- Drive controller -->
<gazebo>
  <plugin name="skid_steer_drive_controller" filename="libgazebo_ros_skid_steer_drive.so">
    <updateRate>100.0</updateRate>
    <robotNamespace>/</robotNamespace>
    <leftFrontJoint>base_to_wheel1</leftFrontJoint>
    <rightFrontJoint>base_to_wheel3</rightFrontJoint>
    <leftRearJoint>base_to_wheel2</leftRearJoint>
    <rightRearJoint>base_to_wheel4</rightRearJoint>
    <wheelSeparation>4</wheelSeparation>
    <wheelDiameter>0.1</wheelDiameter>
    <robotBaseFrame>base_footprint</robotBaseFrame> //原来是base_link
    <torque>1</torque>
    <commandTopic>cmd_vel</commandTopic> //原来没有新添加
    <odometryTopic>odom</odometryTopic> //原来没有新添加
    <odometryFrame>odom</odometryFrame> //原来没有新添加
    <broadcastTF>true</broadcastTF>  //原来是0,意味着为false,很关键决定了TF发送

  </plugin>
</gazebo>


2.2 修改文件chapter7_tutorials/robot1_description/urdf/robot.gazebo

修改如下红色用于解决第二条警告,以及rviz失败问题

<plugin name="gazebo_ros_head_hokuyo_controller" filename="libgazebo_ros_laser.so">
          <topicName>/scan</topicName> 原来为/robot/laser/scan,虽然在chapter9_configuration_gazebo.launch中remap到/scan但是好像映射无效,所以其它相关订阅node无法使用
        <frameName>hokuyo_link</frameName>

</plugin>


2.3 修改了文件chapter9_tutorials/launch/chapter9_configuration_gazebo.launch

注释掉如下红色并将其加入到了chapter9_tutorials/launch/move_base.launch,为了调整使一切ready后再启动rviz

<!-- <node name="rviz" pkg="rviz" type="rviz" args="-d $(find chapter9_tutorials)/launch/navigation.rviz"/> -->


2.4 修改了文件chapter9_tutorials/launch/move_base.launch

添加如下到启动文件末尾

<node name="rviz" pkg="rviz" type="rviz" args="-d $(find chapter9_tutorials)/launch/navigation.rviz"/>


3 运行结果显示

3.1 Rviz显示界面


3.2 rqt_graph显示

从图中分析知道:

Node AMCL: input了robot_state_publisher的tf_static, gazebo仿真底座控制器的/tf(odom->base_footprint),gazebo的 laser sensor的/scan, /initialpose

                      output了/tf(map->odom),/particlecloud

Node move_base: input了map_server的/map, gazebo仿真底座控制器odom,gazebo仿真sensor的/scan, robot_state_publisher的tf_static,gazebo仿真底座控制器的tf,amcl的tf,move_base_simple的goal

                              output了:cmd_vel给gazebo仿真的底座控制器


评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值