Skip to content

Commit 688be59

Browse files
committed
Initialize pre-commit
1 parent 138a29d commit 688be59

27 files changed

+1255
-1051
lines changed

.clang-format

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: Google
4+
AccessModifierOffset: -1
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: true
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: "^<patchwork"
71+
Priority: 40
72+
# Your project's h files
73+
- Regex: '^"patchworkpp'
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
109+
---
110+
# For addressing 'Configuration file(s) do(es) not support Json' error
111+
Language: Json
112+
BasedOnStyle: llvm

.pre-commit-config.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
ci:
2+
autofix: true
3+
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v4.4.0
7+
hooks:
8+
- id: check-yaml
9+
exclude: \.clang-format$
10+
- id: check-json
11+
- id: check-xml
12+
- id: end-of-file-fixer
13+
- id: trailing-whitespace
14+
- id: check-added-large-files
15+
- id: check-merge-conflict
16+
17+
######################################################################
18+
# Python Formatting
19+
######################################################################
20+
# For Python import sorting
21+
- repo: https://github.com/pycqa/isort
22+
rev: "5.12.0"
23+
hooks:
24+
- id: isort
25+
# TODO(hlim): Why launch.py files lead to error?
26+
exclude: \.launch\.py$
27+
28+
# Yet Another Python Formatter
29+
# NOTE(hlim): Python 3.12 (Ubuntu 24.04) is now not supported by yapf
30+
# - repo: https://github.com/pre-commit/mirrors-yapf
31+
# rev: v0.32.0
32+
# hooks:
33+
# - id: yapf
34+
# additional_dependencies: [toml]
35+
36+
- repo: https://github.com/psf/black
37+
rev: 23.12.1
38+
hooks:
39+
- id: black
40+
# TODO(hlim): Why launch.py files lead to error?
41+
exclude: \.launch\.py$
42+
43+
- repo: https://github.com/PyCQA/flake8
44+
rev: 5.0.4
45+
hooks:
46+
- id: flake8
47+
exclude: 'python/utils/download_datasets'
48+
# To avoid conflict between flake and black
49+
args: ["--ignore=E501"]
50+
51+
######################################################################
52+
# Markdown Formatting
53+
######################################################################
54+
- repo: https://github.com/executablebooks/mdformat
55+
rev: 0.7.9
56+
hooks:
57+
- id: mdformat
58+
exclude: 'github/'
59+
60+
######################################################################
61+
# C++ Formatting
62+
######################################################################
63+
- repo: https://github.com/pre-commit/mirrors-clang-format
64+
rev: "v16.0.6"
65+
hooks:
66+
- id: clang-format

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ cppinstall:
1212

1313
cppinstall_with_demo:
1414
@cmake -Bcpp/build cpp/ -DINCLUDE_CPP_EXAMPLES=ON
15-
@cmake --build cpp/build -j$(nproc --all)
15+
@cmake --build cpp/build -j$(nproc --all)

README.md

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,20 @@
2020
<br />
2121
<p align="center"><img src=pictures/patchwork++.gif alt="animated" /></p>
2222

23-
[Patchwork++][arXivlink], an extension of [Patchwork][patchworklink], is **a fast, robust, and self-adaptive ground segmentation algorithm** on 3D point cloud.
24-
</div>
23+
[Patchwork++][arxivlink], an extension of [Patchwork][patchworklink], is **a fast, robust, and self-adaptive ground segmentation algorithm** on 3D point cloud.
2524

26-
[YouTubeLInk]: https://www.youtube.com/watch?v=fogCM159GRk
27-
[arXivlink]: https://arxiv.org/abs/2207.11919
28-
[patchworklink]: https://github.com/LimHyungTae/patchwork
29-
[SemanticKITTIlink]: http://www.semantic-kitti.org/
30-
[benchmarklink]: https://github.com/url-kaist/Ground-Segmentation-Benchmark
25+
</div>
3126

3227
## :open_file_folder: What's in this repo
3328

34-
* C++ source code of Patchwork++ ([patchworkpp][sourcecodelink])
35-
* Python binding of Patchwork++ using pybind11 ([python_wrapper][wraplink])
36-
* Examples codes of [C++][cppexamplelink], [Python][pyexamplelink], and [ROS2][rosexamplelink] :thumbsup:
29+
- C++ source code of Patchwork++ ([patchworkpp][sourcecodelink])
30+
- Python binding of Patchwork++ using pybind11 ([python_wrapper][wraplink])
31+
- Examples codes of [C++][cppexamplelink], [Python][pyexamplelink], and [ROS2][rosexamplelink] :thumbsup:
3732

