Rosanswers logo

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!

Originally posted by AsifA on ROS Answers with karma: 231 on 2014-08-02

Post score: 1


1 Answer 1


Rosanswers logo

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.

Originally posted by bvbdort with karma: 3034 on 2014-08-03

This answer was ACCEPTED on the original site

Post score: 2

Original comments

Comment by AsifA on 2014-08-03:
Thanks bvbdort :)

Comment by spacewandererer on 2018-05-16:
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.

Comment by PKGosal on 2020-07-19:
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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.