Skip to content

Commit b24a95d

Browse files
authored
Initialize iron
0 parents  commit b24a95d

30 files changed

+1187
-0
lines changed

.clang-format

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: Google
4+
ColumnLimit: 120
5+
MaxEmptyLinesToKeep: 1
6+
7+
IndentWidth: 2
8+
TabWidth: 2
9+
UseTab: Never
10+
AccessModifierOffset: -2
11+
AlignAfterOpenBracket: AlwaysBreak
12+
ConstructorInitializerIndentWidth: 0
13+
ContinuationIndentWidth: 2
14+
DerivePointerAlignment: false
15+
PointerAlignment: Middle
16+
PackConstructorInitializers: Never
17+
18+
# Configure brace wrapping cases
19+
BreakBeforeBraces: Custom
20+
BraceWrapping:
21+
AfterClass: true
22+
AfterEnum: true
23+
AfterFunction: true
24+
AfterNamespace: true
25+
AfterStruct: true
26+
AfterUnion: true
27+
BeforeCatch: true

.clang-tidy

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
Checks: >
3+
-*,
4+
abseil-*,
5+
bugprone-*,
6+
google-*,
7+
misc-*,
8+
modernize-*,
9+
performance-*,
10+
portability-*,
11+
readability-*,
12+
-google-readability-braces-around-statements,
13+
-google-readability-namespace-comments,
14+
-google-runtime-references,
15+
-misc-non-private-member-variables-in-classes,
16+
-modernize-return-braced-init-list,
17+
-modernize-use-trailing-return-type,
18+
-readability-braces-around-statements,
19+
-readability-identifier-length,
20+
-readability-magic-numbers,
21+
-readability-named-parameter,
22+
-readability-redundant-declaration,
23+
-readability-function-cognitive-complexity,
24+
-bugprone-narrowing-conversions,
25+
-bugprone-easily-swappable-parameters,
26+
-bugprone-implicit-widening-of-multiplication-result,
27+
-clang-diagnostic-error,
28+
-bugprone-exception-escape,
29+
-misc-include-cleaner,
30+
-bugprone-reserved-identifier
31+
WarningsAsErrors: "*"
32+
CheckOptions:
33+
- key: readability-braces-around-statements.ShortStatementLines
34+
value: "2"
35+
- key: readability-identifier-naming.NamespaceCase
36+
value: lower_case
37+
# type names
38+
- key: readability-identifier-naming.ClassCase
39+
value: CamelCase
40+
- key: readability-identifier-naming.StructCase
41+
value: CamelCase
42+
- key: readability-identifier-naming.EnumCase
43+
value: CamelCase
44+
- key: readability-identifier-naming.UnionCase
45+
value: CamelCase
46+
# function names
47+
- key: readability-identifier-naming.FunctionCase
48+
value: lower_case
49+
# method names
50+
- key: readability-identifier-naming.MethodCase
51+
value: lower_case
52+
# variable names
53+
- key: readability-identifier-naming.VariableCase
54+
value: lower_case
55+
- key: readability-identifier-naming.PrivateMemberSuffix
56+
value: "_"
57+
- key: readability-identifier-naming.ProtectedMemberSuffix
58+
value: "_"
59+
# const, static, or global variables
60+
- key: readability-identifier-naming.EnumConstantCase
61+
value: UPPER_CASE
62+
- key: readability-identifier-naming.StaticConstantCase
63+
value: UPPER_CASE
64+
- key: readability-identifier-naming.GlobalConstantCase
65+
value: UPPER_CASE
66+
- key: readability-identifier-naming.ClassConstantCase
67+
value: UPPER_CASE

.codespellrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[codespell]
2+
# Uncomment and populate the following so that codespell ignores the specified words/files
3+
# skip =
4+
# ignore-words-list =

