lama-imr / lama_utilities

Common functionalities used by the Large Maps Framework (LaMa)
16 stars 6 forks source link

Segmentation Fault with local_map #3

Closed RiYoX closed 9 years ago

RiYoX commented 9 years ago

Hi, I'm using local_map in order to create an occupancy grid from laser data provided by a SICK LMS 511 10100 Laser Scanner. First, I tried to run it using a bag that I got from this page : http://wiki.ros.org/slam_gmapping/Tutorials/MappingFromLoggedData#download and it runs amazingly. Then, I launched my LMS node dowloaded from : https://github.com/rhuitl/laser_drivers/tree/master/sicktoolbox_wrapper2 but it doesn't work ; I got a "segmentation fault (core dumped)" (see attached image).

I tried to understand where the error comes from and I found out that the loop located on line 336 in map_builder.cpp doesn't work correctly. It seems that something wrong is happening between line 341 and 347 : if (obstacle_in_map) { // The last point is the point with obstacle. const size_t last_pt = pts.back(); updatePointOccupancy(true, lastpt, map.data, logodds); pts.pop_back(); } When I commented these lines, the segmentation fault disappears and of course, the camputed map does not represented correctly the environment.

Do you have any idea how to fix this issue and where it comes from ? Thanks. screenshot-1

galou commented 9 years ago

Can you provide us a bag file that reproduces the error?

On which architecture (32 or 64 bit) are you running the nodes?

RiYoX commented 9 years ago

Hi @galou , Thank you for your rapid response.

You can find in the following link a bag file with two topics : /scan and /tf : http://www.mediafire.com/download/1qamqfujs8rgo5g/Scan-and-tf.bag

I run the nodes on a i5 processor with Ubuntu 12.04 LTS 64 bits and I'm using ROS Hydro

RiYoX commented 9 years ago

Hi @galou I did some experiments on the code and I found out that the issue comes from line 346 : pts.pop_back(); In fact, when I removed this line and initialized the "pts" vector with a large enough size, it works perfectly. Do you have an idea where the problem comes form ?

Thanks.

galou commented 9 years ago

Thank you for providing the bag file! The problem came from 0-length ranges and is fixed with e942a41a5b7eabf2defebca03e1f6e02c5592b78.