ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Gmapping doesn't mark free spaces

asked 2018-05-02 21:08:04 -0500

hosein gravatar image

in the documentation for Gmapping it is said :

The maximum range of the sensor. If regions with no obstacles within the range of the sensor should appear as free space in the map, set maxUrange < maximum range of the real sensor <= maxRange.

now my laser sensor has a maximum range of 30 meters so i set the maxRange parameter to 30.0 and maxUrange parameter to 29.0 but gammping still doesn't mark free spaces when obstacles are out of range .

in fact when the laser doesn't detect any obstacles in the range of 30 meters this 30 meters area is not marked as free and remains unknown. I changed maxUrange and maxRange to many different values but that didn't help.

I also visited here and [here] ( ) but they didn't help . there's also an open issue for this problem on GitHub repo for slam_gmapping below are the parameters I use for gmapping :

<?xml version="1.0"?>
      <arg name="robotname" default="robot1"/>
      <group ns="$(arg robotname)">
                <node   pkg="gmapping"   type="slam_gmapping" name="mapping">
                   <param name="map_frame" value="/map" />
                   <param name="base_frame" value="$(arg robotname)/base_link"/>
                   <param name="odom_frame" value="$(arg robotname)/odom" />
                   <remap from="scan" to="/$(arg robotname)/hokuyo" />
                   <param name="map_update_interval" value="0.1" />
                   <param name="delta" value="0.2 "/>
                   <param name="particle" value="5" />
                   <param name="iterations" value="1" />
                   <param name="maxUrange" value="29" />
                   <param name="maxRange" value="30" />
                   <param name="linearUpdate" value="0.1" />
                   <param name="xmin" value="-75" />
                   <param name="xmax" value="75" />
                   <param name="ymax" value="75" />
                   <param name="ymin" value="-75" />


I was wondering If anyone has a solution. btw I am using ros kinetic on Ubuntu 16.04

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2019-08-22 18:18:08 -0500

PapaG gravatar image

Hi hosein,

It is likely that your sensor is reporting inf when it cannot see an obstacle. inf values are filtered out to avoid inaccuracies in the sensor. You are correct with the maxRange and maxUrange behaviour however if the sensor reports an inf then it cannot be handled by this condition. You could get around this by first setting any inf values to the maximum range of your sensor (prior to entering gmapping)


edit flag offensive delete link more

answered 2019-08-21 06:16:19 -0500

Murat gravatar image

updated 2020-04-07 09:08:22 -0500

Procópio gravatar image

okay. my solution is filtering inf values to maxRange. this is my gmapping.launch file.

<node pkg="gmapping" type="slam_gmapping" name='gmapping_node' output='log'>

    <param name="base_frame" value="base_link"/>
    <!--param name="base_frame" value="link_chassis"/-->
    <param name="odom_frame" value="odom"/>
    <param name="delta" value="0.02"/>
    <param name="xmin" value="-25"/>
    <param name="ymin" value="-25"/>
    <param name="xmax" value="25"/>
    <param name="ymax" value="25"/>
    <param name="map_update_interval" value="1"/>
    <param name="linearUpdate" value="0.05"/>
    <param name="angularUpdate" value="0.05"/>
    <param name="temporalUpdate" value="0.1"/>
    <param name="particles" value="50"/>
    <param name="maxUrange" value="3.4"/>
    <param name="maxRange" value="3.6"/>
    <remap from="scan" to="/scan_filtered"/>


<node pkg="laser_filters" type="scan_to_scan_filter_chain" name="laser_filter">
  <rosparam command="load" file="$(find robot_navigation)/config/lidar_config.yaml"/>
  <remap from="base_scan" to="scan"/>


and this is my lidar_config.yaml file:

scan_filter_chain: - name: range type: laser_filters/LaserScanRangeFilter params: use_message_range_limits: false lower_threshold: 0.2 upper_threshold: 3.5 lower_replacement_value: -.inf upper_replacement_value: 3.5

it works for marking free spaces to map. dont forget to filter your laser sacan with laser_filters pkg.

edit flag offensive delete link more


OP is not using cost map? OP is using g_mapping?

PapaG gravatar image PapaG  ( 2019-08-22 18:12:19 -0500 )edit

Question Tools

1 follower


Asked: 2018-05-02 21:07:45 -0500

Seen: 555 times

Last updated: Apr 07 '20