.devcontainer/nouveau/Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM ghcr.io/robotic-decision-making-lab/ros2-template:iron-desktop
2+
3+
# Install ROS dependencies
4+
# This is done in a previous stage, but we include it again here in case anyone wants to
5+
# add new dependencies during development
6+
WORKDIR $USER_WORKSPACE
7+
8+
COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME
9+
10+
RUN sudo apt-get -q update \
11+
&& sudo apt-get -q -y upgrade \
12+
&& rosdep update \
13+
&& rosdep install -y --from-paths . --ignore-src -r --rosdistro ${ROS_DISTRO} \
14+
&& sudo apt-get autoremove -y \
15+
&& sudo apt-get clean -y \
16+
&& sudo rm -rf /var/lib/apt/lists/*
17+
18+
# Install debugging/linting Python packages
19+
RUN python3 -m pip install \
20+
pre-commit \
21+
mypy
22+
23+
# Install debugging/linting C++ packages
24+
RUN sudo apt-get -q update \
25+
&& sudo apt-get -q -y upgrade \
26+
&& sudo apt-get install -y \
27+
clang-format-14 \
28+
clang-tidy \
29+
clang-tools \
30+
&& sudo apt-get autoremove -y \
31+
&& sudo apt-get clean -y \
32+
&& sudo rm -rf /var/lib/apt/lists/*
33+
34+
# Disable the setuputils installation warning
35+
# This prevents us from needing to pin the setuputils version (which doesn't always work)
36+
ENV PYTHONWARNINGS="ignore"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "ROS 2 Dev Container",
3+
"dockerFile": "Dockerfile",
4+
"context": "../..",
5+
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ros/ws_ros/src/ros2-template,type=bind",
6+
"workspaceFolder": "/home/ros/ws_ros/src/ros2-template",
7+
"remoteUser": "ros",
8+
"runArgs": [
9+
"--network=host",
10+
"--cap-add=SYS_PTRACE",
11+
"--security-opt=seccomp:unconfined",
12+
"--security-opt=apparmor:unconfined",
13+
"--volume=/dev:/dev",
14+
"--privileged",
15+
"--volume=/run/user/1000:/run/user/1000"
16+
],
17+
"containerEnv": {
18+
"DISPLAY": "${localEnv:DISPLAY}",
19+
"WAYLAND_DISPLAY": "${localEnv:WAYLAND_DISPLAY}",
20+
"XDG_RUNTIME_DIR": "${localEnv:XDG_RUNTIME_DIR}",
21+
"PULSE_SERVER": "${localEnv:PULSE_SERVER}"
22+
},
23+
"customizations": {
24+
"vscode": {
25+
"extensions": [
26+
"ms-azuretools.vscode-docker",
27+
"ms-python.python",
28+
"njpwerner.autodocstring",
29+
"ms-vscode.cpptools",
30+
"redhat.vscode-xml",
31+
"redhat.vscode-yaml",
32+
"smilerobotics.urdf",
33+
"DavidAnson.vscode-markdownlint",
34+
"esbenp.prettier-vscode",
35+
"xaver.clang-format",
36+
"charliermarsh.ruff",
37+
"ms-vscode.cmake-tools"
38+
]
39+
}
40+
}
41+
}

.devcontainer/nvidia/Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM ghcr.io/robotic-decision-making-lab/ros2-template:iron-desktop-nvidia
2+
3+
# Install ROS dependencies
4+
# This is done in a previous stage, but we include it again here in case anyone wants to
5+
# add new dependencies during development
6+
WORKDIR $USER_WORKSPACE
7+
8+
COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME
9+
10+
RUN sudo apt-get -q update \
11+
&& sudo apt-get -q -y upgrade \
12+
&& rosdep update \
13+
&& rosdep install -y --from-paths . --ignore-src -r --rosdistro ${ROS_DISTRO} \
14+
&& sudo apt-get autoremove -y \
15+
&& sudo apt-get clean -y \
16+
&& sudo rm -rf /var/lib/apt/lists/*
17+
18+
# Install debugging/linting Python packages
19+
RUN python3 -m pip install \
20+
pre-commit \
21+
mypy
22+
23+
# Install debugging/linting C++ packages
24+
RUN sudo apt-get -q update \
25+
&& sudo apt-get -q -y upgrade \
26+
&& sudo apt-get install -y \
27+
clang-format-14 \
28+
clang-tidy \
29+
clang-tools \
30+
&& sudo apt-get autoremove -y \
31+
&& sudo apt-get clean -y \
32+
&& sudo rm -rf /var/lib/apt/lists/*
33+
34+
# Disable the setuputils installation warning
35+
# This prevents us from needing to pin the setuputils version (which doesn't always work)
36+
ENV PYTHONWARNINGS="ignore"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "ROS 2 NVIDIA Dev Container",
3+
"dockerFile": "Dockerfile",
4+
"context": "../..",
5+
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ros/ws_ros/src/ros2-template,type=bind",
6+
"workspaceFolder": "/home/ros/ws_ros/src/ros2-template",
7+
"remoteUser": "ros",
8+
"runArgs": [
9+
"--network=host",
10+
"--cap-add=SYS_PTRACE",
11+
"--security-opt=seccomp:unconfined",
12+
"--security-opt=apparmor:unconfined",
13+
"--volume=/dev:/dev",
14+
"--privileged",
15+
"--volume=/tmp/.X11-unix:/tmp/.X11-unix",
16+
"--volume=/mnt/wslg:/mnt/wslg",
17+
"--gpus=all"
18+
],
19+
"containerEnv": {
20+
"DISPLAY": "${localEnv:DISPLAY}",
21+
"WAYLAND_DISPLAY": "${localEnv:WAYLAND_DISPLAY}",
22+
"XDG_RUNTIME_DIR": "${localEnv:XDG_RUNTIME_DIR}",
23+
"PULSE_SERVER": "${localEnv:PULSE_SERVER}",
24+
"LIBGL_ALWAYS_SOFTWARE": "1",
25+
"QT_X11_NO_MITSHM": "1"
26+
},
27+
"customizations": {
28+
"vscode": {
29+
"extensions": [
30+
"ms-azuretools.vscode-docker",
31+
"ms-python.python",
32+
"njpwerner.autodocstring",
33+
"ms-vscode.cpptools",
34+
"redhat.vscode-xml",
35+
"redhat.vscode-yaml",
36+
"smilerobotics.urdf",
37+
"DavidAnson.vscode-markdownlint",
38+
"esbenp.prettier-vscode",
39+
"xaver.clang-format",
40+
"charliermarsh.ruff",
41+
"ms-vscode.cmake-tools"
42+
]
43+
}
44+
}
45+
}

.docker/Dockerfile

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
ARG ROS_DISTRO=iron
2+
FROM ros:$ROS_DISTRO-ros-base as ci
3+
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
WORKDIR /root/ws_ros
6+
7+
# Update to be your project's name
8+
ENV PROJECT_NAME=ros2-template
9+
10+
COPY . src/$PROJECT_NAME
11+
12+
# Install apt packages
13+
RUN apt-get -q update \
14+
&& apt-get -q -y upgrade \
15+
&& apt-get -q install --no-install-recommends -y \
16+
git \
17+
sudo \
18+
clang \
19+
clang-format-14 \
20+
clang-tidy \
21+
clang-tools \
22+
python3-pip \
23+
python3-dev \
24+
apt-utils \
25+
software-properties-common \
26+
&& apt-get autoremove -y \
27+
&& apt-get clean -y \
28+
&& rm -rf /var/lib/apt/lists/*
29+
30+
# Install all ROS dependencies needed for CI
31+
RUN 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 robot
41+
42+
# Configure a new non-root user
43+
ARG USERNAME=ubuntu
44+
ARG USER_UID=1000
45+
ARG USER_GID=$USER_UID
46+
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 \
50+
&& chmod 0440 /etc/sudoers.d/$USERNAME \
51+
&& usermod -a -G dialout $USERNAME \
52+
&& echo "source /usr/share/bash-completion/completions/git" >> /home/$USERNAME/.bashrc
53+
54+
# Switch to the non-root user
55+
USER $USERNAME
56+
ENV USER=$USERNAME
57+
58+
ENV DEBIAN_FRONTEND=noninteractive
59+
ENV USER_WORKSPACE=/home/$USERNAME/ws_ros
60+
WORKDIR $USER_WORKSPACE
61+
62+
COPY --chown=$USER_UID:$USER_GID . src/$PROJECT_NAME
63+
64+
# Uncomment to download and install external repos used by the project
65+
# RUN vcs import src < src/$PROJECT_NAME/ros2.repos
66+
67+
# Install all ROS dependencies
68+
WORKDIR $USER_WORKSPACE
69+
RUN sudo apt-get -q update \
70+
&& sudo apt-get -q -y upgrade \
71+
&& rosdep update \
72+
&& rosdep install -y --from-paths src --ignore-src -r --rosdistro ${ROS_DISTRO} \
73+
&& sudo apt-get autoremove -y \
74+
&& sudo apt-get clean -y \
75+
&& sudo rm -rf /var/lib/apt/lists/*
76+
77+
RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" \
78+
&& colcon build \
79+
&& echo "source ${USER_WORKSPACE}/install/setup.bash" >> /home/$USERNAME/.bashrc \
80+
&& echo "if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then source /opt/ros/${ROS_DISTRO}/setup.bash; fi" >> /home/$USERNAME/.bashrc
81+
82+
FROM robot as desktop
83+
84+
ENV DEBIAN_FRONTEND=noninteractive
85+
ENV USER_WORKSPACE=/home/$USERNAME/ws_ros
86+
WORKDIR $USER_WORKSPACE
87+
88+
# Install tools needed for Gazebo installation
89+
RUN sudo apt-get -q update \
90+
&& sudo apt-get -q -y upgrade \
91+
&& sudo apt-get install -y \
92+
lsb-release \
93+
wget \
94+
gnupg \
95+
&& sudo apt-get autoremove -y \
96+
&& sudo apt-get clean -y \
97+
&& sudo rm -rf /var/lib/apt/lists/*
98+
99+
# Set to the desired version of Gazebo
100+
# Refer to the official documentation for the recommended pairings:
101+
# https://gazebosim.org/docs/harmonic/ros_installation
102+
ENV GAZEBO_VERSION=harmonic
103+
104+
RUN sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \
105+
&& 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 \
106+
&& sudo apt-get -q update \
107+
&& sudo apt-get -q -y upgrade \
108+
&& sudo apt-get install -y \
109+
gz-$GAZEBO_VERSION \
110+
ros-$ROS_DISTRO-ros-gz$GAZEBO_VERSION \
111+
&& sudo apt-get autoremove -y \
112+
&& sudo apt-get clean -y \
113+
&& sudo rm -rf /var/lib/apt/lists/*
114+
115+
FROM desktop as desktop-nvidia
116+
117+
# Install NVIDIA software
118+
RUN sudo apt-get update \
119+
&& sudo apt-get -q -y upgrade \
120+
&& sudo apt-get install -y -qq --no-install-recommends \
121+
libglvnd0 \
122+
libgl1 \
123+
libglx0 \
124+
libegl1 \
125+
libxext6 \
126+
libx11-6 \
127+
&& sudo apt-get autoremove -y \
128+
&& sudo apt-get clean -y \
129+
&& sudo rm -rf /var/lib/apt/lists/*
130+
131+
# Env vars for the nvidia-container-runtime.
132+
ENV NVIDIA_VISIBLE_DEVICES=all
133+
ENV NVIDIA_DRIVER_CAPABILITIES=graphics,utility,compute
134+
ENV QT_X11_NO_MITSHM=1

0 commit comments

Comments
 (0)