From 4468222d3967f5a0b64c7b086e35db8b810312db Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 17:12:23 -0700 Subject: [PATCH 01/18] Added Jazzy and virtualenv configurations --- .devcontainer/nouveau/Dockerfile | 2 +- .devcontainer/nvidia/Dockerfile | 2 +- .docker/Dockerfile | 8 +++++++- .github/workflows/ci.yml | 6 +++--- .github/workflows/docker.yml | 10 +++++----- .github/workflows/format.yml | 2 +- .gitignore | 3 +++ .vscode/c_cpp_properties.json | 2 +- .vscode/settings.json | 8 ++++---- 9 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.devcontainer/nouveau/Dockerfile b/.devcontainer/nouveau/Dockerfile index b819348..41b8995 100644 --- a/.devcontainer/nouveau/Dockerfile +++ b/.devcontainer/nouveau/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/robotic-decision-making-lab/ros2-template:iron-desktop +FROM ghcr.io/robotic-decision-making-lab/ros2-template:jazzy-desktop # Install ROS dependencies # This is done in a previous stage, but we include it again here in case anyone wants to diff --git a/.devcontainer/nvidia/Dockerfile b/.devcontainer/nvidia/Dockerfile index 3d2e46e..0f8b5ba 100644 --- a/.devcontainer/nvidia/Dockerfile +++ b/.devcontainer/nvidia/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/robotic-decision-making-lab/ros2-template:iron-desktop-nvidia +FROM ghcr.io/robotic-decision-making-lab/ros2-template:jazzy-desktop-nvidia # Install ROS dependencies # This is done in a previous stage, but we include it again here in case anyone wants to diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 75caefd..349e9a1 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,4 +1,4 @@ -ARG ROS_DISTRO=iron +ARG ROS_DISTRO=jazzy FROM ros:$ROS_DISTRO-ros-base as ci ENV DEBIAN_FRONTEND=noninteractive @@ -21,6 +21,7 @@ RUN apt-get -q update \ clang-tools \ python3-pip \ python3-dev \ + python3-virtualenv \ apt-utils \ software-properties-common \ && apt-get autoremove -y \ @@ -61,6 +62,11 @@ WORKDIR $USER_WORKSPACE COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME +# Create a new virtual environment for Python +RUN virtualenv .venv \ + && . .venv/bin/activate \ + && touch .venv/COLCON_IGNORE + # Uncomment to download and install external repos used by the project # RUN vcs import src < src/$PROJECT_NAME/ros2.repos diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ed9868..9b4ad40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: Continuous Integration on: push: branches: - - main + - jazzy pull_request: workflow_dispatch: @@ -19,8 +19,8 @@ jobs: fail-fast: false matrix: env: - - IMAGE: iron-ci - ROS_DISTRO: iron + - IMAGE: jazzy-ci + ROS_DISTRO: jazzy steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index ff9cc64..effd541 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -3,7 +3,7 @@ name: Docker on: push: branches: - - main + - jazzy pull_request: paths: - .docker/** @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - ROS_DISTRO: [iron] + ROS_DISTRO: [jazzy] runs-on: ubuntu-latest permissions: packages: write @@ -59,7 +59,7 @@ jobs: strategy: fail-fast: false matrix: - ROS_DISTRO: [iron] + ROS_DISTRO: [jazzy] runs-on: ubuntu-latest permissions: packages: write @@ -107,7 +107,7 @@ jobs: strategy: fail-fast: false matrix: - ROS_DISTRO: [iron] + ROS_DISTRO: [jazzy] runs-on: ubuntu-latest permissions: packages: write @@ -148,7 +148,7 @@ jobs: strategy: fail-fast: false matrix: - ROS_DISTRO: [iron] + ROS_DISTRO: [jazzy] runs-on: ubuntu-latest permissions: packages: write diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 2024987..0f5877d 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -4,7 +4,7 @@ on: pull_request: push: branches: - - main + - jazzy workflow_dispatch: jobs: diff --git a/.gitignore b/.gitignore index 7e1fc9a..0c6b602 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ build install log + +# virtualenv +.venv diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 9eadd8c..a3e78c7 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -4,7 +4,7 @@ "name": "Linux", "includePath": [ "${workspaceFolder}/**", - "/opt/ros/iron/include/**", + "/opt/ros/jazzy/include/**", "/usr/include/gz/**" ], "defines": [], diff --git a/.vscode/settings.json b/.vscode/settings.json index 009f4e0..e57cc54 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,13 +23,13 @@ "autoDocstring.startOnNewLine": false, "autoDocstring.docstringFormat": "google-notypes", "python.autoComplete.extraPaths": [ - "/opt/ros/iron/lib/python3.10/site-packages/", - "/opt/ros/iron/local/lib/python3.10/dist-packages/", + "/opt/ros/jazzy/lib/python3.10/site-packages/", + "/opt/ros/jazzy/local/lib/python3.10/dist-packages/", "${workspaceFolder}/install/" ], "python.analysis.extraPaths": [ - "/opt/ros/iron/lib/python3.10/site-packages/", - "/opt/ros/iron/local/lib/python3.10/dist-packages/", + "/opt/ros/jazzy/lib/python3.10/site-packages/", + "/opt/ros/jazzy/local/lib/python3.10/dist-packages/", "${workspaceFolder}/install/" ], "C_Cpp.default.intelliSenseMode": "linux-gcc-x86", From 4ca5646fc423f8492c11418b87ec0f2f6d85fcc4 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 17:21:39 -0700 Subject: [PATCH 02/18] Testing groups --- .docker/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 349e9a1..151fa0b 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -45,6 +45,8 @@ ARG USERNAME=ros ARG USER_UID=1000 ARG USER_GID=$USER_UID +RUN groups + RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ From e00f778fba2a2094af8686fa1870a248a8e8e655 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 17:47:58 -0700 Subject: [PATCH 03/18] Fixed gid and pip --- .devcontainer/nouveau/Dockerfile | 4 ++-- .devcontainer/nvidia/Dockerfile | 4 ++-- .docker/Dockerfile | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.devcontainer/nouveau/Dockerfile b/.devcontainer/nouveau/Dockerfile index 41b8995..43a1f61 100644 --- a/.devcontainer/nouveau/Dockerfile +++ b/.devcontainer/nouveau/Dockerfile @@ -12,14 +12,14 @@ COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME RUN sudo apt-get -q update \ && sudo apt-get -q -y upgrade \ && rosdep update \ - && rosdep install -y --from-paths . --ignore-src -r --rosdistro ${ROS_DISTRO} \ + && rosdep install -y --from-paths . --ignore-src -r --as-root=pip:false --rosdistro ${ROS_DISTRO} \ && sudo apt-get autoremove -y \ && sudo apt-get clean -y \ && sudo rm -rf /var/lib/apt/lists/* # Install debugging/linting Python packages COPY --chown=$USER_UID:$USER_GID requirements-dev.txt . -RUN python3 -m pip install -r requirements-dev.txt \ +RUN $VIRTUAL_ENV/bin/pip install -r requirements-dev.txt \ && rm -rf requirements-dev.txt # Disable the setuputils installation warning diff --git a/.devcontainer/nvidia/Dockerfile b/.devcontainer/nvidia/Dockerfile index 0f8b5ba..0c2037b 100644 --- a/.devcontainer/nvidia/Dockerfile +++ b/.devcontainer/nvidia/Dockerfile @@ -12,14 +12,14 @@ COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME RUN sudo apt-get -q update \ && sudo apt-get -q -y upgrade \ && rosdep update \ - && rosdep install -y --from-paths . --ignore-src -r --rosdistro ${ROS_DISTRO} \ + && rosdep install -y --from-paths . --ignore-src -r --as-root=pip:false --rosdistro ${ROS_DISTRO} \ && sudo apt-get autoremove -y \ && sudo apt-get clean -y \ && sudo rm -rf /var/lib/apt/lists/* # Install debugging/linting Python packages COPY --chown=$USER_UID:$USER_GID requirements-dev.txt . -RUN python3 -m pip install -r requirements-dev.txt \ +RUN $VIRTUAL_ENV/bin/pip install -r requirements-dev.txt \ && rm -rf requirements-dev.txt # Disable the setuputils installation warning diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 151fa0b..08a32e5 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -42,7 +42,7 @@ FROM ci as robot # Configure a new non-root user ARG USERNAME=ros -ARG USER_UID=1000 +ARG USER_UID=1001 ARG USER_GID=$USER_UID RUN groups @@ -65,8 +65,9 @@ WORKDIR $USER_WORKSPACE COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME # Create a new virtual environment for Python -RUN virtualenv .venv \ - && . .venv/bin/activate \ +ENV VIRTUAL_ENV=$USER_WORKSPACE/.venv/$PROJECT_NAME +RUN python3 -m venv $VIRTUAL_ENV \ + && echo "source ${VIRTUAL_ENV}/bin/activate" >> /home/$USERNAME/.bashrc \ && touch .venv/COLCON_IGNORE # Uncomment to download and install external repos used by the project @@ -77,7 +78,7 @@ WORKDIR $USER_WORKSPACE RUN sudo apt-get -q update \ && sudo apt-get -q -y upgrade \ && rosdep update \ - && rosdep install -y --from-paths src --ignore-src -r --rosdistro ${ROS_DISTRO} \ + && rosdep install -y --from-paths src --ignore-src --as-root=pip:false --rosdistro ${ROS_DISTRO} \ && sudo apt-get autoremove -y \ && sudo apt-get clean -y \ && sudo rm -rf /var/lib/apt/lists/* From 50cd0bbbdef04f4a635fe6c2e3ded88d462eb32e Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 17:51:09 -0700 Subject: [PATCH 04/18] Fixed venv install --- .docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 08a32e5..0807c71 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -21,7 +21,7 @@ RUN apt-get -q update \ clang-tools \ python3-pip \ python3-dev \ - python3-virtualenv \ + python3-venv \ apt-utils \ software-properties-common \ && apt-get autoremove -y \ From fa8e7caa1b76782134b57327c3ac4f0510ce6289 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 17:58:29 -0700 Subject: [PATCH 05/18] Another attempt --- .docker/Dockerfile | 2 +- example_pkg/package.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 0807c71..35ffbf2 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -66,7 +66,7 @@ COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME # Create a new virtual environment for Python ENV VIRTUAL_ENV=$USER_WORKSPACE/.venv/$PROJECT_NAME -RUN python3 -m venv $VIRTUAL_ENV \ +RUN python3 -m venv --system-site-packages $VIRTUAL_ENV \ && echo "source ${VIRTUAL_ENV}/bin/activate" >> /home/$USERNAME/.bashrc \ && touch .venv/COLCON_IGNORE diff --git a/example_pkg/package.xml b/example_pkg/package.xml index 541e4df..f67d5a0 100644 --- a/example_pkg/package.xml +++ b/example_pkg/package.xml @@ -7,7 +7,7 @@ A sample ROS 2 package Evan Palmer - BSD 3-Clause + MIT https://github.com/Robotic-Decision-Making-Lab/ros2-template.git https://github.com/Robotic-Decision-Making-Lab/ros2-template/issues From 1c760d9a5fd9c27560a1db334f14971a035c275d Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 18:18:46 -0700 Subject: [PATCH 06/18] Using ros binary install for gazebo --- .docker/Dockerfile | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 35ffbf2..903cf15 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -94,29 +94,11 @@ ENV DEBIAN_FRONTEND=noninteractive ENV USER_WORKSPACE=/home/$USERNAME/ws_ros WORKDIR $USER_WORKSPACE -# Install tools needed for Gazebo installation +# Install Gazebo RUN sudo apt-get -q update \ && sudo apt-get -q -y upgrade \ && sudo apt-get install -y \ - lsb-release \ - wget \ - gnupg \ - && sudo apt-get autoremove -y \ - && sudo apt-get clean -y \ - && sudo rm -rf /var/lib/apt/lists/* - -# Set to the desired version of Gazebo -# Refer to the official documentation for the recommended pairings: -# https://gazebosim.org/docs/harmonic/ros_installation -ENV GAZEBO_VERSION=harmonic - -RUN sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \ - && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null \ - && sudo apt-get -q update \ - && sudo apt-get -q -y upgrade \ - && sudo apt-get install -y \ - gz-$GAZEBO_VERSION \ - ros-$ROS_DISTRO-ros-gz$GAZEBO_VERSION \ + ros-$ROS_DISTRO-ros-gz \ && sudo apt-get autoremove -y \ && sudo apt-get clean -y \ && sudo rm -rf /var/lib/apt/lists/* From deef360f44af5d4cc5ec4fbd09e8af66291f8683 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 21:15:34 -0700 Subject: [PATCH 07/18] Testing ubuntu user --- .codespellrc | 4 ++++ .devcontainer/nouveau/Dockerfile | 14 ++++++++++++-- .devcontainer/nouveau/devcontainer.json | 6 +++--- .devcontainer/nvidia/Dockerfile | 14 ++++++++++++-- .devcontainer/nvidia/devcontainer.json | 6 +++--- .docker/Dockerfile | 20 +++----------------- .github/workflows/format.yml | 6 +++--- .pre-commit-config.yaml | 2 +- .vscode/settings.json | 10 +++++----- 9 files changed, 46 insertions(+), 36 deletions(-) create mode 100644 .codespellrc diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 0000000..a01d569 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,4 @@ +[codespell] +# Uncomment/populate the following so that codespell ignores the specified words +# skip = *.json +# ignore-words-list = example,words,to,ignore diff --git a/.devcontainer/nouveau/Dockerfile b/.devcontainer/nouveau/Dockerfile index 43a1f61..cc81c99 100644 --- a/.devcontainer/nouveau/Dockerfile +++ b/.devcontainer/nouveau/Dockerfile @@ -3,8 +3,6 @@ FROM ghcr.io/robotic-decision-making-lab/ros2-template:jazzy-desktop # Install ROS dependencies # This is done in a previous stage, but we include it again here in case anyone wants to # add new dependencies during development -ENV USERNAME=ros -ENV USER_WORKSPACE=/home/$USERNAME/ws_ros WORKDIR $USER_WORKSPACE COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME @@ -22,6 +20,18 @@ COPY --chown=$USER_UID:$USER_GID requirements-dev.txt . RUN $VIRTUAL_ENV/bin/pip install -r requirements-dev.txt \ && rm -rf requirements-dev.txt +# Install debugging/linting C++ packages +RUN sudo apt-get -q update \ + && sudo apt-get -q -y upgrade \ + && sudo apt-get install -y \ + clang \ + clang-format-18 \ + clang-tidy \ + clang-tools \ + && sudo apt-get autoremove -y \ + && sudo apt-get clean -y \ + && sudo rm -rf /var/lib/apt/lists/* + # Disable the setuputils installation warning # This prevents us from needing to pin the setuputils version (which doesn't always work) ENV PYTHONWARNINGS="ignore" diff --git a/.devcontainer/nouveau/devcontainer.json b/.devcontainer/nouveau/devcontainer.json index 3fcf6d9..aa27d10 100644 --- a/.devcontainer/nouveau/devcontainer.json +++ b/.devcontainer/nouveau/devcontainer.json @@ -2,9 +2,9 @@ "name": "ROS 2 Dev Container", "dockerFile": "Dockerfile", "context": "../..", - "workspaceMount": "source=${localWorkspaceFolder},target=/home/ros/ws_ros/src/ros2-template,type=bind", - "workspaceFolder": "/home/ros/ws_ros/src/ros2-template", - "remoteUser": "ros", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/ubuntu/ws_ros/src/ros2-template,type=bind", + "workspaceFolder": "/home/ubuntu/ws_ros/src/ros2-template", + "remoteUser": "ubuntu", "runArgs": [ "--network=host", "--cap-add=SYS_PTRACE", diff --git a/.devcontainer/nvidia/Dockerfile b/.devcontainer/nvidia/Dockerfile index 0c2037b..1d99d09 100644 --- a/.devcontainer/nvidia/Dockerfile +++ b/.devcontainer/nvidia/Dockerfile @@ -3,8 +3,6 @@ FROM ghcr.io/robotic-decision-making-lab/ros2-template:jazzy-desktop-nvidia # Install ROS dependencies # This is done in a previous stage, but we include it again here in case anyone wants to # add new dependencies during development -ENV USERNAME=ros -ENV USER_WORKSPACE=/home/$USERNAME/ws_ros WORKDIR $USER_WORKSPACE COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME @@ -22,6 +20,18 @@ COPY --chown=$USER_UID:$USER_GID requirements-dev.txt . RUN $VIRTUAL_ENV/bin/pip install -r requirements-dev.txt \ && rm -rf requirements-dev.txt +# Install debugging/linting C++ packages +RUN sudo apt-get -q update \ + && sudo apt-get -q -y upgrade \ + && sudo apt-get install -y \ + clang \ + clang-format-18 \ + clang-tidy \ + clang-tools \ + && sudo apt-get autoremove -y \ + && sudo apt-get clean -y \ + && sudo rm -rf /var/lib/apt/lists/* + # Disable the setuputils installation warning # This prevents us from needing to pin the setuputils version (which doesn't always work) ENV PYTHONWARNINGS="ignore" diff --git a/.devcontainer/nvidia/devcontainer.json b/.devcontainer/nvidia/devcontainer.json index 4bbbdb1..067f409 100644 --- a/.devcontainer/nvidia/devcontainer.json +++ b/.devcontainer/nvidia/devcontainer.json @@ -2,9 +2,9 @@ "name": "ROS 2 NVIDIA Dev Container", "dockerFile": "Dockerfile", "context": "../..", - "workspaceMount": "source=${localWorkspaceFolder},target=/home/ros/ws_ros/src/ros2-template,type=bind", - "workspaceFolder": "/home/ros/ws_ros/src/ros2-template", - "remoteUser": "ros", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/ubuntu/ws_ros/src/ros2-template,type=bind", + "workspaceFolder": "/home/ubuntu/ws_ros/src/ros2-template", + "remoteUser": "ubuntu", "runArgs": [ "--network=host", "--cap-add=SYS_PTRACE", diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 903cf15..61c7d2b 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -15,10 +15,6 @@ RUN apt-get -q update \ && apt-get -q install --no-install-recommends -y \ git \ sudo \ - clang \ - clang-format-14 \ - clang-tidy \ - clang-tools \ python3-pip \ python3-dev \ python3-venv \ @@ -40,21 +36,11 @@ RUN apt-get -q update \ FROM ci as robot -# Configure a new non-root user -ARG USERNAME=ros -ARG USER_UID=1001 +# Switch to the ubuntu non-root user +ARG USERNAME=ubuntu +ARG USER_UID=1000 ARG USER_GID=$USER_UID -RUN groups - -RUN groupadd --gid $USER_GID $USERNAME \ - && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ - && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ - && chmod 0440 /etc/sudoers.d/$USERNAME \ - && usermod -a -G dialout $USERNAME \ - && echo "source /usr/share/bash-completion/completions/git" >> /home/$USERNAME/.bashrc - -# Switch to the non-root user USER $USERNAME ENV USER=$USERNAME diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 0f5877d..f163acf 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -18,10 +18,10 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.12" - - name: Install clang-format-14 - run: sudo apt-get install clang-format-14 + - name: Install clang-format-18 + run: sudo apt-get install clang-format-18 - name: Run pre-commit uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 79ad31d..9d35030 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: - id: clang-format name: clang-format description: Format files with ClangFormat. - entry: clang-format-14 + entry: clang-format-18 language: system files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|js|m|proto|vert)$ args: ['-fallback-style=Google', '-i'] diff --git a/.vscode/settings.json b/.vscode/settings.json index e57cc54..1e2c3c9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,20 +23,20 @@ "autoDocstring.startOnNewLine": false, "autoDocstring.docstringFormat": "google-notypes", "python.autoComplete.extraPaths": [ - "/opt/ros/jazzy/lib/python3.10/site-packages/", - "/opt/ros/jazzy/local/lib/python3.10/dist-packages/", + "/opt/ros/jazzy/lib/python3.12/site-packages/", + "/opt/ros/jazzy/local/lib/python3.12/dist-packages/", "${workspaceFolder}/install/" ], "python.analysis.extraPaths": [ - "/opt/ros/jazzy/lib/python3.10/site-packages/", - "/opt/ros/jazzy/local/lib/python3.10/dist-packages/", + "/opt/ros/jazzy/lib/python3.12/site-packages/", + "/opt/ros/jazzy/local/lib/python3.12/dist-packages/", "${workspaceFolder}/install/" ], "C_Cpp.default.intelliSenseMode": "linux-gcc-x86", "C_Cpp.clang_format_fallbackStyle": "Google", "C_Cpp.codeAnalysis.clangTidy.enabled": true, "C_Cpp.codeAnalysis.clangTidy.codeAction.formatFixes": true, - "clang-format.executable": "/usr/bin/clang-format-14", + "clang-format.executable": "/usr/bin/clang-format-19", "[cpp]": { "editor.rulers": [120], "editor.tabSize": 2, From 950f561c9c9a901d7bf47acb4f6f9b4b0854ccf7 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 21:24:02 -0700 Subject: [PATCH 08/18] Adding ubuntu to sudoers list --- .docker/Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 61c7d2b..662a062 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -36,11 +36,16 @@ RUN apt-get -q update \ FROM ci as robot -# Switch to the ubuntu non-root user +# Configure the ubuntu non-root user ARG USERNAME=ubuntu ARG USER_UID=1000 ARG USER_GID=$USER_UID +RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME \ + && usermod -a -G dialout $USERNAME + +# Switch to the ubuntu non-root user USER $USERNAME ENV USER=$USERNAME From 851774972738931fd3a94a9b059b1a1dc7136ae6 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 21:26:36 -0700 Subject: [PATCH 09/18] Fixed cpp compiler install --- .devcontainer/nouveau/Dockerfile | 1 - .devcontainer/nvidia/Dockerfile | 1 - .docker/Dockerfile | 1 + 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.devcontainer/nouveau/Dockerfile b/.devcontainer/nouveau/Dockerfile index cc81c99..fa8e0ac 100644 --- a/.devcontainer/nouveau/Dockerfile +++ b/.devcontainer/nouveau/Dockerfile @@ -24,7 +24,6 @@ RUN $VIRTUAL_ENV/bin/pip install -r requirements-dev.txt \ RUN sudo apt-get -q update \ && sudo apt-get -q -y upgrade \ && sudo apt-get install -y \ - clang \ clang-format-18 \ clang-tidy \ clang-tools \ diff --git a/.devcontainer/nvidia/Dockerfile b/.devcontainer/nvidia/Dockerfile index 1d99d09..8e556dd 100644 --- a/.devcontainer/nvidia/Dockerfile +++ b/.devcontainer/nvidia/Dockerfile @@ -24,7 +24,6 @@ RUN $VIRTUAL_ENV/bin/pip install -r requirements-dev.txt \ RUN sudo apt-get -q update \ && sudo apt-get -q -y upgrade \ && sudo apt-get install -y \ - clang \ clang-format-18 \ clang-tidy \ clang-tools \ diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 662a062..244df23 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -15,6 +15,7 @@ RUN apt-get -q update \ && apt-get -q install --no-install-recommends -y \ git \ sudo \ + clang \ python3-pip \ python3-dev \ python3-venv \ From a8ea66f9d2fa4b7225a6b533bed6a06f97943428 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 22:04:09 -0700 Subject: [PATCH 10/18] Added venv to path --- .devcontainer/nouveau/Dockerfile | 2 +- .devcontainer/nvidia/Dockerfile | 2 +- .docker/Dockerfile | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.devcontainer/nouveau/Dockerfile b/.devcontainer/nouveau/Dockerfile index fa8e0ac..552dee0 100644 --- a/.devcontainer/nouveau/Dockerfile +++ b/.devcontainer/nouveau/Dockerfile @@ -17,7 +17,7 @@ RUN sudo apt-get -q update \ # Install debugging/linting Python packages COPY --chown=$USER_UID:$USER_GID requirements-dev.txt . -RUN $VIRTUAL_ENV/bin/pip install -r requirements-dev.txt \ +RUN pip install -r requirements-dev.txt \ && rm -rf requirements-dev.txt # Install debugging/linting C++ packages diff --git a/.devcontainer/nvidia/Dockerfile b/.devcontainer/nvidia/Dockerfile index 8e556dd..30452be 100644 --- a/.devcontainer/nvidia/Dockerfile +++ b/.devcontainer/nvidia/Dockerfile @@ -17,7 +17,7 @@ RUN sudo apt-get -q update \ # Install debugging/linting Python packages COPY --chown=$USER_UID:$USER_GID requirements-dev.txt . -RUN $VIRTUAL_ENV/bin/pip install -r requirements-dev.txt \ +RUN pip install -r requirements-dev.txt \ && rm -rf requirements-dev.txt # Install debugging/linting C++ packages diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 244df23..f2eb299 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -37,6 +37,8 @@ RUN apt-get -q update \ FROM ci as robot +ENV DEBIAN_FRONTEND=noninteractive + # Configure the ubuntu non-root user ARG USERNAME=ubuntu ARG USER_UID=1000 @@ -50,7 +52,6 @@ RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ USER $USERNAME ENV USER=$USERNAME -ENV DEBIAN_FRONTEND=noninteractive ENV USER_WORKSPACE=/home/$USERNAME/ws_ros WORKDIR $USER_WORKSPACE @@ -61,6 +62,7 @@ ENV VIRTUAL_ENV=$USER_WORKSPACE/.venv/$PROJECT_NAME RUN python3 -m venv --system-site-packages $VIRTUAL_ENV \ && echo "source ${VIRTUAL_ENV}/bin/activate" >> /home/$USERNAME/.bashrc \ && touch .venv/COLCON_IGNORE +ENV PATH="$VIRTUAL_ENV/bin:$PATH" # Uncomment to download and install external repos used by the project # RUN vcs import src < src/$PROJECT_NAME/ros2.repos From b1fce6cb096178e31eb6317b3fb15a0b012c2003 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 22:14:23 -0700 Subject: [PATCH 11/18] Fix python version in ruff config --- .ruff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruff.toml b/.ruff.toml index fef8156..8b96752 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -1 +1 @@ -target-version = "py310" +target-version = "py312" From d6de403da7f071188938dfc09f93293f70dee596 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 22:16:59 -0700 Subject: [PATCH 12/18] Switched back to main for pipelines --- .github/workflows/ci.yml | 2 +- .github/workflows/docker.yml | 2 +- .github/workflows/format.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b4ad40..9dce4c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: Continuous Integration on: push: branches: - - jazzy + - main pull_request: workflow_dispatch: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index effd541..a1c2652 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -3,7 +3,7 @@ name: Docker on: push: branches: - - jazzy + - main pull_request: paths: - .docker/** diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index f163acf..e7ed246 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -4,7 +4,7 @@ on: pull_request: push: branches: - - jazzy + - main workflow_dispatch: jobs: From ffbe7c747637bc840bbd07f2a10d38d484cc7566 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 22:38:57 -0700 Subject: [PATCH 13/18] Addressed PR comments --- .devcontainer/nouveau/Dockerfile | 8 ++++---- .devcontainer/nvidia/Dockerfile | 8 ++++---- .vscode/settings.json | 2 +- requirements-dev.txt | 3 --- 4 files changed, 9 insertions(+), 12 deletions(-) delete mode 100644 requirements-dev.txt diff --git a/.devcontainer/nouveau/Dockerfile b/.devcontainer/nouveau/Dockerfile index 552dee0..0a97311 100644 --- a/.devcontainer/nouveau/Dockerfile +++ b/.devcontainer/nouveau/Dockerfile @@ -10,15 +10,15 @@ COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME RUN sudo apt-get -q update \ && sudo apt-get -q -y upgrade \ && rosdep update \ - && rosdep install -y --from-paths . --ignore-src -r --as-root=pip:false --rosdistro ${ROS_DISTRO} \ + && rosdep install -y --from-paths . --ignore-src -r --rosdistro ${ROS_DISTRO} \ && sudo apt-get autoremove -y \ && sudo apt-get clean -y \ && sudo rm -rf /var/lib/apt/lists/* # Install debugging/linting Python packages -COPY --chown=$USER_UID:$USER_GID requirements-dev.txt . -RUN pip install -r requirements-dev.txt \ - && rm -rf requirements-dev.txt +RUN pip install \ + pre-commit \ + mypy # Install debugging/linting C++ packages RUN sudo apt-get -q update \ diff --git a/.devcontainer/nvidia/Dockerfile b/.devcontainer/nvidia/Dockerfile index 30452be..594696e 100644 --- a/.devcontainer/nvidia/Dockerfile +++ b/.devcontainer/nvidia/Dockerfile @@ -10,15 +10,15 @@ COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME RUN sudo apt-get -q update \ && sudo apt-get -q -y upgrade \ && rosdep update \ - && rosdep install -y --from-paths . --ignore-src -r --as-root=pip:false --rosdistro ${ROS_DISTRO} \ + && rosdep install -y --from-paths . --ignore-src -r --rosdistro ${ROS_DISTRO} \ && sudo apt-get autoremove -y \ && sudo apt-get clean -y \ && sudo rm -rf /var/lib/apt/lists/* # Install debugging/linting Python packages -COPY --chown=$USER_UID:$USER_GID requirements-dev.txt . -RUN pip install -r requirements-dev.txt \ - && rm -rf requirements-dev.txt +RUN pip install \ + pre-commit \ + mypy # Install debugging/linting C++ packages RUN sudo apt-get -q update \ diff --git a/.vscode/settings.json b/.vscode/settings.json index 1e2c3c9..a96abea 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -36,7 +36,7 @@ "C_Cpp.clang_format_fallbackStyle": "Google", "C_Cpp.codeAnalysis.clangTidy.enabled": true, "C_Cpp.codeAnalysis.clangTidy.codeAction.formatFixes": true, - "clang-format.executable": "/usr/bin/clang-format-19", + "clang-format.executable": "/usr/bin/clang-format-18", "[cpp]": { "editor.rulers": [120], "editor.tabSize": 2, diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index a3bd924..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,3 +0,0 @@ -# Development tools not required for project installation -pre-commit -mypy From 5370b2033d6d02f648544cde2cd464af778a21e2 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 22:41:32 -0700 Subject: [PATCH 14/18] Attempt at fixing format workflow --- .github/workflows/format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index e7ed246..948c4b5 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -21,7 +21,7 @@ jobs: python-version: "3.12" - name: Install clang-format-18 - run: sudo apt-get install clang-format-18 + run: sudo apt-get update && sudo apt-get install clang-format-18 - name: Run pre-commit uses: pre-commit/action@v3.0.1 From 9e68f5ed253b823595941caab1f8fdcafbd96576 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 22:44:12 -0700 Subject: [PATCH 15/18] Update to use 24.04 runner --- .github/workflows/format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 948c4b5..e88e0c3 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -10,7 +10,7 @@ on: jobs: pre-commit: name: Format - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout repository uses: actions/checkout@v4 From 178e0a5a9dcecf53b2dba806c2810079cb15567b Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 22:47:41 -0700 Subject: [PATCH 16/18] Addressed comment about codespell config --- .codespellrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.codespellrc b/.codespellrc index a01d569..4a6672a 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,4 +1,4 @@ [codespell] -# Uncomment/populate the following so that codespell ignores the specified words -# skip = *.json -# ignore-words-list = example,words,to,ignore +# Uncomment and populate the following so that codespell ignores the specified words/files +# skip = +# ignore-words-list = From 2b2748a8a3b03e782c98d1b729343fc0ce0a9430 Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Mon, 17 Jun 2024 22:50:56 -0700 Subject: [PATCH 17/18] removed unneccessary flag --- .docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index f2eb299..eb12052 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -72,7 +72,7 @@ WORKDIR $USER_WORKSPACE RUN sudo apt-get -q update \ && sudo apt-get -q -y upgrade \ && rosdep update \ - && rosdep install -y --from-paths src --ignore-src --as-root=pip:false --rosdistro ${ROS_DISTRO} \ + && rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} \ && sudo apt-get autoremove -y \ && sudo apt-get clean -y \ && sudo rm -rf /var/lib/apt/lists/* From 44ca67781dadc84a2642ea361d28d34aa5c42fcd Mon Sep 17 00:00:00 2001 From: Evan Palmer Date: Tue, 18 Jun 2024 00:31:19 -0700 Subject: [PATCH 18/18] Removed apt update --- .github/workflows/format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index e88e0c3..a6f4010 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -21,7 +21,7 @@ jobs: python-version: "3.12" - name: Install clang-format-18 - run: sudo apt-get update && sudo apt-get install clang-format-18 + run: sudo apt-get install clang-format-18 - name: Run pre-commit uses: pre-commit/action@v3.0.1