3833
> If you are familiar with ROS1, you can also visit [here][roslink] and try executing ROS1-based Patchwork++!
3934
40-
[roslink]: https://github.com/url-kaist/patchwork-plusplus-ros
41-
42-
[sourcecodelink]: https://github.com/url-kaist/patchwork-plusplus/tree/master/cpp/patchworkpp
43-
[pybind11link]: https://github.com/pybind/pybind11
44-
[wraplink]: https://github.com/url-kaist/patchwork-plusplus/tree/master/python/patchworkpp
45-
46-
[cppexamplelink]: https://github.com/url-kaist/patchwork-plusplus/tree/master/cpp
47-
[pyexamplelink]: https://github.com/url-kaist/patchwork-plusplus/tree/master/python
48-
[rosexamplelink]: https://github.com/url-kaist/patchwork-plusplus/tree/master/ros
49-
5035
## :package: Prerequisite packages
36+
5137
> What we need are just minimal dependencies.
5238
5339
```commandline
@@ -106,14 +92,15 @@ cd ~/ros2_ws/src
10692
git clone https://github.com/url-kaist/patchwork-plusplus.git
10793
cd ~/ros2_ws
10894
colcon build --packages-select patchworkpp
109-
source ./install/setup.bash
95+
source ./install/setup.bash
11096
```
11197

11298
How to launch ROS2 nodes is explained [here][rosexamplelink].
11399

114-
115100
## :pencil: Citation
116-
If you use our codes, please cite our paper ([arXiv][arXivLink], [IEEE *Xplore*][patchworkppIEEElink])
101+
102+
If you use our codes, please cite our paper ([arXiv][arxivlink], [IEEE *Xplore*][patchworkppieeelink])
103+
117104
```
118105
@inproceedings{lee2022patchworkpp,
119106
title={{Patchwork++: Fast and robust ground segmentation solving partial under-segmentation using 3D point cloud}},
@@ -124,7 +111,8 @@ If you use our codes, please cite our paper ([arXiv][arXivLink], [IEEE *Xplore*]
124111
}
125112
```
126113

127-
In addition, you can also check the paper of our baseline, Patchwork. ([arXiv][patchworkarXivlink], [IEEE *Xplore*][patchworkIEEElink])
114+
In addition, you can also check the paper of our baseline, Patchwork. ([arXiv][patchworkarxivlink], [IEEE *Xplore*][patchworkieeelink])
115+
128116
```
129117
@article{lim2021patchwork,
130118
title={Patchwork: Concentric Zone-based Region-wise Ground Segmentation with Ground Likelihood Estimation Using a 3D LiDAR Sensor},
@@ -133,9 +121,6 @@ In addition, you can also check the paper of our baseline, Patchwork. ([arXiv][p
133121
year={2021}
134122
}
135123
```
136-
[patchworkppIEEElink]: https://ieeexplore.ieee.org/document/9981561
137-
[patchworkarXivlink]: https://arxiv.org/abs/2108.05560
138-
[patchworkIEEElink]: https://ieeexplore.ieee.org/document/9466396
139124

140125
## :triangular_flag_on_post: Tested Environment
141126

