├── media
└── demo_01.gif
├── cfg
└── ri_dbscan.cfg
├── CHANGELOG.rst
├── launch
├── run_rviz.launch
└── run.launch
├── CMakeLists.txt
├── package.xml
├── README.md
├── include
├── ri_dbscan.h
├── tools
│ └── utils.hpp
└── ground_truth.hpp
├── rviz
└── ri_dbscan.rviz
└── src
└── ri_dbscan.cpp
/media/demo_01.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HMX2013/FSPC-ROS/HEAD/media/demo_01.gif
--------------------------------------------------------------------------------
/cfg/ri_dbscan.cfg:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | PACKAGE = "ri_dbscan"
4 |
5 | from dynamic_reconfigure.parameter_generator_catkin import *
6 |
7 | gen = ParameterGenerator()
8 |
9 | gen.add("detect_min", double_t, 0, "Default: 0.1", 0.1, 0, 2)
10 | gen.add("detect_max", double_t, 0, "Default: 10", 10, 2, 40)
11 |
12 | gen.add("cvc_coef", double_t, 0, "Default: 1.0", 1.0, 1, 3)
13 |
14 | gen.add("MinClusterSize", int_t, 0, "Default: 20", 20, 10, 100)
15 | gen.add("MaxClusterSize", int_t, 0, "Default: 1000", 10000, 20, 10000)
16 |
17 | exit(gen.generate(PACKAGE, "ri_dbscan", "ri_dbscan_"))
--------------------------------------------------------------------------------
/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package range image
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | ->(2022-04-26)
6 | -------------------
7 | * [fix] Deal with Nanvalid point issue
8 | * The output of ROS_INFO will slow the speed of algorithm greatly.
9 |
10 | ->(2022-04-27)
11 | -------------------
12 | * [fix] Deal with Nanvalid point issue
13 | * Fix the Nanvalid point effect
14 | * consider the Nanvalid point in vertical direction
15 |
16 | ->(2022-06-15)
17 | -------------------
18 | * combine the dbscan algorithnm with range image search method to overcome over-segmentation
19 |
20 | ->(2022-06-16)
21 | -------------------
22 | *
--------------------------------------------------------------------------------
/launch/run_rviz.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/launch/run.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0.2)
2 | project(ri_dbscan)
3 |
4 | add_compile_options(-std=c++17)
5 | set(CMAKE_BUILD_TYPE "Release")
6 |
7 | set(CMAKE_CXX_STANDARD 14)
8 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
9 | set(CMAKE_CXX_EXTENSIONS OFF)
10 |
11 | find_package(catkin REQUIRED COMPONENTS
12 | roscpp
13 | rospy
14 | std_msgs
15 | pcl_ros
16 | tf2_ros
17 | tf2_geometry_msgs
18 | dynamic_reconfigure
19 | jsk_recognition_msgs
20 | )
21 |
22 | find_package(OpenCV REQUIRED)
23 | find_package(PCL 1.8.1 REQUIRED)
24 |
25 | set(CMAKE_CXX_FLAGS "-O2 -Wall ${CMAKE_CXX_FLAGS}")
26 |
27 | generate_dynamic_reconfigure_options(
28 | cfg/ri_dbscan.cfg
29 | )
30 |
31 | catkin_package(
32 | INCLUDE_DIRS include
33 | LIBRARIES ri_dbscan
34 | CATKIN_DEPENDS roscpp std_msgs
35 | DEPENDS system_lib
36 | )
37 |
38 | include_directories(
39 | include
40 | ${catkin_INCLUDE_DIRS}
41 | ${dynamic_reconfigure_PACKAGE_PATH}/cmake/cfgbuild.cmake
42 | ${OpenCV_INCLUDE_DIRS}
43 | )
44 |
45 | link_directories(${OpenCV_LIBRARY_DIRS})
46 |
47 | add_executable(ri_dbscan_node
48 | src/ri_dbscan.cpp
49 | )
50 |
51 | add_dependencies(ri_dbscan_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
52 |
53 | target_link_libraries(ri_dbscan_node
54 | ${OpenCV_LIBRARIES}
55 | ${catkin_LIBRARIES}
56 | )
--------------------------------------------------------------------------------
/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ri_dbscan
4 | 1.0.0
5 | The ri_dbscan package
6 | hmx
7 | MIT
8 |
9 | catkin
10 | roscpp
11 | rospy
12 | std_msgs
13 | pcl_ros
14 | tf2_ros
15 | tf2_geometry_msgs
16 | dynamic_reconfigure
17 | jsk_recognition_msgs
18 |
19 | roscpp
20 | rospy
21 | std_msgs
22 | pcl_ros
23 | tf2_ros
24 | tf2_geometry_msgs
25 | dynamic_reconfigure
26 | jsk_recognition_msgs
27 |
28 |
29 | roscpp
30 | rospy
31 | std_msgs
32 | pcl_ros
33 | tf2_ros
34 | tf2_geometry_msgs
35 | dynamic_reconfigure
36 | autoware_msgs
37 | jsk_recognition_msgs
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Fast range image based DBSCAN clustering for 3D LiDAR Point Clouds
2 | An ROS implementation of dbscan clustering of 3D LiDAR point clouds
3 |
4 | 
5 | 
6 | 
7 |
8 | 
9 |
10 |
11 | ## Reference
12 | * Chen, Zhihui, et al. "Fast-spherical-projection-based point cloud clustering algorithm." Transportation research record 2676.6 (2022): 315-329.
13 |
14 |
15 | ## Features
16 | * Faster comparing to traditional dbscan algorithm
17 |
18 | **TODOs**
19 | * imporove the segmentation accuracy
20 |
21 |
22 | ## Dependencies
23 | * semantic_kitti_loader
24 | * obsdet_msgs
25 |
26 | ## How to use
27 | # clone the repo
28 | mkdir -p catkin_ws/src
29 | cd catkin_ws/src
30 | git clone https://github.com/HMX2013/SemanticKITTI_loader
31 | git clone https://github.com/HMX2013/FSPC-ROS
32 | download obsdet_msgs from
33 | "https://drive.google.com/file/d/1ztLk9Slm656CV-WJieUpBJPlz-Iw14Bk/view?usp=share_link"
34 | cd ../
35 | catkin_make
36 |
37 | roslaunch ri_dbscan run_rviz.launch
38 | roslaunch semantic_kitti run_semantic.launch
39 |
40 | ## Contribution
41 | You are welcome contributing to the package by opening a pull-request
42 |
43 | We are following:
44 | [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html),
45 | [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#main),
46 | and [ROS C++ Style Guide](http://wiki.ros.org/CppStyleGuide)
47 |
48 | ## License
49 | MIT License
50 |
--------------------------------------------------------------------------------
/include/ri_dbscan.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 | #include
10 |
11 | #include
12 | #include
13 |
14 | #include
15 | #include
16 |
17 | #include
18 | #include
19 | #include
20 |
21 | #include
22 |
23 | #if (CV_MAJOR_VERSION == 3)
24 | #include
25 | #else
26 | #include
27 | #endif
28 |
29 | #include
30 | #include
31 | #include
32 | #include
33 |
34 | #include "obsdet_msgs/CloudCluster.h"
35 | #include "obsdet_msgs/CloudClusterArray.h"
36 |
37 | #include
38 |
39 | #include "ground_truth.hpp"
40 |
41 | #define __APP_NAME__ "ri_dbscan"
42 |
43 | using PointType = PointXYZILID;
44 |
45 |
46 | std::string output_frame_;
47 | std::string non_ground_cloud_topic_;
48 | std::string segmented_cloud_topic_;
49 | std::string cluster_cloud_topic_;
50 | std::string colored_cloud_topic_;
51 | std::string cluster_cloud_trans_topic_;
52 | std::string output_cluster_array_topic_;
53 | std::string output_roi_topic_;
54 | std_msgs::Header ros_header;
55 |
56 | // Pointcloud Filtering Parameters
57 | float DETECT_MIN, DETECT_MAX;
58 |
59 | int CLUSTER_MAX_SIZE, CLUSTER_MIN_SIZE, MinClusterSize, MaxClusterSize;
60 | float cvc_coef;
61 |
62 | tf::TransformListener *_transform_listener;
63 | tf::StampedTransform *_transform;
64 |
65 | boost::shared_ptr> gt_verify;
66 |
67 |
68 | static ros::Publisher time_rviz_pub_;
69 | static std_msgs::Float32 time_rviz;
70 | // static double exe_time = 0.0;
--------------------------------------------------------------------------------
/rviz/ri_dbscan.rviz:
--------------------------------------------------------------------------------
1 | Panels:
2 | - Class: rviz/Displays
3 | Help Height: 85
4 | Name: Displays
5 | Property Tree Widget:
6 | Expanded:
7 | - /Global Options1
8 | - /Status1
9 | - /ground_pc1
10 | Splitter Ratio: 0.6452174186706543
11 | Tree Height: 1002
12 | - Class: rviz/Selection
13 | Name: Selection
14 | - Class: rviz/Tool Properties
15 | Expanded:
16 | - /2D Pose Estimate1
17 | - /2D Nav Goal1
18 | - /Publish Point1
19 | Name: Tool Properties
20 | Splitter Ratio: 0.5886790156364441
21 | - Class: rviz/Views
22 | Expanded:
23 | - /Current View1
24 | Name: Views
25 | Splitter Ratio: 0.5
26 | - Class: rviz/Time
27 | Name: Time
28 | SyncMode: 0
29 | SyncSource: segmented_color
30 | Preferences:
31 | PromptSaveOnExit: true
32 | Toolbars:
33 | toolButtonStyle: 2
34 | Visualization Manager:
35 | Class: ""
36 | Displays:
37 | - Alpha: 0.5
38 | Cell Size: 1
39 | Class: rviz/Grid
40 | Color: 160; 160; 164
41 | Enabled: false
42 | Line Style:
43 | Line Width: 0.029999999329447746
44 | Value: Lines
45 | Name: Grid
46 | Normal Cell Count: 0
47 | Offset:
48 | X: 0
49 | Y: 0
50 | Z: 0
51 | Plane: XY
52 | Plane Cell Count: 10
53 | Reference Frame:
54 | Value: false
55 | - Class: rviz/TF
56 | Enabled: true
57 | Frame Timeout: 15
58 | Frames:
59 | All Enabled: true
60 | Marker Alpha: 1
61 | Marker Scale: 1
62 | Name: TF
63 | Show Arrows: true
64 | Show Axes: true
65 | Show Names: true
66 | Tree:
67 | {}
68 | Update Interval: 0
69 | Value: true
70 | - Alpha: 1
71 | Autocompute Intensity Bounds: true
72 | Autocompute Value Bounds:
73 | Max Value: 10
74 | Min Value: -10
75 | Value: true
76 | Axis: Z
77 | Channel Name: intensity
78 | Class: rviz/PointCloud2
79 | Color: 238; 238; 236
80 | Color Transformer: FlatColor
81 | Decay Time: 0
82 | Enabled: true
83 | Invert Rainbow: false
84 | Max Color: 255; 255; 255
85 | Min Color: 0; 0; 0
86 | Name: ground_pc
87 | Position Transformer: XYZ
88 | Queue Size: 10
89 | Selectable: true
90 | Size (Pixels): 3
91 | Size (m): 0.009999999776482582
92 | Style: Flat Squares
93 | Topic: /semi_kitti/ground_pc
94 | Unreliable: false
95 | Use Fixed Frame: true
96 | Use rainbow: true
97 | Value: true
98 | - Alpha: 1
99 | Autocompute Intensity Bounds: true
100 | Autocompute Value Bounds:
101 | Max Value: 10
102 | Min Value: -10
103 | Value: true
104 | Axis: Z
105 | Channel Name: intensity
106 | Class: rviz/PointCloud2
107 | Color: 255; 255; 255
108 | Color Transformer: FlatColor
109 | Decay Time: 0
110 | Enabled: false
111 | Invert Rainbow: false
112 | Max Color: 255; 255; 255
113 | Min Color: 0; 0; 0
114 | Name: map_cloud
115 | Position Transformer: XYZ
116 | Queue Size: 9
117 | Selectable: true
118 | Size (Pixels): 3
119 | Size (m): 0.029999999329447746
120 | Style: Flat Squares
121 | Topic: /laser_cloud_surround
122 | Unreliable: false
123 | Use Fixed Frame: true
124 | Use rainbow: true
125 | Value: false
126 | - Alpha: 1
127 | Autocompute Intensity Bounds: true
128 | Autocompute Value Bounds:
129 | Max Value: 10
130 | Min Value: -10
131 | Value: true
132 | Axis: Z
133 | Channel Name: intensity
134 | Class: rviz/PointCloud2
135 | Color: 255; 255; 255
136 | Color Transformer: Intensity
137 | Decay Time: 0
138 | Enabled: true
139 | Invert Rainbow: false
140 | Max Color: 255; 255; 255
141 | Min Color: 0; 0; 0
142 | Name: segmented_color
143 | Position Transformer: XYZ
144 | Queue Size: 10
145 | Selectable: true
146 | Size (Pixels): 3
147 | Size (m): 0.029999999329447746
148 | Style: Flat Squares
149 | Topic: /clustering/colored_cluster
150 | Unreliable: false
151 | Use Fixed Frame: true
152 | Use rainbow: true
153 | Value: true
154 | - Class: jsk_rviz_plugin/BoundingBoxArray
155 | Enabled: false
156 | Name: BoundingBoxArray
157 | Queue Size: 10
158 | Topic: /pca_fitting/jsk_bboxs_array
159 | Unreliable: false
160 | Value: false
161 | alpha: 0.800000011920929
162 | color: 25; 255; 0
163 | coloring: Auto
164 | line width: 0.029999999329447746
165 | only edge: true
166 | show coords: false
167 | - Buffer length: 100
168 | Class: jsk_rviz_plugin/Plotter2D
169 | Enabled: true
170 | Name: "FSPC took: [ms]"
171 | Show Value: true
172 | Topic: /clustering/time_rviz
173 | Value: true
174 | auto color change: false
175 | auto scale: true
176 | background color: 0; 0; 0
177 | backround alpha: 0
178 | border: true
179 | foreground alpha: 0.699999988079071
180 | foreground color: 25; 255; 240
181 | height: 100
182 | left: 60
183 | linewidth: 1
184 | max color: 255; 0; 0
185 | max value: 1
186 | min value: -1
187 | show caption: true
188 | text size: 12
189 | top: 80
190 | update interval: 0.03999999910593033
191 | width: 128
192 | Enabled: true
193 | Global Options:
194 | Background Color: 0; 0; 0
195 | Default Light: true
196 | Fixed Frame: map
197 | Frame Rate: 30
198 | Name: root
199 | Tools:
200 | - Class: rviz/Interact
201 | Hide Inactive Objects: true
202 | - Class: rviz/MoveCamera
203 | - Class: rviz/Select
204 | - Class: rviz/FocusCamera
205 | - Class: rviz/Measure
206 | - Class: rviz/SetInitialPose
207 | Theta std deviation: 0.2617993950843811
208 | Topic: /initialpose
209 | X std deviation: 0.5
210 | Y std deviation: 0.5
211 | - Class: rviz/SetGoal
212 | Topic: /move_base_simple/goal
213 | - Class: rviz/PublishPoint
214 | Single click: true
215 | Topic: /clicked_point
216 | Value: true
217 | Views:
218 | Current:
219 | Class: rviz/Orbit
220 | Distance: 41.01285171508789
221 | Enable Stereo Rendering:
222 | Stereo Eye Separation: 0.05999999865889549
223 | Stereo Focal Distance: 1
224 | Swap Stereo Eyes: false
225 | Value: false
226 | Field of View: 0.7853981852531433
227 | Focal Point:
228 | X: -7.163553237915039
229 | Y: -3.35589337348938
230 | Z: -1.4942269325256348
231 | Focal Shape Fixed Size: false
232 | Focal Shape Size: 0.05000000074505806
233 | Invert Z Axis: false
234 | Name: Current View
235 | Near Clip Distance: 0.009999999776482582
236 | Pitch: 0.6147976517677307
237 | Target Frame:
238 | Yaw: 3.115260124206543
239 | Saved: ~
240 | Window Geometry:
241 | Displays:
242 | collapsed: false
243 | Height: 1308
244 | Hide Left Dock: false
245 | Hide Right Dock: true
246 | QMainWindow State: 000000ff00000000fd0000000400000000000001560000047cfc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d0000047c000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000004c9fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003d000004c9000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000009b600000040fc0100000002fb0000000800540069006d00650100000000000009b6000003bc00fffffffb0000000800540069006d006501000000000000045000000000000000000000085a0000047c00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
247 | Selection:
248 | collapsed: false
249 | Time:
250 | collapsed: false
251 | Tool Properties:
252 | collapsed: false
253 | Views:
254 | collapsed: true
255 | Width: 2486
256 | X: 72
257 | Y: 27
258 |
--------------------------------------------------------------------------------
/include/tools/utils.hpp:
--------------------------------------------------------------------------------
1 | #ifndef COMMON_H
2 | #define COMMON_H
3 |
4 | #include "math.h"
5 | #include
6 | #include
7 | #include