amcl与cartographer定位对比

14 篇文章 0 订阅

配置

正常的话题如下:

正常的坐标系关系:

脚本如下:

<?xml version="1.0"?>

<launch>
  <!-- Arguments -->
  <arg name="model" default="burger" doc="model type [burger, waffle, waffle_pi]"/>
  <arg name="map_file" default="$(find cartographer_ros)/map/mymap.yaml"/>
  <arg name="open_rviz" default="true"/>
  <param name="/use_sim_time" value="true"/>

    <!-- Map server -->
  <node pkg="map_server" name="map_server" type="map_server" args="$(arg map_file)"/>

  <!--深度图转单线激光雷达-->
  <include file="$(find depthimage_to_laserscan)/launch/depthimage_to_laserscan.launch"/>

  <param name="robot_description"
    textfile="$(find cartographer_ros)/urdf/rgbd_backpack_2d.urdf" />

  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />

  <!--<node pkg="tf" type="static_transform_publisher" name="map_to_odom" 
    args="0 0 0 0 0 0 /map /base_footprint 100" />-->

  <!-- odom->base_footprint -->
  <include file="$(find robot_pose_ekf)/robot_pose_ekf.launch"/>

  <!-- AMCL map->odom -->
  <include file="$(find clean_robot)/launch/amcl.launch"/>

  <!--move_base-->
  <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
    <param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS" />
    <param name="base_global_planner" value="global_planner/GlobalPlanner"/> 
    <rosparam file="$(find clean_robot)/param/costmap_common_params_$(arg model).yaml" command="load" ns="global_costmap" />
    <rosparam file="$(find clean_robot)/param/costmap_common_params_$(arg model).yaml" command="load" ns="local_costmap" />
    <rosparam file="$(find clean_robot)/param/local_costmap_params.yaml" command="load" />
    <rosparam file="$(find clean_robot)/param/global_costmap_params.yaml" command="load" />
    <rosparam file="$(find clean_robot)/param/move_base_params.yaml" command="load" />
    <rosparam file="$(find clean_robot)/param/dwa_local_planner_params_$(arg model).yaml" command="load" />
  </node>

  <!-- rviz -->
  <group if="$(arg open_rviz)"> 
    <node pkg="rviz" type="rviz" name="rviz" required="true"
          args="-d $(find cartographer_ros)/launch/amcl/rviz/amcl.rviz"/>
  </group>

    <node name="playbag" pkg="rosbag" type="play" args="$(arg bag_filename) --clock"/> <!-- clock -->
</launch>

BUG:

使用bag文件和地图文件去做amcl定位,amcl不起作用,使用过/use_sim_time依然解决不掉一下的问题,amcl报错以下:

[ WARN] [1648554353.141616771, 1648468964.284678703]: No laser scan received (and thus no pose updates have been published) for 1648468964.284679 seconds.  Verify that data is being published on the /scan topic.

move_base报错以下:

timed out waiting for transform from base_link to map become avaliable before running costmap...

解决办法:

这是因为我之前一直忽略amcl和move base的输入输出:

首先,amcl包接收初始位置和激光SCAN,输出的是map->odom之间的相对变换,从TF树可以看到,odom意为航推的起始坐标。

其次,move_base需要知道odom->base_link/base_footprint之间的变换关系,这样才能知道map->base_link/base_footprint之间的变换关系。

因此在脚本里为odom->base_link/base_footprint之间创建航推即可,这里我使用robot_pose_ekf代为试验。

 

重定位

定位

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值