Skip to content

Commit 9f3e2c8

Browse files
authored
Feature/pre commit (#35)
* Set pre-commit & run * Reflect cpp clang error
1 parent 4b44362 commit 9f3e2c8

28 files changed

Lines changed: 4331 additions & 4053 deletions

.clang-format

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: Google
4+
AccessModifierOffset: -1
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignOperands: true
9+
AlignTrailingComments: true
10+
AllowAllParametersOfDeclarationOnNextLine: false
11+
AllowShortBlocksOnASingleLine: false
12+
AllowShortCaseLabelsOnASingleLine: false
13+
AllowShortFunctionsOnASingleLine: All
14+
AllowShortIfStatementsOnASingleLine: true
15+
AllowShortLoopsOnASingleLine: true
16+
AlwaysBreakAfterDefinitionReturnType: None
17+
AlwaysBreakAfterReturnType: None
18+
AlwaysBreakBeforeMultilineStrings: true
19+
AlwaysBreakTemplateDeclarations: true
20+
BinPackArguments: false
21+
BinPackParameters: false
22+
BraceWrapping:
23+
AfterClass: false
24+
AfterControlStatement: false
25+
AfterEnum: false
26+
AfterFunction: false
27+
AfterNamespace: false
28+
AfterObjCDeclaration: false
29+
AfterStruct: false
30+
AfterUnion: false
31+
BeforeCatch: false
32+
BeforeElse: false
33+
IndentBraces: false
34+
BreakBeforeBinaryOperators: None
35+
BreakBeforeBraces: Attach
36+
BreakBeforeTernaryOperators: true
37+
BreakConstructorInitializersBeforeComma: false
38+
CommentPragmas: "^ IWYU pragma:"
39+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
40+
ConstructorInitializerIndentWidth: 4
41+
ContinuationIndentWidth: 4
42+
Cpp11BracedListStyle: true
43+
DerivePointerAlignment: true
44+
DisableFormat: false
45+
ExperimentalAutoDetectBinPacking: false
46+
ForEachMacros:
47+
- foreach
48+
- Q_FOREACH
49+
- BOOST_FOREACH
50+
IncludeCategories:
51+
# Spacers
52+
- Regex: "^<clang-format-priority-15>$"
53+
Priority: 15
54+
- Regex: "^<clang-format-priority-25>$"
55+
Priority: 25
56+
- Regex: "^<clang-format-priority-35>$"
57+
Priority: 35
58+
- Regex: "^<clang-format-priority-45>$"
59+
Priority: 45
60+
# C system headers
61+
- Regex: '^[<"](aio|arpa/inet|assert|complex|cpio|ctype|curses|dirent|dlfcn|errno|fcntl|fenv|float|fmtmsg|fnmatch|ftw|glob|grp|iconv|inttypes|iso646|langinfo|libgen|limits|locale|math|monetary|mqueue|ndbm|netdb|net/if|netinet/in|netinet/tcp|nl_types|poll|pthread|pwd|regex|sched|search|semaphore|setjmp|signal|spawn|stdalign|stdarg|stdatomic|stdbool|stddef|stdint|stdio|stdlib|stdnoreturn|string|strings|stropts|sys/ipc|syslog|sys/mman|sys/msg|sys/resource|sys/select|sys/sem|sys/shm|sys/socket|sys/stat|sys/statvfs|sys/time|sys/times|sys/types|sys/uio|sys/un|sys/utsname|sys/wait|tar|term|termios|tgmath|threads|time|trace|uchar|ulimit|uncntrl|unistd|utime|utmpx|wchar|wctype|wordexp)\.h[">]$'
62+
Priority: 10
63+
# C++ system headers
64+
- Regex: '^[<"](algorithm|any|array|atomic|bitset|cassert|ccomplex|cctype|cerrno|cfenv|cfloat|charconv|chrono|cinttypes|ciso646|climits|clocale|cmath|codecvt|complex|condition_variable|csetjmp|csignal|cstdalign|cstdarg|cstdbool|cstddef|cstdint|cstdio|cstdlib|cstring|ctgmath|ctime|cuchar|cwchar|cwctype|deque|exception|execution|filesystem|forward_list|fstream|functional|future|initializer_list|iomanip|ios|iosfwd|iostream|istream|iterator|limits|list|locale|map|memory|memory_resource|mutex|new|numeric|optional|ostream|queue|random|ratio|regex|scoped_allocator|set|shared_mutex|sstream|stack|stdexcept|streambuf|string|string_view|strstream|system_error|thread|tuple|type_traits|typeindex|typeinfo|unordered_map|unordered_set|utility|valarray|variant|vector)[">]$'
65+
Priority: 20
66+
# Other library h files (with angles)
67+
- Regex: "^<"
68+
Priority: 30
69+
# Your project's h files (with angles)
70+
- Regex: "^<khronos"
71+
Priority: 40
72+
# Your project's h files
73+
- Regex: '^"khronos'
74+
Priority: 50
75+
IndentCaseLabels: true
76+
IndentWidth: 2
77+
IndentWrappedFunctionNames: false
78+
KeepEmptyLinesAtTheStartOfBlocks: false
79+
MacroBlockBegin: ""
80+
MacroBlockEnd: ""
81+
ColumnLimit: 100
82+
MaxEmptyLinesToKeep: 1
83+
NamespaceIndentation: None
84+
ObjCBlockIndentWidth: 2
85+
ObjCSpaceAfterProperty: false
86+
ObjCSpaceBeforeProtocolList: false
87+
PenaltyBreakBeforeFirstCallParameter: 1
88+
PenaltyBreakComment: 300
89+
PenaltyBreakFirstLessLess: 120
90+
PenaltyBreakString: 1000
91+
PenaltyExcessCharacter: 1000000
92+
PenaltyReturnTypeOnItsOwnLine: 200
93+
PointerAlignment: Left
94+
ReflowComments: true
95+
SortIncludes: true
96+
SpaceAfterCStyleCast: false
97+
SpaceBeforeAssignmentOperators: true
98+
SpaceBeforeParens: ControlStatements
99+
SpaceInEmptyParentheses: false
100+
SpacesBeforeTrailingComments: 2
101+
SpacesInAngles: false
102+
SpacesInContainerLiterals: true
103+
SpacesInCStyleCastParentheses: false
104+
SpacesInParentheses: false
105+
SpacesInSquareBrackets: false
106+
Standard: Auto
107+
TabWidth: 4
108+
UseTab: Never

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,3 @@ local.properties
130130
.sts4-cache/
131131

132132
# End of https://www.gitignore.io/api/c++,code,cmake,eclipse
133-

.pre-commit-config.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: check-yaml
6+
- id: check-json
7+
- id: check-xml
8+
- id: end-of-file-fixer
9+
- id: trailing-whitespace
10+
- id: check-added-large-files
11+
- id: check-merge-conflict
12+
13+
- repo: https://github.com/psf/black
14+
rev: "23.7.0"
15+
hooks:
16+
- id: black
17+
18+
# - repo: https://github.com/pylint-dev/pylint
19+
# rev: "v3.0.0a6"
20+
# hooks:
21+
# - id: pylint
22+
23+
- repo: https://github.com/pre-commit/mirrors-clang-format
24+
rev: "v16.0.6"
25+
hooks:
26+
- id: clang-format
27+
28+
- repo: https://github.com/cpplint/cpplint
29+
rev: "1.6.1"
30+
hooks:
31+
- id: cpplint
32+
args:
33+
[
34+
"--filter=-whitespace/line_length,-legal/copyright,-build/include_order,-runtime/references,-build/c++11,-build/namespaces,-build/header_guard,-runtime/string",
35+
]
36+
exclude: '3rd_party/|include/label_generator/nanoflann\.hpp|include/label_generator/nanoflann_utils\.hpp'

README.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727

2828
---
2929

30-
**IMPORTANT**: (Aug. 18th, 2024) I employ TBB, so its FPS is increased from **50 Hz** to **100 Hz**!
30+
**IMPORTANT**: (Aug. 18th, 2024) I employ TBB, so its FPS is increased from **50 Hz** to **100 Hz**!
3131
If you want to use the paper version of Patchwork for SOTA comparison purpose, Please use this [ground seg. benchmark code](https://github.com/url-kaist/Ground-Segmentation-Benchmark).
3232

3333

3434
Patchwork | Concept of our method (CZM & GLE)
3535
:-------------------------:|:-------------------------:
3636
![](img/patchwork_concept_resized.jpg) | ![](img/patchwork.gif)
3737

38-
It's an overall updated version of **R-GPF of ERASOR** [**[Code](https://github.com/LimHyungTae/ERASOR)**] [**[Paper](https://arxiv.org/abs/2103.04316)**].
38+
It's an overall updated version of **R-GPF of ERASOR** [**[Code](https://github.com/LimHyungTae/ERASOR)**] [**[Paper](https://arxiv.org/abs/2103.04316)**].
3939

4040
---
4141

@@ -64,7 +64,7 @@ The code is tested successfully at
6464
## :package: Prerequisite Installation
6565

6666
### ROS Setting
67-
- 1. Install [ROS](http://torch.ch/docs/getting-started.html) on a machine.
67+
- 1. Install [ROS](http://torch.ch/docs/getting-started.html) on a machine.
6868
- 2. Thereafter, [jsk-visualization](https://github.com/jsk-ros-pkg/jsk_visualization) is required to visualize Ground Likelihood Estimation status.
6969

7070
```bash
@@ -83,7 +83,7 @@ sudo apt-get install ros-melodic-jsk-rviz-plugins
8383
mkdir -p ~/catkin_ws/src
8484
cd ~/catkin_ws/src
8585
git clone https://github.com/LimHyungTae/patchwork.git
86-
cd .. && catkin build patchwork
86+
cd .. && catkin build patchwork
8787
```
8888

8989
## :gear: How to Run Patchwork
@@ -119,10 +119,10 @@ _____labels
119119
|___000002.label
120120
|...
121121
_____...
122-
122+
123123
```
124124

125-
3. Run launch file
125+
3. Run launch file
126126
```
127127
roslaunch patchwork offline_kitti.launch
128128
```
@@ -137,7 +137,7 @@ It is easy by re-using `run_patchwork.launch`.
137137
Other important parameters are
138138
* If you feel too many below parts of non-ground points are considered as ground, lower `th_seeds` and `th_dist`.
139139
* If your environment is mostly flat, then turn on `using_global_elevation` as `true`.
140-
* Change `min_r`, `max_r`, and `evelation_thresholds`
140+
* Change `min_r`, `max_r`, and `evelation_thresholds`
141141

142142
If you are unsure about the `sensor_height`, simply launch Patchwork and set the `sensor_height` value in the terminal as shown below.
143143

@@ -161,17 +161,17 @@ roslaunch patchwork run_patchwork.launch is_kitti:=false
161161
Note that `is_kitti=false` is important! Because it decides which rviz is opened. The rviz shows only estimated ground and non-ground because your own dataset may have no point-wise labels.
162162

163163
4. Then play your bag file!
164-
164+
165165
```
166166
rosbag play $YOUR_BAG_FILE_NAME$.bag
167167
```
168168

169-
<details>
169+
<details>
170170
<summary><strong>Exercise with the <a href="https://github.com/MIT-SPARK/Kimera-Multi-Data">Kimera-Multi dataset</a></strong></summary>
171171
For the Kimera-Multi dataset, you can use the following command:
172172

173173
```angular2html
174-
roslaunch patchwork run_patchwork_kimera_multi.launch
174+
roslaunch patchwork run_patchwork_kimera_multi.launch
175175
```
176176

177177
Then, play the bag file as follows:
@@ -191,7 +191,7 @@ rosbag play $YOUR_BAG_FILE_NAME$.bag
191191

192192
### :mag: Own dataset using pcd files
193193

194-
Please refer to `/nodes/offilne_own_data.cpp`.
194+
Please refer to `/nodes/offilne_own_data.cpp`.
195195

196196
(Note that in your own data format, there may not exist ground truth labels!)
197197

@@ -209,7 +209,7 @@ For better understanding of the parameters of Patchwork, please read [our wiki,
209209

210210
2. Please check the output by following command and corresponding files:
211211

212-
3. Set appropriate absolute file directory, i.e. `file_dir`, in `offline_ouster128.launch`
212+
3. Set appropriate absolute file directory, i.e. `file_dir`, in `offline_ouster128.launch`
213213
```
214214
roslaunch patchwork offline_ouster128.launch
215215
```
@@ -228,9 +228,9 @@ If you use our code or method in your work, please consider citing the following
228228

229229
---------
230230

231-
---
231+
---
232232

233-
## Updates
233+
## Updates
234234

235235
#### NEWS (22.12.24)
236236
- Merry christmas eve XD! `include/label_generator` is added to make the `.label` file, following the SemanticKITTI format.
@@ -241,11 +241,11 @@ If you use our code or method in your work, please consider citing the following
241241
- Pybinding + more advanced version is now available on [Patchwork++](https://github.com/url-kaist/patchwork-plusplus) as a preprocessing step for deep learning users (i.e., python users can also use our robust ground segmentation)!
242242

243243
#### NEWS (22.07.13)
244-
- For increasing convenience of use, the examples and codes are extensively revised by reflecting [issue #12](https://github.com/LimHyungTae/patchwork/issues/12).
244+
- For increasing convenience of use, the examples and codes are extensively revised by reflecting [issue #12](https://github.com/LimHyungTae/patchwork/issues/12).
245245

246246
#### NEWS (22.05.22)
247247
- The meaning of `elevation_thresholds` is changed to increase the usability. The meaning is explained in [wiki](https://github.com/LimHyungTae/patchwork/wiki/4.-IMPORTANT:-Setting-Parameters-of-Patchwork-in-Your-Own-Env.).
248-
- A novel height estimator, called *All-Terrain Automatic heighT estimator (ATAT)* is added within the patchwork code, which auto-calibrates the sensor height using the ground points in the vicinity of the vehicle/mobile robot.
248+
- A novel height estimator, called *All-Terrain Automatic heighT estimator (ATAT)* is added within the patchwork code, which auto-calibrates the sensor height using the ground points in the vicinity of the vehicle/mobile robot.
249249
- Please refer to the function `consensus_set_based_height_estimation()`.
250250

251251
#### NEWS (21.12.27)
@@ -259,5 +259,3 @@ roslaunch patchwork pub_for_legoloam.launch
259259
rosbag play {YOUR_FILE_PATH}/KITTI_BAG/kitti_sequence_00.bag --clock /kitti/velo/pointcloud:=/velodyne_points
260260
```
261261
- **This README about this LiDAR odometry is still incomplete. It will be updated soon!**
262-
263-

config/params_kitti.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 22.05.02 Update
1+
# 22.05.02 Update
22
# `sensor_height` denotes the elevation of the origin of the point cloud "with respect to the ground"
33
# So, it mostly have a positive value
44
# Note that if `patchwork/ATAT/ATAT_ON` is set to be true, the sensor_height is auto-calibrated
@@ -11,7 +11,7 @@ extrinsic_rot: [1, 0, 0,
1111
0, 1, 0,
1212
0, 0, 1]
1313
patchwork:
14-
mode: "czm"
14+
mode: "czm"
1515
verbose: false # To check effect of uprightness/elevation/flatness
1616
visualize: true # Ground Likelihood Estimation is visualized
1717
# Ground Plane Fitting parameters
@@ -28,20 +28,20 @@ patchwork:
2828
# For reject points caused by reflection or multipath problems.
2929
# it should be lower than -1.0
3030
adaptive_seed_selection_margin: -1.1
31-
31+
3232
# It is not in the paper
3333
# It is also not matched our philosophy, but it is employed to reject some FPs easily & intuitively.
3434
# For patchwork, the global elevation threshold is only applied on Z3 and Z4
3535
using_global_elevation: false
3636
# W.r.t sensor frame (That is, if it is 0.0, then the candidates whose z is higher than z height of 3D LiDAR sensor are rejected
3737
global_elevation_threshold: -0.5
3838

39-
# 22.05.02 Update
39+
# 22.05.02 Update
4040
# ATAT is the abbrev. for All-Terrain Automatic heighT estimator
4141
# It automatically corrects the wrong sensor height input
4242
ATAT:
4343
ATAT_ON: true
44-
# 22.05.02 Update
44+
# 22.05.02 Update
4545
# IMPORTANT - `max_r_for_ATAT` affects the quality of the estimation of sensor height
4646
# If it is too large, then the z-elevation values of the bins become more ambiguous
4747
# If it is too small, there is a potential risk that does not include the cloud points in the vicinity of the vehicles/mobile robots
@@ -63,6 +63,3 @@ patchwork:
6363
# That is, if the z-elevation of the bin is higher than -1.2, then the cloud points from the bin are rejected
6464
elevation_thresholds: [0.523, 0.746, 0.879, 1.125] # For elevation. The size should be equal to flatness_thresholds vector
6565
flatness_thresholds: [0.0005, 0.000725, 0.001, 0.001] # For flatness. The size should be equal to elevation_thresholds vector
66-
67-
68-

config/params_ouster128.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 22.05.02 Update
1+
# 22.05.02 Update
22
# `sensor_height` denotes the elevation of the origin of the point cloud "with respect to the ground"
33
# So, it mostly have a positive value
44
# Note that if `patchwork/ATAT/ATAT_ON` is set to be true, the sensor_height is auto-calibrated
@@ -14,7 +14,7 @@ extrinsic_rot: [1, 0, 0,
1414
0, 1, 0,
1515
0, 0, 1]
1616
patchwork:
17-
mode: "czm"
17+
mode: "czm"
1818
verbose: false # To check effect of uprightness/elevation/flatness
1919
visualize: true # Ground Likelihood Estimation is visualized
2020
# Ground Plane Fitting parameters
@@ -31,20 +31,20 @@ patchwork:
3131
# Tor rejecti points caused by reflection or multipath problems.
3232
# it should be lower than -1.0
3333
adaptive_seed_selection_margin: -1.1
34-
34+
3535
# It is not in the paper
3636
# It is also not matched our philosophy, but it is employed to reject some FPs easily & intuitively.
3737
# For patchwork, the global elevation threshold is only applied on Z3 and Z4
3838
using_global_elevation: false
3939
# W.r.t sensor frame (That is, if it is 0.0, then the candidates whose z is higher than z height of 3D LiDAR sensor are rejected
4040
global_elevation_threshold: -0.5
41-
42-
# 22.05.02 Update
41+
42+
# 22.05.02 Update
4343
# ATAT is the abbrev. for All-Terrain Automatic heighT estimator
4444
# It automatically corrects the wrong sensor height input
4545
ATAT:
4646
ATAT_ON: true
47-
# 22.05.02 Update
47+
# 22.05.02 Update
4848
# IMPORTANT - `max_r_for_ATAT` affects the quality of the estimation of sensor height
4949
# If it is too large, then the z-elevation values of the bins become more ambiguous
5050
# If it is too small, there is a potential risk that does not include the cloud points in the vicinity of the vehicles/mobile robots
@@ -70,6 +70,3 @@ patchwork:
7070
# Note that the size of below parameters are indepentent to `num_zones`!
7171
elevation_thresholds: [0.5, 0.8, 1.0, 1.1] # For elevation. The size should be equal to flatness_thresholds vector
7272
flatness_thresholds: [0.0, 0.000125, 0.000185, 0.000185] # For flatness. The size should be equal to elevation_thresholds vector
73-
74-
75-

0 commit comments

Comments
 (0)