Skip to content

Commit ad612dc

Browse files
authored
Updates to support ROS 2 Rolling (#41)
* Updated dockerfile and devcontainer * Cleanup controllers for latest version of ros2_control * Removed dll_export stuff * Cleanup devcontainer * Updated to use latest version of hydrodynamics * Fix clang tidy errors * Resolve final error in CI * Fixed dev container name
1 parent 6384d7f commit ad612dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+851
-1310
lines changed

.clang-format

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ AlignAfterOpenBracket: AlwaysBreak
1212
ConstructorInitializerIndentWidth: 0
1313
ContinuationIndentWidth: 2
1414
DerivePointerAlignment: false
15+
AllowAllParametersOfDeclarationOnNextLine: false
1516
PointerAlignment: Middle
1617
PackConstructorInitializers: Never
18+
BinPackArguments: false
19+
BinPackParameters: false
1720

1821
# Configure brace wrapping cases
1922
BreakBeforeBraces: Custom

.clang-tidy

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ Checks: >
1313
-google-readability-namespace-comments,
1414
-google-runtime-references,
1515
-misc-non-private-member-variables-in-classes,
16-
-modernize-return-braced-init-list,
17-
-modernize-use-trailing-return-type,
1816
-readability-braces-around-statements,
1917
-readability-identifier-length,
2018
-readability-magic-numbers,
Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ARG ROS_DISTRO=iron
2-
FROM ros:$ROS_DISTRO-ros-base as ci
1+
ARG ROS_DISTRO=rolling
2+
FROM ros:$ROS_DISTRO-ros-base
33

44
ENV DEBIAN_FRONTEND=noninteractive
55
WORKDIR /root/ws_ros
@@ -15,86 +15,76 @@ RUN apt-get -q update \
1515
git \
1616
sudo \
1717
clang \
18-
clang-format-14 \
19-
clang-tidy \
20-
clang-tools \
2118
python3-pip \
2219
python3-dev \
20+
python3-venv \
2321
apt-utils \
2422
software-properties-common \
2523
&& apt-get autoremove -y \
2624
&& apt-get clean -y \
2725
&& rm -rf /var/lib/apt/lists/*
2826

29-
# Install all ROS dependencies needed for CI
30-
RUN vcs import src < src/$PROJECT_NAME/ros2.repos \
31-
&& apt-get -q update \
32-
&& apt-get -q -y upgrade \
33-
&& rosdep update \
34-
&& rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} --as-root=apt:false \
35-
&& rm -rf src \
36-
&& apt-get autoremove -y \
37-
&& apt-get clean -y \
38-
&& rm -rf /var/lib/apt/lists/*
39-
40-
FROM ci as desktop
41-
42-
# Configure a new non-root user
43-
ARG USERNAME=ros
27+
# Configure the ubuntu non-root user
28+
ARG USERNAME=ubuntu
4429
ARG USER_UID=1000
4530
ARG USER_GID=$USER_UID
4631

47-
RUN groupadd --gid $USER_GID $USERNAME \
48-
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
49-
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
32+
RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
5033
&& chmod 0440 /etc/sudoers.d/$USERNAME \
5134
&& usermod -a -G dialout $USERNAME \
5235
&& echo "source /usr/share/bash-completion/completions/git" >> /home/$USERNAME/.bashrc
5336

54-
# Switch to the non-root user
37+
# Switch to the ubuntu user
5538
USER $USERNAME
5639
ENV USER=$USERNAME
5740

58-
ENV DEBIAN_FRONTEND=noninteractive
5941
ENV USER_WORKSPACE=/home/$USERNAME/ws_ros
6042
WORKDIR $USER_WORKSPACE
6143

6244
COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME
6345

46+
# Create a new virtual environment for Python
47+
ENV VIRTUAL_ENV=$USER_WORKSPACE/.venv/$PROJECT_NAME
48+
RUN python3 -m venv --system-site-packages $VIRTUAL_ENV \
49+
&& echo "source ${VIRTUAL_ENV}/bin/activate" >> /home/$USERNAME/.bashrc \
50+
&& touch .venv/COLCON_IGNORE \
51+
&& echo "\n# Ensure colcon is run in the venv\nalias colcon='python3 -m colcon'" >> /home/$USERNAME/.bashrc
52+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
53+
6454
# Install all ROS dependencies
55+
RUN vcs import src < src/$PROJECT_NAME/ros2.repos
6556
WORKDIR $USER_WORKSPACE
66-
RUN vcs import src < src/$PROJECT_NAME/ros2.repos \
67-
&& sudo apt-get -q update \
57+
RUN sudo apt-get -q update \
6858
&& sudo apt-get -q -y upgrade \
6959
&& rosdep update \
70-
&& rosdep install -y --from-paths src --ignore-src -r --rosdistro ${ROS_DISTRO} \
60+
&& rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} \
7161
&& sudo apt-get autoremove -y \
7262
&& sudo apt-get clean -y \
7363
&& sudo rm -rf /var/lib/apt/lists/*
7464

7565
RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" \
7666
&& colcon build \
77-
&& sudo sed -i "s#/opt/ros/\$ROS_DISTRO/setup.bash#$USER_WORKSPACE/setup.sh#g" /ros_entrypoint.sh \
7867
&& echo "source ${USER_WORKSPACE}/install/setup.bash" >> /home/$USERNAME/.bashrc \
7968
&& echo "if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then source /opt/ros/${ROS_DISTRO}/setup.bash; fi" >> /home/$USERNAME/.bashrc
8069

81-
FROM desktop as desktop-nvidia
70+
WORKDIR $USER_WORKSPACE
8271

83-
# Install NVIDIA software
84-
RUN sudo apt-get update \
72+
# Install debugging/linting Python packages
73+
RUN pip install \
74+
pre-commit \
75+
mypy
76+
77+
# Install debugging/linting C++ packages
78+
RUN sudo apt-get -q update \
8579
&& sudo apt-get -q -y upgrade \
86-
&& sudo apt-get install -y -qq --no-install-recommends \
87-
libglvnd0 \
88-
libgl1 \
89-
libglx0 \
90-
libegl1 \
91-
libxext6 \
92-
libx11-6 \
80+
&& sudo apt-get install -y \
81+
clang-format-18 \
82+
clang-tidy \
83+
clang-tools \
9384
&& sudo apt-get autoremove -y \
9485
&& sudo apt-get clean -y \
9586
&& sudo rm -rf /var/lib/apt/lists/*
9687

97-
# Env vars for the nvidia-container-runtime.
98-
ENV NVIDIA_VISIBLE_DEVICES all
99-
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute
100-
ENV QT_X11_NO_MITSHM 1
88+
# Disable the setuputils installation warning
89+
# This prevents us from needing to pin the setuputils version (which doesn't always work)
90+
ENV PYTHONWARNINGS="ignore"

.devcontainer/devcontainer.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "ROS 2 Dev Container",
3+
"dockerFile": "Dockerfile",
4+
"context": "../",
5+
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ubuntu/ws_ros/src/auv_controllers,type=bind",
6+
"workspaceFolder": "/home/ubuntu/ws_ros/src/auv_controllers",
7+
"remoteUser": "ubuntu",
8+
"customizations": {
9+
"vscode": {
10+
"extensions": [
11+
"ms-azuretools.vscode-docker",
12+
"ms-python.python",
13+
"njpwerner.autodocstring",
14+
"ms-vscode.cpptools",
15+
"redhat.vscode-xml",
16+
"redhat.vscode-yaml",
17+
"smilerobotics.urdf",
18+
"DavidAnson.vscode-markdownlint",
19+
"esbenp.prettier-vscode",
20+
"xaver.clang-format",
21+
"charliermarsh.ruff",
22+
"ms-vscode.cmake-tools"
23+
]
24+
}
25+
}
26+
}

.devcontainer/nouveau/Dockerfile

Lines changed: 0 additions & 27 deletions
This file was deleted.

.devcontainer/nouveau/devcontainer.json

Lines changed: 0 additions & 42 deletions
This file was deleted.

.devcontainer/nvidia/Dockerfile

Lines changed: 0 additions & 27 deletions
This file was deleted.

.devcontainer/nvidia/devcontainer.json

Lines changed: 0 additions & 46 deletions
This file was deleted.

.dockerignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# ignore everything
2+
23
*
34

45
# Except the following
5-
!requirements-dev.txt
6+
67
!auv_controllers
78
!velocity_controllers
89
!thruster_allocation_matrix_controller
910
!thruster_controllers
1011
!auv_control_msgs
12+
!auv_control_demos
1113
!ros2.repos

.github/workflows/ci.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,17 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
env:
22-
- IMAGE: iron-ci
23-
ROS_DISTRO: iron
22+
- ROS_DISTRO: rolling
2423
steps:
2524
- name: Checkout repository
2625
uses: actions/checkout@v4
27-
with:
28-
submodules: recursive
29-
30-
- name: Log into registry
31-
uses: docker/login-action@v3.3.0
32-
with:
33-
registry: ghcr.io
34-
username: ${{ github.actor }}
35-
password: ${{ secrets.GITHUB_TOKEN }}
3626

3727
- name: Run ROS Industrial CI
3828
uses: ros-industrial/industrial_ci@master
3929
env:
40-
DOCKER_IMAGE: ghcr.io/robotic-decision-making-lab/auv_controllers:${{ matrix.env.IMAGE }}
30+
ROS_DISTRO: ${{ matrix.env.ROS_DISTRO }}
31+
CXXFLAGS: -Wall -Wextra -Wpedantic
32+
CLANG_TIDY: true
4133
UPSTREAM_WORKSPACE: ros2.repos
4234
AFTER_SETUP_UPSTREAM_WORKSPACE: vcs pull $BASEDIR/upstream_ws/src
4335
AFTER_SETUP_DOWNSTREAM_WORKSPACE: vcs pull $BASEDIR/downstream_ws/src
44-
CXXFLAGS: >-
45-
-Wall -Wextra -Wpedantic -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls
46-
CC: ${{ env.CLANG_TIDY && 'clang' }}
47-
CXX: ${{ env.CLANG_TIDY && 'clang++' }}

0 commit comments

Comments
 (0)