Laser Line Extraction is a Robot Operating System (ROS) package that extracts line segments form LaserScan messages. Created by Marc Gallant, originally for use in the Mining Systems Laboratory. Here is what the Laser Line Extraction package looks like in action:
In the above image, the white dots are points in a LaserScan message, and the red lines are what is extracted by Laser Line Extraction. This data was collected by driving a robot through Beamish-Munro Hall at Queen's University. A SICK LMS111 laser scanner was mounted to the robot. The extraction algorithm is very configurable; the above image used the parameters configured in the
example.launch launch file.
After applying some filters to remove outlying points, Laser Line Extraction implements a split-and-merge algorithm to determine which points belong to lines. Next, it implements the weighted line fitting algorithm by Pfister et al.  to find the best fit lines and their respective covariance matrices.
I recommend making a copy of
example.launch in the launch directory and configuring the parameters until you reach a desirable outcome. The parameters in
example.launch are a good starting point. Then simply use roslaunch, e.g.,
roslaunch laser_line_extraction example.launch
Laser Line Extraction has two messages types:
float32 radius float32 angle float32 covariance float32 start float32 end
radius (m) and
angle (rad) are the polar parameterization of the line segment.
covariance is the 2x2 covariance matrix of
angle (listed in row-major order). Finally
end are the (x, y) coordinates of the start and end of the line segment.
Header header LineSegment line_segments
An array of LineSegment.msg with a header.
Laser Line Extraction subscribes to a single topic and publishes one or two topics.
The parameters are listed in alphabetical order.
least_sq_radius_threshmust also be met).
least_sq_angle_threshmust also be met).
 S. T. Pfister, S. I. Roumeliotis, and J. W. Burdick, "Weighted line fitting algorithms for mobile robot map building and efficient data representation" in Proc. IEEE Intl. Conf. on Robotics and Automation (ICRA), Taipei, Taiwan, 14-19 Sept., 2003.