From b0b94266cd9b2bd4615bef8de3bfd07da9e3e1d1 Mon Sep 17 00:00:00 2001 From: Yevgeniy Date: Sat, 22 Jun 2024 12:48:01 +0000 Subject: [PATCH 1/5] Addressed comments --- .clang-format | 7 ++ .devcontainer/Dockerfile | 66 +++++++++++++++++ .devcontainer/devcontainer.json | 122 ++++++++++++++++++++++++++++++++ .gitignore | 99 ++++++++++++++++++++++++++ README.md | 116 ++++++++++++++++++------------ 5 files changed, 364 insertions(+), 46 deletions(-) create mode 100644 .clang-format create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .gitignore diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..9367bbe --- /dev/null +++ b/.clang-format @@ -0,0 +1,7 @@ +BasedOnStyle: LLVM +IndentWidth: 4 +TabWidth: 4 +ColumnLimit: 120 +UseTab: Never +PointerAlignment: Left +AlwaysBreakTemplateDeclarations: Yes diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..987974a --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,66 @@ +# 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 + +# Install Python packages using pip +RUN pip3 install cmake-format + +# 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 || echo "Group $USERNAME already exists" +RUN useradd --uid $USER_UID --gid $USER_GID --create-home --home-dir /home/$USERNAME $USERNAME || echo "User $USERNAME already exists" +RUN echo "$USERNAME ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME +RUN chmod 0440 /etc/sudoers.d/$USERNAME + +# Set the working directory +WORKDIR /home/$USERNAME/workspace + +# Setup ROS1 environment in the bashrc for interactive bash shells +RUN echo "source /opt/ros/noetic/setup.bash" >> /home/$USERNAME/.bashrc + +# Setup GUI forwarding with the correct DISPLAY setting +RUN echo "export DISPLAY=:1" >> /home/$USERNAME/.bashrc + +# Switch to the non-root user +USER $USERNAME + +# Command to run on container start +CMD ["/bin/bash"] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..bcaabff --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,122 @@ +{ + "name": "GroundGrid", + "privileged": true, + "build": { + "dockerfile": "Dockerfile", + "args": { + "USER_UID": "1000", + "USER_GID": "1000" + } + }, + "containerEnv": { + "DISPLAY": "unix:1", + "ROS_AUTOMATIC_DISCOVERY_RANGE": "LOCALHOST", + "ROS_DOMAIN_ID": "0" + }, + "runArgs": [ + "--net", + "host", + "--privileged", + "--env=DISPLAY=:1", + "--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 + } + } + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ca5ebc --- /dev/null +++ b/.gitignore @@ -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/ diff --git a/README.md b/README.md index ba8ea78..c484b32 100644 --- a/README.md +++ b/README.md @@ -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)). +

Ground segmentation results

-# Dependencies +## Dependencies + - ROS Noetic Ninjemys - catkin - roscpp @@ -26,15 +29,37 @@ 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 . + +## Build + +Install required dependencies + +```bash +pip3 install -r requirements.txt ``` + +Build: + +```bash catkin build -DCMAKE_BUILD_TYPE=Release groundgrid ``` -# Launch -## Playback +## Clean + +```bash +catkin clean ``` -roslaunch groundgrid KITTIPlayback.launch directory:=/path/to/the/SemanticKITTI/dataset sequence:=0 + +## Launch + +### Playback + +```bash +source devel/setup.bash +roslaunch groundgrid KITTIPlayback.launch directory:=/path/to/the/SemanticKITTI dataset sequence:=0 ``` The launch file opens a RViz window which displays the segmentation results: @@ -42,52 +67,51 @@ The launch file opens a RViz window which displays the segmentation results: SemanticKitti playback Rviz window

