# Why RPLidar + gmapping has a bad result?

Now I have a turtlebot 2, and I want to build a map. As gmapping needs odometry, so I think it would have a better result than hector_mapping. As RPLidar has 360 degree while kinect has only 57 degree, so while gmapping, I think RPLidar would has a better result.

However, to my disappointment, the map builded by RPLidar is too bad!

I found that the map builded by rplidar + hector_mapping is really good.

But I really want to know why RPLidar + gmapping could not have a good result, does anyone know this?

Thank you !!

My bagfile.

The bagfile

edit retag close merge delete

I have the same problem. I'm working to some tests about this, maybe can be useful for you too:

Localization problem with gmapping and RPLidar

( 2015-03-29 10:40:58 -0500 )edit

Thank you very much!!

( 2015-03-29 19:47:32 -0500 )edit

Wow!!!! You are so great!!! Thank you, thank you so much!!!

( 2015-04-01 21:49:36 -0500 )edit

( 2015-04-02 01:03:39 -0500 )edit

Thank you for taking the time to give me a hand. Now I have uploaded the RVIZ picture, in the picture,the red or green lines or points are the laser scan data. I increased the size of the laser size.

Now compared with yours, I think the only difference is the tf transform, let me try again. thanks!

( 2015-04-02 06:41:48 -0500 )edit

I am sorry to have kept you waiting so long. I am a newer to ROS, and I have just learned how to use the rosbag. I upload the bagfile to my network disk. The bagfile I am sorry that I used a Chinese skydrive. To download the bagfile, click the 下载(4.4M) .

( 2015-04-02 08:58:53 -0500 )edit

Hey Tang, Could you please teach with using rplidar and hector together？

( 2016-06-02 04:14:30 -0500 )edit

I am sorry that I see your question until now, and have you solved your question?

( 2016-07-18 01:29:05 -0500 )edit

Sort by » oldest newest most voted

You will be happy to know that I fixed my problem with gmapping and LPLidar. You can find a full documentation about the fix here (including source code modification of course): I hope can be useful for you too!

## UPDATE

GMapping use two parameters to define laser beam range:

• maxRange: 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;
• maxUrange: the maximum usable range of the laser. A beam is cropped to this value.

(Description taken by ros gmapping wiki)

The long lines you see on your map are created when the laser measured range is between maxUrange and maxRange. You can try to set maxUrange = maxRange. By the way I think the real problem is another: why your laser measures this range if there is a wall?

Can you take a picture of RViz where laser scan data is shown too? I suggest to set decay to 120 secs so we can see more data. I want to check if long lines are really generated by laser measures of if they are artefacts of GMapping.

## UPDATE

Can you register and upload a bag file of your test? Remember to move the robot in your environment recording data in order to have an idea of the expected map. You should record tf and your laser scan topic.

Further question: on the posted RViz screenshot I can see an entry referring AMCL, are you running it too?

## UPDATE

I run some test on your bag data. This the result of odometry test:

Since you are working in large environment (I measured abut 5 meters square room) you can be happy about it! Any way I suggest you to follow this guide (if you already didn't): it will help you not only to improve your robot performances but you can also learn something about navigation stack in ROS.

BTW I ran GMapping with the parameters I suggested and, actually, I reproduced the same problem you claim about (sorry, my environment is not so large so I never experienced it!). Fortunately the solution is easy. Set following parameters:

odom_frame: odom
delta: 0.025
minimumScore: 50
maxRange: 5.5
maxUrange: 5.5
linearUpdate: 0.2
angularUpdate: 0.25
temporalUpdate: 5


I got this result:

Maybe it is not perfect but:

• on my simulation map -> odom transformation came from your bag file instead my GMapping node. When you will run it on your robot result should be better (please post a picture... I'm curios!);
• RPLidar has a great value/price rate but it have short range laser (look here to appreciate more RPLidar value/cost rate!!). This will cause no optimal performance working in large environment. Any way a trick exists in order to have better result: move you robot close to the wall instead cross the centre of your room and you will se that built map ...
more

I am sorry for my disturbing you again, I used all the GMapping parameters just like yours. However, the map has many long lines that over the border. Did you have encountered this problem? I have uploaded the map picture in the question above.

Thank you!

( 2015-04-02 04:09:36 -0500 )edit

I’m sorry to have kept you waiting so long. Now my map is much better! All of this is under your help, Thank you so much！！

( 2015-04-02 20:54:38 -0500 )edit

( 2015-04-03 05:17:58 -0500 )edit