Skip to content

Added development container for replicability #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BasedOnStyle: LLVM
IndentWidth: 4
TabWidth: 4
ColumnLimit: 120
UseTab: Never
PointerAlignment: Left
AlwaysBreakTemplateDeclarations: Yes
121 changes: 121 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"name": "GroundGrid",
"privileged": true,
"build": {
"dockerfile": "../Dockerfile",
"args": {
"USER_UID": "1000",
"USER_GID": "1000"
}
},
"containerEnv": {
"ROS_AUTOMATIC_DISCOVERY_RANGE": "LOCALHOST",
"ROS_DOMAIN_ID": "0"
},
"runArgs": [
"--net",
"host",
"--privileged",
"--env=DISPLAY",
"--volume=/tmp/.X11-unix:/tmp/.X11-unix:rw"
],
"hostRequirements": {
"gpu": "optional"
},
"remoteUser": "devuser",
"workspaceFolder": "/home/devuser/workspace/groundgrid",
"mounts": [
{
"source": "${env:HOME}/workspace",
"target": "/home/devuser/workspace",
"type": "bind"
}
],
"postCreateCommand": "bash -c 'source /opt/ros/noetic/setup.bash'",
"customizations": {
"vscode": {
"extensions": [
"ms-iot.vscode-ros",
"ms-python.black-formatter",
"ms-python.vscode-pylance",
"ms-python.python",
"ms-python.debugpy",
"xaver.clang-format",
"eamodio.gitlens",
"twxs.cmake",
"ClemensPeters.format-json",
"DavidAnson.vscode-markdownlint",
"redhat.vscode-xml",
"redhat.vscode-yaml",
"mechatroner.rainbow-csv",
"llvm-vs-code-extensions.vscode-clangd"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.env.linux": {
"CMAKE_PREFIX_PATH": "/opt/ros/noetic:$CMAKE_PREFIX_PATH",
"LD_LIBRARY_PATH": "/opt/ros/noetic/lib:$LD_LIBRARY_PATH"
},
"search.exclude": {
"**/build": true,
"**/install": true,
"**/log": true
},
"ros.rosSetupScript": "/opt/ros/noetic/setup.bash",
"python.autoComplete.extraPaths": [
"/opt/ros/noetic/lib/python3/dist-packages/"
],
"python.analysis.extraPaths": [
"/opt/ros/noetic/lib/python3/dist-packages/"
],
"clangd.path": "/usr/bin/clangd",
"clangd.checkUpdates": false,
"C_Cpp.clang_format_style": "file",
"C_Cpp.default.cppStandard": "c++17",
"C_Cpp.default.cStandard": "c11",
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"C_Cpp.default.browse.path": [
"${workspaceFolder}"
],
"C_Cpp.autocomplete": "disabled",
"C_Cpp.intelliSenseEngine": "disabled",
"C_Cpp.errorSquiggles": "disabled",
"C_Cpp.formatting": "disabled",
"C_Cpp.intelliSenseEngineFallback": "disabled",
"C_Cpp.configurationWarnings": "disabled",
"C_Cpp.vcpkg.enabled": false,
"C_Cpp.inlayHints.parameterNames.enabled": false,
"C_Cpp.autoAddFileAssociations": false,
"C_Cpp.codeAnalysis.runAutomatically": false,
"C_Cpp.default.enableConfigurationSquiggles": false,
"[c]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "xaver.clang-format"
},
"[cpp]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "xaver.clang-format"
},
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "ms-python.black-formatter"
},
"[yaml]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "redhat.vscode-yaml"
},
"[json]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "ClemensPeters.format-json"
},
"[xml]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "redhat.vscode-xml"
},
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"terminal.integrated.scrollback": 10000
}
}
}
}
99 changes: 99 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Core dumps
core
core.*

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Build directories
build/
Build/
bin/
Bin/
lib/
Lib/
lib64/
Lib64/
CMakeFiles/
CMakeCache.txt
cmake_install.cmake
Makefile
*.cmake
*.ninja
.ninja_deps
.ninja_log
*.vcxproj
*.vcxproj.filters
*.vcxproj.user
*.DS_Store
*.ipynb_checkpoints

# Python build artifacts
*.pyc
*.pyo
*.pyd
__pycache__/
*.egg-info/
dist/
build/
*.log

# Clang-format index
.cache

# ROS
.catkin_tools/
devel/
logs/
install/
*.launch~
*.pyc

