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

How to create a costmap layer to avoid downward stairs

asked 2018-04-20 01:12:08 -0600

Jean_jierrre gravatar image

updated 2018-05-16 04:14:25 -0600


I am using costmap_2d for creating a 2d occupancy grid and mapping. I'm able to have my real robot mapping a room with a kinect and using depthimage_to_laserscan and I also would like to detect downward stairs or cliffs. I've read that it is a good idea to use voxel_grid and a layer with negative z axis, but I have no idea how to do that.

Does anyone managed to detect and avoid downstairs? Maybe just identify it as an obstacle and not necessarily putting it in the map, just avoid it.

-------EDIT 1-----------

I'm currently using depth_nav_tools for that and I've replaced depthimage_to_laserscan by laserscan, and the mapping works better, but I'm unable to detect downward stairs. Do I need pointcloud messages for cliff_detector and depth_sensor_pose, since I'm using nav2d with Operator node for obstacles with costmap2d?

Thanks for your help

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2020-04-23 16:02:18 -0600

Another approach to explore is to define two obstacle layers, one for above ground level and one from below ground level:

    - {name: above_layer, type: "costmap_2d::ObstacleLayer"}
    - {name: cliff_layer, type: "costmap_2d::ObstacleLayer"}

And then set the min and max obstacle heights for these accordingly:

  enabled: true
  observation_sources: pcloud
  combination_method: 1
  footprint_clearing_enabled: true

    topic: /camera/depth/color/points
    min_obstacle_height: 0.1

  enabled: true
  observation_sources: pcloud_cliff
  combination_method: 1
  footprint_clearing_enabled: true

    topic: /camera/depth/color/points
    max_obstacle_height: -0.1
    min_obstacle_height: -30.0

That way cliffs will show up as obstacles and your navigator will avoid them if your depth camera can see something inside the cliff (for instance the first step down). Of course, the generated 2d map is fairly useless for mapping+localization.

edit flag offensive delete link more


can we put this only in local costmap setting so that it can avoid going in that direction and in global costmap we use only the laserscan information to update the map so that it wont affect the mapping and localization process .

Badal gravatar image Badal  ( 2021-08-29 10:55:41 -0600 )edit

The costmap is not used for localization anyways. So you don't need to worry about this.

chfritz gravatar image chfritz  ( 2021-08-30 09:22:17 -0600 )edit

answered 2018-04-25 03:39:48 -0600

You'll need to perform some level of 3D mapping in order to detect the stairs. What you're actually trying to detect is an absence of floor as opposed to the presence of an obstacle. For this task depthimage_to_laserscan is not longer appropriate because it removes any information about the floor.

What I'd recommend is to keep using the laserscan method for localisation but adding an additional process that adds a map layer using the full pointcloud of the RGB-D sensor. This process detects the presence of the floor by checking their are points in that plane and creates a map layer of known safe floor areas, the cliff hazards are then the inverse of this layer.

edit flag offensive delete link more


Thanks man. That's the way I can make my robot avoiding stairs. I found depth_nav_tools, but I have some troubles with that package.

Jean_jierrre gravatar image Jean_jierrre  ( 2018-04-26 20:18:54 -0600 )edit

What troubles are you having with the cliff detector?

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-04-27 04:39:59 -0600 )edit

Hey man, have you worked with navigation or nav2d before? I'm using depth_nav_tools for detecting downward stairs. I took your recommendation and changed depthimage_to_laserscan for laserscan from depth_nav_tools and works fine. But cliff detector seems not detecting stairs at the moment

Jean_jierrre gravatar image Jean_jierrre  ( 2018-05-04 04:22:11 -0600 )edit

The main package I'm using for mapping is nav2d, so Operator node is in charge for obstacle recognition and it uses costmap2d. So, I shouldn't have any problem for detecting negative obstacles if I configured well the "params.yaml" files for both (laserscan and cliff_detector).

Jean_jierrre gravatar image Jean_jierrre  ( 2018-05-04 04:28:15 -0600 )edit

I have to put "false" for "ground_remove_en", right? I've tried both options and nothing happen. On the other hand I'm kind of confused about pointcloud for doing it. If those nodes are meant to be used for laserscan, why for costmap should I use another observation source as pointcloud?

Jean_jierrre gravatar image Jean_jierrre  ( 2018-05-04 04:32:24 -0600 )edit

@Jean_jierrre, have you figured out the solutions? I am having same problem as you for using depth_nav_tools

hdbot gravatar image hdbot  ( 2019-03-24 16:06:38 -0600 )edit

Hi, I tried to tackle the cliff with the 3D mapping. In my case I use rtabmapping, but it seems that if there is no pointcloud scan upon the surface of the stair, the slam algorithm will not identify the stair. Did I misconfigure something or it is the case with 3D mapping?

jacklu333333 gravatar image jacklu333333  ( 2021-08-24 23:50:09 -0600 )edit

Question Tools



Asked: 2018-04-20 01:12:08 -0600

Seen: 1,236 times

Last updated: Apr 23 '20