ROS机器人高效编程(原书第3版)第五章 导航功能包集入门 使用ROS创建地图出错

 

ROS机器人高效编程(原书第3版)封面

 第五章 导航功能包集入门 使用ROS创建地图出错:(特别注意第一条命令中的不是单引号,而是反引号)

$ roslaunch chapter5_tutorials gazebo_mapping_robot.launch model:="`rospack find robot1_description`/urdf/robot1_base_04.xacro"
$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py

只有警告,并没有错误,但是rviz打不开: 

[ 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


[ WARN] [1547737729.256634231, 0.001000000]: GazeboRosSkidSteerDrive Plugin (ns = //) missing <commandTopic>, defaults to "cmd_vel"
[ WARN] [1547737729.256738572, 0.001000000]: GazeboRosSkidSteerDrive Plugin (ns = //) missing <odometryTopic>, defaults to "odom"
[ WARN] [1547737729.256809889, 0.001000000]: GazeboRosSkidSteerDrive Plugin (ns = //) missing <odometryFrame>, defaults to "odom"
[ WARN] [1547737729.256899636, 0.001000000]: GazeboRosSkidSteerDrive Plugin (ns = //) missing <covariance_x>, defaults to 0.000100
[ WARN] [1547737729.257022841, 0.001000000]: GazeboRosSkidSteerDrive Plugin (ns = //) missing <covariance_y>, defaults to 0.000100
[ WARN] [1547737729.257077473, 0.001000000]: GazeboRosSkidSteerDrive Plugin (ns = //) missing <covariance_yaw>, defaults to 0.010000

解决办法:

修改文件:/home/caigen001/catkin_hm/src/chapter4_tutorials/robot1_description/urdf/robot1_base_04.xacro

文件的最后<gazebo>...</gazebo>模块

  <!-- 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>
    <!-- <commandTopic>cmd_vel</commandTopic> -->
    <!-- <odometryTopic>odom</odometryTopic> -->
    <robotBaseFrame>base_footprint</robotBaseFrame>
    <!-- <odometryFrame>odom</odometryFrame> -->
    <torque>1</torque>
    <topicName>cmd_vel</topicName>
    <broadcastTF>1</broadcastTF>
  </plugin>
</gazebo>

对比一下原版:

1.修改前:

<robotBaseFrame>base_link</robotBaseFrame>

修改后:

<robotBaseFrame>base_footprint</robotBaseFrame>

 

2.修改前:

<broadcastTF>0</broadcastTF>

修改后:

<broadcastTF>1</broadcastTF>

 

大功告成!!!

输入命令:

$ roslaunch chapter5_tutorials gazebo_mapping_robot.launch model:="`rospack find robot1_description`/urdf/robot1_base_04.xacro"
$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py

运行结果:

$ rqt_graph

 

结语:本实验还有一些不影响结果的警告,也可以修改相应的代码消除警告。

参考资料:

https://blog.csdn.net/x_r_su/article/details/53504784

 

 

 

  • 2
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 9
    评论
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值