Ask Your Question

Bad map on rviz using gmapping

asked 2017-04-23 06:29:55 -0600

Pandacool gravatar image


I'm quite new with ROS and it's been a few weeks that I'm actually facing a problem I can't manage to solve. I'm trying to creta a map from a robot's sensors data and visualize it on rviz, so nothing especially exotic.

As it is for test purpose, I simulate the robot on my computer. The data seem correct as well as the tf tree. However, when I try to see the result on rviz I get something wrong. The test map is actually a simple straigth corridor and the robot is just moving forward until the end. What I get on rviz is not so far from the actual map but there are holes between the segment, just like if it creates the map only at each new square of the grid. I unfortunately can't post pictures for now (I need 5 points or something ?)

I've read tons of topics on the subjects but I did not find anything that helped me solving this problem. If feel rather desperate about it.

If anyone can see what goes wrong, you would help me a lot !

Thank you.

edit retag flag offensive close merge delete


Is your map just a blank corridor? No doors or any obstacles? Such a map lacks enough features for good localisation and map building, which may explain what you're seeing. It's hard to tell without pictures or seeing your source. Can you post your launch files, map, etc.?. Use dropbox or something.

Geoff gravatar image Geoff  ( 2017-04-23 20:57:39 -0600 )edit

Thank you for answer. It is actually a blank corridor with nothing else than the walls and the ground. Here is a screenshot of rviz. As you can see, the odometry ans the display of the map seem correct but there are those "holes".

Pandacool gravatar image Pandacool  ( 2017-04-24 16:17:34 -0600 )edit

The map looks very odd. Can you post your source files so we can test it out?

Geoff gravatar image Geoff  ( 2017-04-24 19:40:35 -0600 )edit

Unfortunately, we use a locally developped simulator to simulate the robot so you won't be able to use most of the code. Here is a part of the ros related code, concerning the messages sent trough ros.

Pandacool gravatar image Pandacool  ( 2017-04-25 16:17:09 -0600 )edit

I think that if the error comes from the code, it can only comes from this part. The tf transform works and is correct (I can add it if you need) and the messages are sent to ros without any error. Also, concerning odometry, the simulator cannot simulate it yet so I just made it simply move forward.

Pandacool gravatar image Pandacool  ( 2017-04-25 16:19:48 -0600 )edit

I thought maybe the problem comes from odometry but it looks fine on rviz so I don't know wath goes wrong. I checked the values of my sensors and they seem correct (near 0 on the sides because of the walls and 1 in front and in the back)

Pandacool gravatar image Pandacool  ( 2017-04-25 16:23:18 -0600 )edit

Since you can't post the simulator, can you instead record a bag file of all topics and post that? Also, we need to see your full source, not extracts, so that people can try to replicate your problem.

Geoff gravatar image Geoff  ( 2017-04-26 01:51:21 -0600 )edit

Sorry for the delay. Here is the code and here is the bag file

Pandacool gravatar image Pandacool  ( 2017-04-27 16:18:32 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2017-05-21 03:09:54 -0600

Pandacool gravatar image

updated 2017-05-30 01:49:00 -0600


I'm still stuck with this problem. I found out that if I specify _linearUpdate:=0.5 when running gmapping the result is slightly better but there are still holes and if I ty to set some lower values like 0.3 or something it does not work anymore. I really don't understand why rviz obstinate itself to show the update every meter (or half-meter with 0.5) which is what produces holes because my robot is very small.

If anyone has an idea, don't hesitate.

EDIT: ok so I tested with a fake robot that just produces the data I want (to simulate a robot moving at constant speed in the straight corridor) and there is still this gap problem. So as the code is the same as in the tutorials and I produce myself the data, I guess there is a problem with gmapping options. Is there something to force the update like in real time ?

EDIT 2: ok I found what was wrong, the scans were either very good or very bad, I ran gmapping with minimumScore = 50 and everything worked fine

edit flag offensive delete link more


Can you provide a video?

Humpelstilzchen gravatar image Humpelstilzchen  ( 2017-05-21 08:29:09 -0600 )edit

Your are right. GMapping is only updating the map when you drive a minimum distance specified by the parameter linearUpdate (float, default: 1.0) Process a scan each time the robot translates this far

What happens actually when you set it lower than 0.3? What doesnt work?

chwimmer gravatar image chwimmer  ( 2017-05-22 07:59:56 -0600 )edit

Here it is the size of the map on rviz corresponds more or less to the size of the map in the simulator if you wonder about that.

Pandacool gravatar image Pandacool  ( 2017-05-22 12:43:48 -0600 )edit

if I try to set the parameter to 0.3 only the first scan appears on rviz then nothing else

Pandacool gravatar image Pandacool  ( 2017-05-22 12:44:45 -0600 )edit

actually to be more precise, when I try with 0.1 for example, it seems that all scans are printed on top of each other on rviz so it is completely mixed up

Pandacool gravatar image Pandacool  ( 2017-05-23 14:21:42 -0600 )edit

answered 2017-04-27 19:59:19 -0600

Geoff gravatar image

The laser scan data in the bag file that you posted never changes. Every message contains exactly the same ranges and intensities. You need to figure out why your laser data is not updating and fix that. Since you say that you are using a locally developed simulator, this suggests that there is a bug in the simulator.

edit flag offensive delete link more


Actually it seems correct. As I said, it's just a blank corridor and the robot just move forward so the dat should not change much. Here is another bag file where I made the robot move at random directions data here should change

Pandacool gravatar image Pandacool  ( 2017-04-28 01:51:19 -0600 )edit

You're correct, the data is changing, so clearly my answer is wrong.

Geoff gravatar image Geoff  ( 2017-04-28 02:58:16 -0600 )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: 2017-04-23 06:29:55 -0600

Seen: 720 times

Last updated: May 30 '17