- ## 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. -label nonground % ground % nonground total -unlabeled 88.74% 11.26% 6512861 7339364 -outlier 42.51% 57.49% 121616 286056 -car 94.42% 5.58% 43078880 45622648 -bicycle 89.85% 10.15% 200919 223610 -motorcycle 95.39% 4.61% 500522 524684 -truck 97.61% 2.39% 416124 426308 -other-vehicle 96.34% 3.66% 1199946 1245564 -person 95.95% 4.05% 68227 71104 -bicyclist 100.00% 0.00% 5 5 -motorcyclist 0.00% 100.00% 0 8 -road 0.07% 99.93% 68465 95649669 -parking 0.45% 99.55% 37828 8450594 -sidewalk 0.91% 99.09% 716154 78601664 -other-ground 6.43% 93.57% 192 2985 -building 97.33% 2.67% 117586234 120810401 -fence 88.91% 11.09% 15821127 17793867 -other-structure 89.92% 10.08% 713791 793778 -lane-marking 0.16% 99.84% 171 109456 -vegetation 93.43% 6.57% 121595505 130139604 -trunk 97.88% 2.12% 4495649 4592878 -terrain 6.68% 93.32% 1939107 29038187 -pole 98.14% 1.86% 1819715 1854290 -traffic-sign 99.87% 0.13% 248254 248565 -other-object 89.59% 10.41% 4577201 5109077 -moving-car 96.48% 3.52% 245225 254183 -moving-bicyclist 98.23% 1.77% 155263 158054 -moving-person 96.51% 3.49% 85024 88099 -moving-motorcyclist 94.68% 5.32% 2011 2124 -moving-bus 98.26% 1.74% 902 918 -moving-other-vehicle 94.24% 5.76% 34090 36175 -Precision 96.05% 209090638 8607231 -Recall 98.70% 209090638 2761917 -F1 97.35% 8607231 2761917 -Accuracy 97.24% 400339747 411708895 -IoUg 94.84% -``` +| Label | Nonground % | Ground % | Nonground Total | Total | +| -------------------- | ----------- | -------- | --------------- | ----------- | +| unlabeled | 88.74% | 11.26% | 6,512,861 | 7,339,364 | +| outlier | 42.51% | 57.49% | 121,616 | 286,056 | +| car | 94.42% | 5.58% | 43,078,880 | 45,622,648 | +| bicycle | 89.85% | 10.15% | 200,919 | 223,610 | +| motorcycle | 95.39% | 4.61% | 500,522 | 524,684 | +| truck | 97.61% | 2.39% | 416,124 | 426,308 | +| other-vehicle | 96.34% | 3.66% | 1,199,946 | 1,245,564 | +| person | 95.95% | 4.05% | 68,227 | 71,104 | +| bicyclist | 100.00% | 0.00% | 5 | 5 | +| motorcyclist | 0.00% | 100.00% | 0 | 8 | +| road | 0.07% | 99.93% | 68,465 | 95,649,669 | +| parking | 0.45% | 99.55% | 37,828 | 8,450,594 | +| sidewalk | 0.91% | 99.09% | 716,154 | 78,601,664 | +| other-ground | 6.43% | 93.57% | 192 | 2,985 | +| building | 97.33% | 2.67% | 117,586,234 | 120,810,401 | +| fence | 88.91% | 11.09% | 15,821,127 | 17,793,867 | +| other-structure | 89.92% | 10.08% | 713,791 | 793,778 | +| lane-marking | 0.16% | 99.84% | 171 | 109,456 | +| vegetation | 93.43% | 6.57% | 121,595,505 | 130,139,604 | +| trunk | 97.88% | 2.12% | 4,495,649 | 4,592,878 | +| terrain | 6.68% | 93.32% | 1,939,107 | 29,038,187 | +| pole | 98.14% | 1.86% | 1,819,715 | 1,854,290 | +| traffic-sign | 99.87% | 0.13% | 248,254 | 248,565 | +| other-object | 89.59% | 10.41% | 4,577,201 | 5,109,077 | +| moving-car | 96.48% | 3.52% | 245,225 | 254,183 | +| moving-bicyclist | 98.23% | 1.77% | 155,263 | 158,054 | +| moving-person | 96.51% | 3.49% | 85,024 | 88,099 | +| moving-motorcyclist | 94.68% | 5.32% | 2,011 | 2,124 | +| moving-bus | 98.26% | 1.74% | 902 | 918 | +| moving-other-vehicle | 94.24% | 5.76% | 34,090 | 36,175 | +| Precision | 96.05% | | 209,090,638 | 8,607,231 | +| Recall | 98.70% | | 209,090,638 | 2,761,917 | +| F1 | 97.35% | | 8,607,231 | 2,761,917 | +| Accuracy | 97.24% | | 400,339,747 | 411,708,895 | +| IoUg | 94.84% | | | | From 25c91eb016161cb2d0e63283a6d04d8915d21940 Mon Sep 17 00:00:00 2001 From: Yevgeniy Date: Fri, 12 Jul 2024 11:30:02 +0000 Subject: [PATCH 2/5] Reverted markdown table --- .devcontainer/devcontainer.json | 3 +- .devcontainer/Dockerfile => Dockerfile | 14 +++-- README.md | 79 +++++++++++++------------- requirements.txt | 5 +- 4 files changed, 50 insertions(+), 51 deletions(-) rename .devcontainer/Dockerfile => Dockerfile (84%) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index bcaabff..c8b321e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,7 +2,7 @@ "name": "GroundGrid", "privileged": true, "build": { - "dockerfile": "Dockerfile", + "dockerfile": "../Dockerfile", "args": { "USER_UID": "1000", "USER_GID": "1000" @@ -17,7 +17,6 @@ "--net", "host", "--privileged", - "--env=DISPLAY=:1", "--volume=/tmp/.X11-unix:/tmp/.X11-unix:rw" ], "hostRequirements": { diff --git a/.devcontainer/Dockerfile b/Dockerfile similarity index 84% rename from .devcontainer/Dockerfile rename to Dockerfile index 987974a..1da2a41 100644 --- a/.devcontainer/Dockerfile +++ b/Dockerfile @@ -36,8 +36,9 @@ RUN apt-get update && apt-get install -y \ # Set Python 3 as the default Python version RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 -# Install Python packages using pip -RUN pip3 install cmake-format +# 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 @@ -50,15 +51,16 @@ RUN useradd --uid $USER_UID --gid $USER_GID --create-home --home-dir /home/$USER RUN echo "$USERNAME ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME RUN chmod 0440 /etc/sudoers.d/$USERNAME -# Set the working directory +# Set the working directory and change ownership WORKDIR /home/$USERNAME/workspace +RUN chown -R $USERNAME:$USERNAME /home/$USERNAME/workspace + +# Setup GUI forwarding with the correct DISPLAY setting +RUN echo 'export DISPLAY=${DISPLAY:-:0}' >> /home/$USERNAME/.bashrc # Setup ROS1 environment in the bashrc for interactive bash shells RUN echo "source /opt/ros/noetic/setup.bash" >> /home/$USERNAME/.bashrc -# Setup GUI forwarding with the correct DISPLAY setting -RUN echo "export DISPLAY=:1" >> /home/$USERNAME/.bashrc - # Switch to the non-root user USER $USERNAME diff --git a/README.md b/README.md index c484b32..b3113b2 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ catkin clean ```bash source devel/setup.bash -roslaunch groundgrid KITTIPlayback.launch directory:=/path/to/the/SemanticKITTI dataset sequence:=0 +roslaunch groundgrid KITTIPlayback.launch directory:=/path/to/the/SemanticKITTI/dataset sequence:=0 ``` The launch file opens a RViz window which displays the segmentation results: @@ -76,42 +76,43 @@ roslaunch groundgrid KITTIEvaluate.launch directory:=/path/to/the/SemanticKITTI/ 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. - -| Label | Nonground % | Ground % | Nonground Total | Total | -| -------------------- | ----------- | -------- | --------------- | ----------- | -| unlabeled | 88.74% | 11.26% | 6,512,861 | 7,339,364 | -| outlier | 42.51% | 57.49% | 121,616 | 286,056 | -| car | 94.42% | 5.58% | 43,078,880 | 45,622,648 | -| bicycle | 89.85% | 10.15% | 200,919 | 223,610 | -| motorcycle | 95.39% | 4.61% | 500,522 | 524,684 | -| truck | 97.61% | 2.39% | 416,124 | 426,308 | -| other-vehicle | 96.34% | 3.66% | 1,199,946 | 1,245,564 | -| person | 95.95% | 4.05% | 68,227 | 71,104 | -| bicyclist | 100.00% | 0.00% | 5 | 5 | -| motorcyclist | 0.00% | 100.00% | 0 | 8 | -| road | 0.07% | 99.93% | 68,465 | 95,649,669 | -| parking | 0.45% | 99.55% | 37,828 | 8,450,594 | -| sidewalk | 0.91% | 99.09% | 716,154 | 78,601,664 | -| other-ground | 6.43% | 93.57% | 192 | 2,985 | -| building | 97.33% | 2.67% | 117,586,234 | 120,810,401 | -| fence | 88.91% | 11.09% | 15,821,127 | 17,793,867 | -| other-structure | 89.92% | 10.08% | 713,791 | 793,778 | -| lane-marking | 0.16% | 99.84% | 171 | 109,456 | -| vegetation | 93.43% | 6.57% | 121,595,505 | 130,139,604 | -| trunk | 97.88% | 2.12% | 4,495,649 | 4,592,878 | -| terrain | 6.68% | 93.32% | 1,939,107 | 29,038,187 | -| pole | 98.14% | 1.86% | 1,819,715 | 1,854,290 | -| traffic-sign | 99.87% | 0.13% | 248,254 | 248,565 | -| other-object | 89.59% | 10.41% | 4,577,201 | 5,109,077 | -| moving-car | 96.48% | 3.52% | 245,225 | 254,183 | -| moving-bicyclist | 98.23% | 1.77% | 155,263 | 158,054 | -| moving-person | 96.51% | 3.49% | 85,024 | 88,099 | -| moving-motorcyclist | 94.68% | 5.32% | 2,011 | 2,124 | -| moving-bus | 98.26% | 1.74% | 902 | 918 | -| moving-other-vehicle | 94.24% | 5.76% | 34,090 | 36,175 | -| Precision | 96.05% | | 209,090,638 | 8,607,231 | -| Recall | 98.70% | | 209,090,638 | 2,761,917 | -| F1 | 97.35% | | 8,607,231 | 2,761,917 | -| Accuracy | 97.24% | | 400,339,747 | 411,708,895 | -| IoUg | 94.84% | | | | +label nonground % ground % nonground total +unlabeled 88.74% 11.26% 6512861 7339364 +outlier 42.51% 57.49% 121616 286056 +car 94.42% 5.58% 43078880 45622648 +bicycle 89.85% 10.15% 200919 223610 +motorcycle 95.39% 4.61% 500522 524684 +truck 97.61% 2.39% 416124 426308 +other-vehicle 96.34% 3.66% 1199946 1245564 +person 95.95% 4.05% 68227 71104 +bicyclist 100.00% 0.00% 5 5 +motorcyclist 0.00% 100.00% 0 8 +road 0.07% 99.93% 68465 95649669 +parking 0.45% 99.55% 37828 8450594 +sidewalk 0.91% 99.09% 716154 78601664 +other-ground 6.43% 93.57% 192 2985 +building 97.33% 2.67% 117586234 120810401 +fence 88.91% 11.09% 15821127 17793867 +other-structure 89.92% 10.08% 713791 793778 +lane-marking 0.16% 99.84% 171 109456 +vegetation 93.43% 6.57% 121595505 130139604 +trunk 97.88% 2.12% 4495649 4592878 +terrain 6.68% 93.32% 1939107 29038187 +pole 98.14% 1.86% 1819715 1854290 +traffic-sign 99.87% 0.13% 248254 248565 +other-object 89.59% 10.41% 4577201 5109077 +moving-car 96.48% 3.52% 245225 254183 +moving-bicyclist 98.23% 1.77% 155263 158054 +moving-person 96.51% 3.49% 85024 88099 +moving-motorcyclist 94.68% 5.32% 2011 2124 +moving-bus 98.26% 1.74% 902 918 +moving-other-vehicle 94.24% 5.76% 34090 36175 +Precision 96.05% 209090638 8607231 +Recall 98.70% 209090638 2761917 +F1 97.35% 8607231 2761917 +Accuracy 97.24% 400339747 411708895 +IoUg 94.84% +``` diff --git a/requirements.txt b/requirements.txt index 8887eb2..22a8b6c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,12 +1,9 @@ +cmake-format imageio>=2.19.2 rospkg>=1.4.0 numpy>=1.22.3 pandas>=1.4.1 pyntcloud>=0.3.0 -rospy>=1.15.14 -sensor_msgs>=1.13.1 -tf2_ros>=0.7.5 xmltodict>=0.13.0 pyyaml>=6.0 glfw==2.5.3 -tf>=1.13.2 From c9d9b9615caf559183d4b2063c56fcb29dda98a7 Mon Sep 17 00:00:00 2001 From: Yevgeniy Date: Fri, 12 Jul 2024 11:34:38 +0000 Subject: [PATCH 3/5] Can build --- README.md | 2 ++ src/groundgrid | 1 + 2 files changed, 3 insertions(+) create mode 120000 src/groundgrid diff --git a/README.md b/README.md index b3113b2..f45054d 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,8 @@ pip3 install -r requirements.txt Build: ```bash +cd /home/devuser/workspace/groundgrid/src +ln -s .. groundgrid catkin build -DCMAKE_BUILD_TYPE=Release groundgrid ``` diff --git a/src/groundgrid b/src/groundgrid new file mode 120000 index 0000000..a96aa0e --- /dev/null +++ b/src/groundgrid @@ -0,0 +1 @@ +.. \ No newline at end of file From 2b3bc9f0cdbadf17bbe36fc56d8483afa8cbe405 Mon Sep 17 00:00:00 2001 From: Yevgeniy Date: Sat, 13 Jul 2024 04:15:09 +0000 Subject: [PATCH 4/5] Fixed display environment variable to be adjusted dynamically depending on the host :1 --- .devcontainer/devcontainer.json | 2 +- Dockerfile | 52 ++++++++++++++++----------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c8b321e..626bdf9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,7 +9,6 @@ } }, "containerEnv": { - "DISPLAY": "unix:1", "ROS_AUTOMATIC_DISCOVERY_RANGE": "LOCALHOST", "ROS_DOMAIN_ID": "0" }, @@ -17,6 +16,7 @@ "--net", "host", "--privileged", + "--env=DISPLAY", "--volume=/tmp/.X11-unix:/tmp/.X11-unix:rw" ], "hostRequirements": { diff --git a/Dockerfile b/Dockerfile index 1da2a41..b7f0716 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,29 +9,29 @@ 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/* + 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 @@ -55,14 +55,14 @@ RUN chmod 0440 /etc/sudoers.d/$USERNAME WORKDIR /home/$USERNAME/workspace RUN chown -R $USERNAME:$USERNAME /home/$USERNAME/workspace -# Setup GUI forwarding with the correct DISPLAY setting -RUN echo 'export DISPLAY=${DISPLAY:-:0}' >> /home/$USERNAME/.bashrc - # 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 +# Set the entrypoint script inline in the Dockerfile to export $DISPLAY environment variable +ENTRYPOINT ["/bin/bash", "-c", "if [ -z \"$DISPLAY\" ]; then echo 'Error: DISPLAY environment variable is not set.'; exit 1; fi; source /home/$USERNAME/.bashrc; exec \"$@\""] + # Command to run on container start CMD ["/bin/bash"] From e21fc78fe130e7cf3d99ceda5313d54c060d2388 Mon Sep 17 00:00:00 2001 From: Yevgeniy Date: Sat, 20 Jul 2024 10:36:26 +0800 Subject: [PATCH 5/5] Fix --- Dockerfile | 14 +++++++------- README.md | 12 ++++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index b7f0716..8a787ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,10 +46,13 @@ ARG USER_UID=1000 ARG USER_GID=$USER_UID # Create user with specified home directory -RUN groupadd --gid $USER_GID $USERNAME || echo "Group $USERNAME already exists" -RUN useradd --uid $USER_UID --gid $USER_GID --create-home --home-dir /home/$USERNAME $USERNAME || echo "User $USERNAME already exists" -RUN echo "$USERNAME ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME -RUN chmod 0440 /etc/sudoers.d/$USERNAME +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 @@ -61,8 +64,5 @@ RUN echo "source /opt/ros/noetic/setup.bash" >> /home/$USERNAME/.bashrc # Switch to the non-root user USER $USERNAME -# Set the entrypoint script inline in the Dockerfile to export $DISPLAY environment variable -ENTRYPOINT ["/bin/bash", "-c", "if [ -z \"$DISPLAY\" ]; then echo 'Error: DISPLAY environment variable is not set.'; exit 1; fi; source /home/$USERNAME/.bashrc; exec \"$@\""] - # Command to run on container start CMD ["/bin/bash"] diff --git a/README.md b/README.md index f45054d..1fb4488 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,18 @@ This repository contains the source code for the article "GroundGrid: LiDAR Poin To be able to use Nvidia GPU graphics within Docker follow container toolkit installation steps . +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