Ask Your Question

Limiting LaserScan range for Map Building

asked 2017-02-20 05:29:00 -0500

Rayner gravatar image

Hi all,

I have a turtlebot and RPLidar A2 sensor. I am currently implementing hector slam and I am wondering if it is possible to use the laserScans registered just from the 180degree rotation facing the front of the robot instead of the entire 360deg the RPLidar has to build the map. Is there a way to go about doing that?

Thank you!

edit retag flag offensive close merge delete


Try setting the map_update_angle_thresh, laser_min_dist, laser_max_dist params in the hector_slam launch file. Again this is just a logical guess.

kartikmadhira1 gravatar image kartikmadhira1  ( 2017-02-20 06:11:00 -0500 )edit

Which slam algorithm are you using?

tb12 gravatar image tb12  ( 2017-02-23 15:29:25 -0500 )edit

I am using Hector SLAM.

Rayner gravatar image Rayner  ( 2017-02-23 23:23:37 -0500 )edit

in ros,there is a laserfilter package for it.You can use the laserscanangleboundfilters to do that.

skydddive gravatar image skydddive  ( 2018-07-01 22:21:25 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2017-02-23 06:25:37 -0500

Rayner gravatar image

updated 2017-02-23 06:53:19 -0500

Managed to limit the scan by editing the hector mapping source file,hectorMappingRos.cpp. Set a fixed range for [i] - for the scan range and pointcloud data container from 270-360deg and 0 to 90deg. However, this gave rise to an exponential increase in inaccuracies in map building.

edit flag offensive delete link more


what errors did you get? I would expect the accuracy to decrease - less data points - but Hector SLAM will work with XTION - although from experience it's don't like swift angle changes too much as it looses track (Can be helped by adding IMU data)

MarkyMark2012 gravatar image MarkyMark2012  ( 2017-02-23 06:34:51 -0500 )edit

I am only using a 2D RPLidar A2 sensor, which might decrease the inaccuracies further. I usually get the common SearchDir angle change too large which then messes up the map building process. It's somewhat similar to what I described in my other question

Rayner gravatar image Rayner  ( 2017-02-23 06:58:32 -0500 )edit

I am also adding a fixed tilt of 20deg to the sensor (which is why I am limiting my sensor to 180deg), but this also worsens the map building process. Tried implementing this but that itself doesn't seem to be working properly

Rayner gravatar image Rayner  ( 2017-02-23 07:07:11 -0500 )edit

Yep you will get "SearchDir angle change too large" if the robot rotates too swiftly and there are not enough data points. My 2D RPLidar A2 works fine, but I haven't restricted it

MarkyMark2012 gravatar image MarkyMark2012  ( 2017-02-23 10:13:52 -0500 )edit

Yup, it works best with no restrictions. Thanks for your help Mark!

Rayner gravatar image Rayner  ( 2017-02-23 11:33:04 -0500 )edit

I wondered what that error message meant

burf2000 gravatar image burf2000  ( 2017-02-25 14:15:53 -0500 )edit

answered 2017-02-24 00:15:19 -0500

gvdhoorn gravatar image

updated 2017-02-24 00:16:19 -0500

It looks like it's not documented on the laser_pipeline and laser_filters pages, but laser_filters actually contains a LaserScanAngularBoundsFilter which seems to do exactly what you are after (from here):

This is a filter that removes points in a laser scan outside of certain angular bounds.

It shouldn't be too hard to set this up. See #q61538 for a related Q&A.

edit flag offensive delete link more


Nice find! :)

MarkyMark2012 gravatar image MarkyMark2012  ( 2017-02-24 03:25:12 -0500 )edit

Yup I used that filter prior to directly tweaking Hector Slam. I posted a question regarding that filter and the error I got. Soon realized that tweaking hector mapping directly also gave similar errors. Guess it's a limitation of hector mapping.

Rayner gravatar image Rayner  ( 2017-02-24 07:15:01 -0500 )edit

@Rayner: I don't really mind, but could you please include some notes on the approaches that you've already tried in your question text? That would avoid posters spending time on something you've alreay tried.

gvdhoorn gravatar image gvdhoorn  ( 2017-02-25 04:07:55 -0500 )edit

So are you saying this does not work for hector slam

burf2000 gravatar image burf2000  ( 2017-02-25 14:13:48 -0500 )edit

There is also LaserScanAngularBoundsFilterInPlace to remove an arbitrary chuck, instead of changing the start and stop angles:

kmhallen gravatar image kmhallen  ( 2017-02-25 18:23:50 -0500 )edit

@burf2000 It limits the performance of Hector SLAM. A 180deg range still works quite well provided the sensor is level and the robot moves and rotates slowly

Rayner gravatar image Rayner  ( 2017-02-26 22:06:04 -0500 )edit

answered 2017-02-20 08:34:32 -0500

MarkyMark2012 gravatar image


I can't see how you would this from the existing parameters. I think you could easily hack something like , or to read and or republish laser messages when they're within the desired window angle of measurement.


Or indeed hack HectorSlam just to process laser range measurements when they're of interest

edit flag offensive delete link more


Any idea how to use the topic_tools relay for this purpose? It looks quite promising but I have no clue how to go about doing it

Rayner gravatar image Rayner  ( 2017-02-21 00:06:53 -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: 2017-02-20 05:29:00 -0500

Seen: 2,098 times

Last updated: Feb 24 '17