@@ -146,20 +131,31 @@ In addition, you can also check the paper of our baseline, Patchwork. ([arXiv][p
146131
- pybind11 v2.2.3
147132
- Eigen 3.3.7
148133

149-
150134
## :mailbox: Contact Information
151-
If you have any questions, please do not hesitate to contact us
152-
* [Seungjae Lee][sjlink] :envelope: sj98lee `at` kaist `ac` kr
153-
* [Hyungtae Lim][htlink] :envelope: shapelim `at` kaist `ac` kr
154135

155-
[sjlink]: https://github.com/seungjae24
156-
[htlink]: https://github.com/LimHyungTae
136+
If you have any questions, please do not hesitate to contact us
157137

138+
- [Seungjae Lee][sjlink] :envelope: sj98lee `at` kaist `ac` kr
139+
- [Hyungtae Lim][htlink] :envelope: shapelim `at` kaist `ac` kr
158140

159-
---
141+
______________________________________________________________________
160142

161143
## Todo List
162-
- [ ] Support intensity for RNR in `master` branch
163-
- [ ] Support `Patchwork` mode for users who use this repository for baseline comparison purposes
164-
- [ ] Integrate TBB and optimize the performance
165144

145+
- \[ \] Support intensity for RNR in `master` branch
146+
- \[ \] Support `Patchwork` mode for users who use this repository for baseline comparison purposes
147+
- \[ \] Integrate TBB and optimize the performance
148+
149+
[arxivlink]: https://arxiv.org/abs/2207.11919
150+
[cppexamplelink]: https://github.com/url-kaist/patchwork-plusplus/tree/master/cpp
151+
[htlink]: https://github.com/LimHyungTae
152+
[patchworkarxivlink]: https://arxiv.org/abs/2108.05560
153+
[patchworkieeelink]: https://ieeexplore.ieee.org/document/9466396
154+
[patchworklink]: https://github.com/LimHyungTae/patchwork
155+
[patchworkppieeelink]: https://ieeexplore.ieee.org/document/9981561
156+
[pyexamplelink]: https://github.com/url-kaist/patchwork-plusplus/tree/master/python
157+
[rosexamplelink]: https://github.com/url-kaist/patchwork-plusplus/tree/master/ros
158+
[roslink]: https://github.com/url-kaist/patchwork-plusplus-ros
159+
[sjlink]: https://github.com/seungjae24
160+
[sourcecodelink]: https://github.com/url-kaist/patchwork-plusplus/tree/master/cpp/patchworkpp
161+
[wraplink]: https://github.com/url-kaist/patchwork-plusplus/tree/master/python/patchworkpp

cpp/README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@
2020
<br />
2121
<p align="center"><img src=../pictures/patchwork++.gif alt="animated" /></p>
2222

23-
[Patchwork++][arXivlink], an extension of [Patchwork][patchworklink], is **a fast, robust, and self-adaptive ground segmentation algorithm** on 3D point cloud.
24-
</div>
23+
[Patchwork++][arxivlink], an extension of [Patchwork][patchworklink], is **a fast, robust, and self-adaptive ground segmentation algorithm** on 3D point cloud.
2524

26-
[arXivlink]: https://arxiv.org/abs/2207.11919
27-
[patchworklink]: https://github.com/LimHyungTae/patchwork
25+
</div>
2826

29-
---
27+
______________________________________________________________________
3028

3129
# Patchwork++ in C++
3230

@@ -45,7 +43,7 @@ If you want to **run demo**, just run the following command in the top-level dir
4543
make cppinstall_with_demo
4644
```
4745

48-
, or
46+
, or
4947

5048
```commandline
5149
# in patchwork-plusplus directory
@@ -54,7 +52,7 @@ $ cmake -DCMAKE_BUILD_TYPE=Release -DINCLUDE_CPP_EXAMPLES=ON ..
5452
$ make -j 16
5553
```
5654

57-
> [!WARNING]
55+
> \[!WARNING\]
5856
> Please check your cmake version via `cmake --version`.
5957
> If it is lower than 3.20, it is automatically updated by `scripts/install_latest_cmake.bash` (see [here](https://github.com/url-kaist/patchwork-plusplus/blob/master/cpp/CMakeLists.txt#L31)).
6058
@@ -70,31 +68,36 @@ sudo make install
7068
Consequently, our Patchwork++ is installed in your local environment.
7169
An example of finding the `patchworkpp` package in another package is also provided in [example_of_find_package](https://github.com/url-kaist/patchwork-plusplus/tree/master/cpp/example_of_find_package)
7270

73-
7471
## :runner: To run the demo codes
72+
7573
> There are some example codes for your convenience!
7674
> Please try using Patchwork++ to segment ground points in a 3D point cloud :smiley:
7775
76+
- Example 1. Run patchwork++ and visualize ground points (green) and non-ground points (red)
7877

79-
* Example 1. Run patchwork++ and visualize ground points (green) and non-ground points (red)
8078
```commandline
8179
./cpp/build/examples/demo_visualize
8280
```
8381

84-
* Example 2. Run patchwork++ with sequential point cloud inputs
82+
- Example 2. Run patchwork++ with sequential point cloud inputs
83+
8584
```commandline
8685
./cpp/build/examples/demo_sequential
8786
```
8887

89-
* Example 3. Run patchwork++ with your point cloud file, example here
88+
- Example 3. Run patchwork++ with your point cloud file, example here
89+
9090
```commandline
9191
./examples/demo_visualize ./data/000000.bin # specify file path
9292
```
9393

9494
### Demo Result
95+
9596
If you execute Patchwork++ with given demo codes well, you can get the following result!
9697

9798
It is a ground segmentation result of data/000000.bin file using Open3D visualization. (Ground : Green, Nonground : Red)
9899

99100
![Open3D Visualization of "data/000000.bin"](../pictures/demo_000000.png)
100101

102+
[arxivlink]: https://arxiv.org/abs/2207.11919
103+
[patchworklink]: https://github.com/LimHyungTae/patchwork

cpp/cmake/ListPrepend.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ FUNCTION(list_prepend var value)
55
else()
66
SET(${var} "${value}" "${${var}}" PARENT_SCOPE)
77
endif()
8-
ENDFUNCTION(list_prepend)
8+
ENDFUNCTION(list_prepend)

cpp/cmake/eigen.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,3 @@ if(NOT eigen_POPULATED)
4343
set_target_properties(eigen PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${eigen_include_dirs}")
4444
endif()
4545
endif()
46-
47-

0 commit comments

Comments
 (0)