Ask Your Question

gmapping not working for LaserScan obtained from but_velodyne_proc

asked 2014-08-02 21:14:04 -0500

AsifA gravatar image

updated 2014-08-02 21:15:28 -0500

Hi, I am using but_velodyne_proc package to obtain 2d laser scan sensor_msgs/LaserScan from a 3d Velodyne sensor_msgs/PointCloud2. It seems that it works fine because I can visualize laser scan and point cloud in rviz. However, problem arises when I try to use this 360 degree laser scan data with gmapping to obtain a 2d occupancy map using:

rosrun gmapping slam_gmapping scan:=/velodyne/scan

It gives me following error:

slam_gmapping: /tmp/buildd/ros-hydro-openslam-gmapping-0.1.0-2precise-20140617-1746/scanmatcher/scanmatcher.cpp:563: void GMapping::ScanMatcher::setLaserParameters(unsigned int, double*, const OrientedPoint&): Assertion `beams<2048' failed. Aborted (core dumped)

The error of "beam 2048" is coming from here. Gmapping is working fine when I am using LaserScan from the lidar installed on my robot. Do you think this is because I am feeding 360 degree scan? I can see that scan header of the lidar is coming with angle_min: -2.35619449615 angle_max: 2.35619449615, whereas header of LaserScan obtained from Velodyne is angle_min: -3.14159274101 angle_max: 3.14159274101. I am very beginner with all this stuff and do not understand the meaning of "LASER_MAXBEAMS 2048" defined in the header file. Your guideline to fix this problem is much appreciated!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-08-03 09:33:54 -0500

bvbdort gravatar image

scanmatcher in gmapping is limiting number of beams to 2048

For your case

angle_min: -2.35619449615 angle_max: 2.35619449615

which is ~ 269 degrees and from launch file

 <param name="angular_res" value="0.1" />

it counts 2690 > 2048.

Change resolution to 0.2 or 0.5 so that number of beams becomes < 2048.

edit flag offensive delete link more


Thanks bvbdort :)

AsifA gravatar image AsifA  ( 2014-08-03 11:47:42 -0500 )edit

Thanks bvbdort ! This worked. Also, thanks AsifA, I was using pointcloud_to_laserscan package earlier but it wasn't working for me. But this package works.

spacewandererer gravatar image spacewandererer  ( 2018-05-16 02:20:06 -0500 )edit

Thank you so much! After spending more than 10 hours on troubleshooting, this was what I needed to address on my side too. Thanks again.

PKGosal gravatar image PKGosal  ( 2020-07-19 11:59:39 -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: 2014-08-02 21:14:04 -0500

Seen: 1,583 times

Last updated: Aug 03 '14