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

Slam Toolbox - How is scan data used to build the map?

asked 2021-02-15 15:42:09 -0500

potentialdiffer gravatar image

Hello together,

I set up a simulation environment with Slam Toolbox and navigation2. This all works fine so far, however I am now wondering about how the map is actually being created.

I recognized, that areas where no object gets hit stay unknown (-1) in the occupancy grid map. Whereas the area between min_range and max_range should be updated as free (0). The simulated laser is providing 360° readings. Beams that hit no object return a range value of infinity and an intensity of zero. Beams that hit an object return the range and an intensity of 400.

This leads to the following map depicted in the picture. A corridor leads to triangles of unknown area. Is this expected behavior? If yes, why? And if not, what could cause this?

image description


edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2022-03-09 07:34:24 -0500

levers gravatar image

I encountered the same problem today and solved it in simulation in the following way:

I increased the max range of the gazebo laser scan plugin to a higher distance and then went on to change the slam_toolbox max_laser_range to the max range of the laser scan. This lead to the desired behaviour that every scan up until the specified max_laser_range was used to create the map, especially in front of the robot. Unfortunately, this does not solve the problems on a real robot where we still get "inf" as value when the laser scan does not hit anything instead of the max distance. I think there exists a laser scan filter package which I will look into next.

edit flag offensive delete link more


I solved the problem by using the laser_filter package. There I used the RangeFilter to edit out all infinite readings like so:



  #scan_topic: /scan #does not work like that, has to be done via remappings in the launch file


    name: box_filter

    type: laser_filters/LaserScanRangeFilter


      use_message_range_limits: false   # if not specified defaults to false

      lower_threshold: 0.05              # if not specified defaults to 0.0

      upper_threshold: 5.8              # if not specified defaults to 100000.0

      lower_replacement_value: 0.05   # if not specified defaults to NaN

      upper_replacement_value: 5.9     # if not specified defaults to NaN

Then I set slam_toolbox max_range to something below the upper_threshold of scan_filters. That made it work

levers gravatar image levers  ( 2022-03-24 05:18:46 -0500 )edit

answered 2021-02-15 16:54:03 -0500

AGV5 gravatar image

check your mapping parameters ~maxUrange has to be smaller than ~maxrange in order to clear an area where the laser does not hit an obstacle. Depending on your current settings this is an expected behavior.

edit flag offensive delete link more


I set my lidar parameter as range_max: 30.0 and the slam toolbox parameter max_laser_range: 10.0. This should meet the requirements. However, I still have the same effect.

The extreme case would be, that the robot is located in an open area with no obstacles in its line of sight. In this case, slam-toolbox would not update the map with free space, although this information is available. Again, this is just for my current configuration and probably not the expected behavior but changing the range parameters did not solve the problem for me.

potentialdiffer gravatar image potentialdiffer  ( 2021-02-16 03:04:01 -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

1 follower


Asked: 2021-02-15 15:42:09 -0500

Seen: 583 times

Last updated: Mar 09 '22