# Ignore files generated by IDEs and editors
.vscode/
.idea/
*.swp
*.bak
*~
*.tmp
*.temp
*.log
*.log.*

# Ignore test results
test-output/
test-results/

# Ignore dependency directories
node_modules/
vendor/
68 changes: 68 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Use an official ROS1 environment as a parent image
FROM ros:noetic-robot

# Set the default shell to bash
SHELL ["/bin/bash", "-c"]

# Set a non-interactive shell to avoid stuck prompts during build
ARG DEBIAN_FRONTEND=noninteractive

# Update package lists and install only necessary packages
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
git \
sudo \
lsb-release \
gnupg2 \
net-tools \
clang-format \
clangd \
gdb \
libpcl-dev \
libopencv-dev \
python3-pip \
python3-catkin-tools \
python3-rospkg \
python3-rospy \
ros-noetic-tf2-ros \
ros-noetic-sensor-msgs \
ros-noetic-catkin \
ros-noetic-pcl-ros \
ros-noetic-grid-map \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Set Python 3 as the default Python version
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1

# Copy requirements.txt and install Python packages using pip
COPY requirements.txt /tmp/requirements.txt
RUN pip3 install -r /tmp/requirements.txt

# Add a user for the development environment
ARG USERNAME=devuser
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Create user with specified home directory
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID --create-home --home-dir /home/$USERNAME $USERNAME \
&& echo "$USERNAME ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

# Ensure .bashrc exists and source it in the entrypoint script
RUN touch /home/$USERNAME/.bashrc

# Set the working directory and change ownership
WORKDIR /home/$USERNAME/workspace
RUN chown -R $USERNAME:$USERNAME /home/$USERNAME/workspace

# Setup ROS1 environment in the bashrc for interactive bash shells
RUN echo "source /opt/ros/noetic/setup.bash" >> /home/$USERNAME/.bashrc

# Switch to the non-root user
USER $USERNAME

# Command to run on container start
CMD ["/bin/bash"]
53 changes: 46 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Source code for the article "GroundGrid: LiDAR Point Cloud Ground Segmentation and Terrain Estimation"

This repository contains the source code for the article "GroundGrid: LiDAR Point Cloud Ground Segmentation and Terrain Estimation" published in the IEEE Robotics and Automation Letters ([DOI: 10.1109/LRA.2023.3333233](https://doi.org/10.1109/lra.2023.3333233)).

<p align="center">
<img src="/res/img/teaser.gif" alt="Ground segmentation results"/>
</p>

# Dependencies
## Dependencies

- ROS Noetic Ninjemys
- catkin
- roscpp
Expand All @@ -26,14 +29,50 @@ This repository contains the source code for the article "GroundGrid: LiDAR Poin
- cv_bridge
- pcl_ros

# Build
## Development Container

To be able to use Nvidia GPU graphics within Docker follow container toolkit installation steps <https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#installing-the-nvidia-container-toolkit>.

Build Docker image:

```bash
docker build -t groundgrid:latest .
```

Run Docker container:

```bash
docker run --net host --privileged --env="DISPLAY=$DISPLAY" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" -v "${HOME}/workspace:/home/devuser/workspace" -it groundgrid:latest /bin/bash
```

## Build

Install required dependencies

```bash
pip3 install -r requirements.txt
```

Build:

```bash
cd /home/devuser/workspace/groundgrid/src
ln -s .. groundgrid
catkin build -DCMAKE_BUILD_TYPE=Release groundgrid
```

# Launch
## Playback
## Clean

```bash
catkin clean
```

## Launch

### Playback

```bash
source devel/setup.bash
roslaunch groundgrid KITTIPlayback.launch directory:=/path/to/the/SemanticKITTI/dataset sequence:=0
```

Expand All @@ -42,14 +81,15 @@ The launch file opens a RViz window which displays the segmentation results:
<img src="/res/img/rviz.png" alt="SemanticKitti playback Rviz window"/>
</p>


## Ground Segmentation Evaluation
```

```bash
roslaunch groundgrid KITTIEvaluate.launch directory:=/path/to/the/SemanticKITTI/dataset sequence:=0
```

This launch file evaluates the ground segmentation performance of GroundGrid and displays the results every 500 processed clouds.
The final results are displayed upon receiving Ctrl+C in the terminal:

```
Stats
Received 4540 point clouds. KITTI sequence 00.
Expand Down Expand Up @@ -90,4 +130,3 @@ F1 97.35% 8607231 2761917
Accuracy 97.24% 400339747 411708895
IoUg 94.84%
```

Loading