laser_segmentation package from laser_segmentation repo


Package Summary

Tags No category tags.
Version 3.0.0
License Apache-2.0
Build type AMENT_CMAKE

Repository Summary

Checkout URI
VCS Type git
VCS Version humble
Last Updated 2024-03-22
CI status No Continuous Integration
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Package Description

Implementation of algorithms for segmentation of laserscans.

Additional Links

No additional links.


  • Alberto J. Tudela Roldán
  • Manuel Fernandez-Carmona


  • Alberto J. Tudela Roldán


ROS2 License Build codecov


Implementation of differents algorithms for segmentation of laserscans, splitting them into subsets of beams, with a ROS2 interface. The currently implemented algorithm are:

  • Jump distance clustering: widely used method for 2D laser range data in mobile robotics. It's a simple and fast method to segment the scans: if the Euclidean distance between two adjacent beams exceeds a given threshold distance, a new segment is generated.
  • Jump distance clustering and merge: Similar algorithm as above but checks if pre-predecessor segments are close to each other. This deals with over-segmented data with many small cluster in outdoor environment. It uses the same threshold condition twice.

In the two implementation mentioned above the jump distance threshold is fixed. However, a dynamic jump distance threshold can be calculated using methods of Lee (Lee, 2001), Dietmayer (Dietmayer, et al., 2001) and Santos (Santos, et al., 2003). See the parameters list below to change between them.

Includes a dynamic reconfigure server parameter to change online the configuration of the algorithms and the filtering.

Laser scan Segments
LaserScan Segments

Keywords: ROS2, laser, segmentation, clustering

Author: Alberto Tudela

The laser_segmentation package has been tested under ROS2 Humble on Ubuntu 22.04. This is research code, expect that it changes often and any fitness for a particular purpose is disclaimed.


Building from Source



To build from source, clone the latest version from the main repository into your colcon workspace and compile the package using

cd colcon_workspace/src
git clone -b humble
cd ../
rosdep install -i --from-path src --rosdistro humble -y
colcon build --symlink-install


With some scan source running, run the laser_segmentation node with: ros2 launch laser_segmentation



Segmentation of the laserscans.

Subscribed Topics

Published Topics

  • segments (slg_msgs/SegmentArray)

    Splitted segments resulting of the segmentation.

  • segments/visualization (visualization_msgs/MarkerArray)

    It comprises three namespaces:

    • "segments": 3d markers of the segments for showing the segments in Rviz2.
    • "segments_names": 3d markers with the id of the segments.
    • "centroids": 3d markers of the segment centroids in Rviz2.


  • scan_topic (string, default: "scan")

    Topic of the laserscan.

  • segment_topic (string, default: "segments")

    Topic of the segmented laser scan.

  • segmentation_type (string, default: "jump_distance")

    Choose between several segmentation algorithms. Jump distance clustering (jump_distance) and jump distance and merge (jump_distance_merge).

Parameters for filtering

  • min_points_segment (int, default: 3)

    Minimium number of points per segment.

  • max_points_segment (int, default: 200)

    Maximum number of points per segment.

  • min_avg_distance_from_sensor (double, default: 0.0)

    Minimium average distance from sensor.

  • max_avg_distance_from_sensor (double, default: 20.0)

    Maximum average distance from sensor.

  • min_segment_width (double, default: 0.2)

    Minimium width of the segment.

  • max_segment_width (double, default: 10.0)

    Maximum width of the segment.

Parameters for segmentation algorithms

  • method_threshold (string, default: "")

    Method to calculate a dynamic jump distance threshold in jump_distance or jump_distance_merge algorithms. This value and methods are based on lee (Lee, 2001), diet (Dietmayer, et al., 2001) or santos (Santos, et al., 2003).

  • distance_threshold (double, default: 0.3)

    If none of the algorithms mentioned above is selected, this parameters will be use as the jump distance above which a new segment is created.

  • noise_reduction (double, default: 0.3)

    Parameter for noise reduction in "Santos" and "Dietmayer" algorithms.


Changelog for package laser_segmentation

3.0.0 (08-03-2024)

  • Improve formatting.
  • Improve documentation of source.
  • Converted to Lifecycle node.
  • Converted to component.
  • Rename header and source files.
  • Move parameters to new class: parameterHandler.
  • Rename show_visualization to create_segment_viz_points.
  • Fix jump distance merge.
  • Add unit testing.

2.1.2 (23-06-2023)

  • Rename visualization topic.

2.1.1 (29-11-2022)

  • Add hierarchy between segmentationJumpDistance and segmentationJumpDistanceMerge to avoid code redundancy.
  • Rise up centroids visualization.

2.1.0 (28-11-2022)

  • Added include to find slg_msgs library.
  • Added launch with some non-default param values.
  • Minor changes to configuration info display.
  • Added params folder with two yaml config files.
  • Launch file now relies on config files, it is its only argument.
  • Minor changes to range values in laser_segmentation paramas to accept smaller granularity.
  • Added rviz CUBE marker with segment centroids.
  • Reunited all markers into a single topic, using three namespaces.
  • Added license.

2.0.0 (15-10-2022)

  • First ROS2 (Humble) version.
  • Contributors: Manuel Fernandez-Carmona

1.2.1 (20-10-2022)

  • Rename segment_topic to segments_topic.

1.2.0 (03-05-2022)

  • Added noise reduction parameter.
  • Push a delete marker before the others. I hope this fix the RViz problem.

1.1.3 (13-01-2022)

  • Refactoring jump distance and jump distance merge.
  • Added jump between points with NaN values.
  • Fix merge of first and last segments.

1.1.2 (12-01-2022)

  • Update simple_laser_geometry to 3.2.0.
  • Checking of NaN points.
  • Change lifetime of markers.

1.1.1 (23-12-2021)

  • Check publisher before doing any calculations.

1.1.0 (15-12-2021)

  • Change segment marker to markerArray.
  • Publish id of the segment as markerArray.
  • Change the color palette.
  • Fix jump distance merge.

1.0.1 (15-12-2021)

  • Update simple_laser_geometry to 3.0.0.

1.0.0 (14-12-2021)

  • Changes to new simple laser geometry library.
  • Add max width filter.
  • Remove readDataPoints.
  • Added option to select threshold method.
  • Update dynamic jump distance methods.
  • Improve jump distance merge.

0.0.0 (-)

  • Initial release.
  • Create
  • Added laserSegmentation class (.h and .cpp files).
  • Added segmentationJumpDistance class (.h and .cpp files).
  • Added segmentationJumpDistanceMerge class (.h and .cpp files).
  • Added SegmentationParameters.cfg configuration files.
  • Added launch files.
  • Contributors: Alberto Tudela

Wiki Tutorials

See ROS Wiki Tutorials for more details.

Source Tutorials

Not currently indexed.

Launch files

No launch files found


No message files found.


No service files found


No plugins found.

Recent questions tagged laser_segmentation at Robotics Stack Exchange