ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

no laser data in rviz while using amcl

asked 2021-11-11 22:54:47 -0500

SnowMax gravatar image

updated 2022-03-25 17:28:56 -0500

lucasw gravatar image

I have a problem for using amcl, but I could find a solution that solves my problem, I am going to elaborate on all steps I'm doing for identifying the problem easier.

So, I try to learn the functionality of amcl package. So, first of all, I start a simulation a turtlebot 3 in Gazebo house environment and use gampping to create a map.

export TURTLEBOT3_MODEL=burger
roslaunch turtlebot3_gazebo turtlebot3_gouse.launch

and I launch mapping by

roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=gmapping

after creating a map, I save the map and close the simulation.

rosrun map_server map_saver -f my_mpa

The information of yaml file is following:

image: my_map.pgm
resolution: 0.050000
origin: [-150.000000, -150.000000, 0.000000]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196

So, based on those map information, and follow some amcl tutorial I crate a package for launch the amcl, and the launch file is following:

  <arg name="map" default="$(find my_pkg)/maps/my_map.yaml" />
  <node pkg="map_server" type="map_server" name="map_server" args="$(arg map)" />

  <arg name="scan_topic" default="/scan" />
  <arg name="initial_pose_x" default="-150" />
  <arg name="initial_pose_y" default="-150" />
  <arg name="initial_pose_a" default="0.0" />
  <node pkg="amcl" type="amcl" name="amcl" output="screen">

    <param name="odom_model_type" value="diff"/>
    <param name="odom_alpha5" value="0.1"/>
    <param name="transform_tolerance" value="0.2" />
    <param name="gui_publish_rate" value="10.0"/>
    <param name="laser_max_beams" value="30"/>
    <param name="min_particles" value="500"/>
    <param name="max_particles" value="5000"/>
    <param name="kld_err" value="0.05"/>
    <param name="kld_z" value="0.99"/>
    <param name="odom_alpha1" value="0.2"/>
    <param name="odom_alpha2" value="0.2"/>
    <param name="odom_alpha3" value="0.8"/>
    <param name="odom_alpha4" value="0.2"/>
    <param name="laser_z_hit" value="0.5"/>
    <param name="laser_z_short" value="0.05"/>
    <param name="laser_z_max" value="0.05"/>
    <param name="laser_z_rand" value="0.5"/>
    <param name="laser_sigma_hit" value="0.2"/>
    <param name="laser_lambda_short" value="0.1"/>
    <param name="laser_lambda_short" value="0.1"/>
    <param name="laser_model_type" value="likelihood_field"/>
    <param name="laser_likelihood_max_dist" value="2.0"/>
    <param name="update_min_d" value="0.2"/>
    <param name="update_min_a" value="0.5"/>

    <param name="odom_frame_id" value="odom"/>
    <param name="base_frame_id" value="base_footprint"/>

    <param name="resample_interval" value="1"/>
    <param name="transform_tolerance" value="0.1"/>
    <param name="recovery_alpha_slow" value="0.0"/>
    <param name="recovery_alpha_fast" value="0.0"/>

From my understanding, the most of parameter is OK for keeping default value, I only need to care about loading the map server, matching the map origin, and setting the odom frame id to match the turtlebot3.

However, after I run this launch file, I get a WARN:

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

Also, in rviz, the robot ... (more)

edit retag flag offensive close merge delete


I was wondering if there was a node that was issuing /scan topic. I would like you to run the rostopic list with a set of nodes up and add the results to the question.

miura gravatar image miura  ( 2021-11-12 20:00:56 -0500 )edit

@miura sorry, since I am new to this forum, I can't upload the image directly, so I upload them to some web, please see the link list below. An additional description, the /scan topic is published by Gazebo and I use rostopic echo /scan to confirm that the sensor data has some information.

SnowMax gravatar image SnowMax  ( 2021-11-14 22:13:07 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2021-11-15 18:53:07 -0500

miura gravatar image

If you maybe add the following to the launch file, it will work.

<node pkg="tf" type="static_transform_publisher" name="link1" args="1 0 0 0 0 0 base_scan base_footprint 100" />

If you do a rostopic echo /scan, the frame_id of the Header will be "base_scan". This is probably because the base_scan is not set to where it is on the map. So we use static_transform_publisher to set the rider and base_footprint to the same location.

edit flag offensive delete link more

answered 2021-11-14 08:46:40 -0500

Mike Scheutzow gravatar image

updated 2021-11-14 08:48:37 -0500

"No laser scan received" is a misleading error message. Most likely, this is amcl complaining that it can't transform the scan msg data points into the map frame. This is because at startup your robot does not yet have a pose. One way to provide this is by setting the initial_pose_x, _y, _a properties for the amcl node. The launch file you show above defines the values, then doesn't use them anywhere.

edit flag offensive delete link more


Thanks for giving me some help, so, I change initial_x, _y, _a from argument to parameter:

<param name="initial_pose_x" value="-150" />
<param name="initial_pose_y" value="-150" />
<param name="initial_pose_z" value="0.0" />

but the problem doesn't solve, so how could I use those initial positions correctly?

SnowMax gravatar image SnowMax  ( 2021-11-14 22:17:00 -0500 )edit

You need to read the amcl documentation on All the properties and their meaning are described on that page. It is not _z, it is _a (for angle, in radians.) Also, typically 0,0 is the center of the map, so those values are putting part of the robot off the map.

Alternately, you can initialize the robot position from rviz, using the "2D Pose Estimate" button.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-11-15 06:21:50 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-11-11 22:54:47 -0500

Seen: 103 times

Last updated: Nov 15 '21