diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 0000000..4a6672a --- /dev/null +++ b/.codespellrc @@ -0,0 +1,4 @@ +[codespell] +# Uncomment and populate the following so that codespell ignores the specified words/files +# skip = +# ignore-words-list = diff --git a/.devcontainer/nouveau/Dockerfile b/.devcontainer/nouveau/Dockerfile index b819348..0a97311 100644 --- a/.devcontainer/nouveau/Dockerfile +++ b/.devcontainer/nouveau/Dockerfile @@ -1,10 +1,8 @@ -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 # 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 @@ -18,9 +16,20 @@ RUN sudo apt-get -q update \ && 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 \ - && rm -rf requirements-dev.txt +RUN pip install \ + pre-commit \ + mypy + +# Install debugging/linting C++ packages +RUN sudo apt-get -q update \ + && sudo apt-get -q -y upgrade \ + && sudo apt-get install -y \ + 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) 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 3d2e46e..594696e 100644 --- a/.devcontainer/nvidia/Dockerfile +++ b/.devcontainer/nvidia/Dockerfile @@ -1,10 +1,8 @@ -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 # 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 @@ -18,9 +16,20 @@ RUN sudo apt-get -q update \ && 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 \ - && rm -rf requirements-dev.txt +RUN pip install \ + pre-commit \ + mypy + +# Install debugging/linting C++ packages +RUN sudo apt-get -q update \ + && sudo apt-get -q -y upgrade \ + && sudo apt-get install -y \ + 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) 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 75caefd..eb12052 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 @@ -16,11 +16,9 @@ RUN apt-get -q update \ git \ sudo \ clang \ - clang-format-14 \ - clang-tidy \ - clang-tools \ python3-pip \ python3-dev \ + python3-venv \ apt-utils \ software-properties-common \ && apt-get autoremove -y \ @@ -39,28 +37,33 @@ RUN apt-get -q update \ FROM ci as robot -# Configure a new non-root user -ARG USERNAME=ros +ENV DEBIAN_FRONTEND=noninteractive + +# Configure the ubuntu non-root user +ARG USERNAME=ubuntu ARG USER_UID=1000 ARG USER_GID=$USER_UID -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 \ +RUN 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 + && usermod -a -G dialout $USERNAME -# Switch to the non-root user +# Switch to the ubuntu non-root user USER $USERNAME ENV USER=$USERNAME -ENV DEBIAN_FRONTEND=noninteractive ENV USER_WORKSPACE=/home/$USERNAME/ws_ros WORKDIR $USER_WORKSPACE 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 --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 @@ -69,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 -r --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/* @@ -85,29 +88,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/* diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ed9868..9dce4c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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..a1c2652 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -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..a6f4010 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 @@ -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/.gitignore b/.gitignore index 7e1fc9a..0c6b602 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ build install log + +# virtualenv +.venv 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/.ruff.toml b/.ruff.toml index fef8156..8b96752 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -1 +1 @@ -target-version = "py310" +target-version = "py312" 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..a96abea 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/iron/lib/python3.10/site-packages/", - "/opt/ros/iron/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/iron/lib/python3.10/site-packages/", - "/opt/ros/iron/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-18", "[cpp]": { "editor.rulers": [120], "editor.tabSize": 2, 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 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