Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions .devcontainer/base_station/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
ARG ROS_DISTRO=humble
ARG USERNAME=loop_dev
ARG USER_UID=1000
ARG USER_GID=${USER_UID}
ARG MACHINE_TYPE=developer

ENV ROS_DISTRO=${ROS_DISTRO}
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
ENV SHELL=/bin/bash

SHELL ["/bin/bash", "-c"]

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gnupg \
lsb-release \
locales \
software-properties-common \
sudo \
&& locale-gen en_US en_US.UTF-8 \
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 \
&& add-apt-repository universe \
&& curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key \
-o /usr/share/keyrings/ros-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo ${UBUNTU_CODENAME}) main" \
> /etc/apt/sources.list.d/ros2.list \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y --no-install-recommends \
bash-completion \
build-essential \
can-utils \
clang-format \
cmake \
evtest \
geographiclib-tools \
git \
git-lfs \
gdb \
htop \
iproute2 \
iputils-ping \
libboost-chrono-dev \
libboost-date-time-dev \
libboost-filesystem-dev \
libboost-program-options-dev \
libboost-regex-dev \
libboost-serialization-dev \
libboost-system-dev \
libboost-thread-dev \
libboost-timer-dev \
libgeographic-dev \
libopencv-dev \
libpcl-dev \
libserial-dev \
nano \
net-tools \
openssh-client \
python3-dev \
python3-colcon-common-extensions \
python3-pip \
python3-rosdep \
python3-serial \
python3-vcstool \
python3-venv \
ruby \
tmux \
tmuxinator \
udev \
unzip \
usbutils \
vim \
wget \
&& apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-desktop \
ros-${ROS_DISTRO}-moveit \
ros-${ROS_DISTRO}-navigation2 \
ros-${ROS_DISTRO}-nav2-bringup \
ros-${ROS_DISTRO}-ros2-control \
ros-${ROS_DISTRO}-ros2-controllers \
ros-${ROS_DISTRO}-ros2-control-test-assets \
ros-${ROS_DISTRO}-ros2controlcli \
ros-${ROS_DISTRO}-control-msgs \
ros-${ROS_DISTRO}-controller-manager \
ros-${ROS_DISTRO}-cv-bridge \
ros-${ROS_DISTRO}-eigen3-cmake-module \
ros-${ROS_DISTRO}-generate-parameter-library \
ros-${ROS_DISTRO}-geographic-msgs \
ros-${ROS_DISTRO}-gps-msgs \
ros-${ROS_DISTRO}-gtsam \
ros-${ROS_DISTRO}-gz-ros2-control \
ros-${ROS_DISTRO}-image-transport-plugins \
ros-${ROS_DISTRO}-joint-state-broadcaster \
ros-${ROS_DISTRO}-joint-state-publisher \
ros-${ROS_DISTRO}-joint-state-publisher-gui \
ros-${ROS_DISTRO}-joint-trajectory-controller \
ros-${ROS_DISTRO}-kdl-parser \
ros-${ROS_DISTRO}-moveit-configs-utils \
ros-${ROS_DISTRO}-moveit-kinematics \
ros-${ROS_DISTRO}-moveit-planners \
ros-${ROS_DISTRO}-moveit-ros-planning-interface \
ros-${ROS_DISTRO}-moveit-simple-controller-manager \
ros-${ROS_DISTRO}-nmea-msgs \
ros-${ROS_DISTRO}-pcl-conversions \
ros-${ROS_DISTRO}-position-controllers \
ros-${ROS_DISTRO}-realtime-tools \
ros-${ROS_DISTRO}-robot-localization \
ros-${ROS_DISTRO}-robot-state-publisher \
ros-${ROS_DISTRO}-ros-gz \
ros-${ROS_DISTRO}-ros-gz-bridge \
ros-${ROS_DISTRO}-ros-gz-sim \
ros-${ROS_DISTRO}-rosidl-default-generators \
ros-${ROS_DISTRO}-tf2-eigen \
ros-${ROS_DISTRO}-tf2-geometry-msgs \
ros-${ROS_DISTRO}-tf2-ros \
ros-${ROS_DISTRO}-tf2-sensor-msgs \
ros-${ROS_DISTRO}-topic-tools \
ros-${ROS_DISTRO}-velocity-controllers \
ros-${ROS_DISTRO}-vision-msgs \
ros-${ROS_DISTRO}-xacro \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt /tmp/requirements.txt
RUN python3 -m pip install --no-cache-dir --upgrade pip \
&& python3 -m pip install --no-cache-dir -r /tmp/requirements.txt

COPY libmavsdk-dev_3.14.0_ubuntu22.04_amd64.deb /tmp/libmavsdk-dev_3.14.0_ubuntu22.04_amd64.deb
RUN dpkg -i /tmp/libmavsdk-dev_3.14.0_ubuntu22.04_amd64.deb \
|| (apt-get update && apt-get install -y --no-install-recommends -f && rm -rf /var/lib/apt/lists/*) \
&& rm -f /tmp/libmavsdk-dev_3.14.0_ubuntu22.04_amd64.deb

RUN if ! getent group ${USER_GID} >/dev/null; then groupadd --gid ${USER_GID} ${USERNAME}; fi \
&& if ! id -u ${USERNAME} >/dev/null 2>&1; then useradd --uid ${USER_UID} --gid ${USER_GID} -m ${USERNAME} -s /bin/bash; fi \
&& usermod -aG sudo,dialout,video,plugdev ${USERNAME} \
&& echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME}

RUN rosdep init || true

COPY .devcontainer/loop_ascii.txt /etc/loop_ascii.txt

RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /etc/bash.bashrc

USER ${USERNAME}
RUN touch /home/${USERNAME}/.hushlogin
RUN printf '\nif [[ $- == *i* ]] && [[ -r /etc/loop_ascii.txt ]]; then\n printf '"'"'%%b\\n'"'"' "$(cat /etc/loop_ascii.txt)"\nfi\n' \
>> /home/${USERNAME}/.bashrc

WORKDIR /athena-code
17 changes: 17 additions & 0 deletions .devcontainer/base_station/build_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail

config_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
repo_root="$(cd -- "${config_dir}/../.." && pwd)"
machine_type="$(basename -- "${config_dir}")"
image_name="athena-code:${machine_type}"

docker build \
--file "${config_dir}/Dockerfile" \
--build-arg "MACHINE_TYPE=${machine_type}" \
--build-arg "USER_UID=$(id -u)" \
--build-arg "USER_GID=$(id -g)" \
--tag "${image_name}" \
"${repo_root}"

echo "Built ${image_name}"
40 changes: 40 additions & 0 deletions .devcontainer/base_station/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "Athena ROS 2 Humble (Base Station)",
"build": {
"dockerfile": "Dockerfile",
"context": "../..",
"args": {
"MACHINE_TYPE": "base_station"
}
},
"remoteUser": "loop_dev",
"updateRemoteUserUID": true,
"workspaceFolder": "/athena-code",
"workspaceMount": "source=${localWorkspaceFolder},target=/athena-code,type=bind,consistency=cached",
"postCreateCommand": ".devcontainer/base_station/post_create.sh",
"runArgs": [
"--network=host",
"--ipc=host",
"--privileged"
],
"containerEnv": {
"ROS_DISTRO": "humble",
"RMW_IMPLEMENTATION": "rmw_fastrtps_cpp",
"ATHENA_MACHINE_TYPE": "base_station"
},
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools",
"ms-python.python",
"ms-iot.vscode-ros",
"openai.chatgpt",
"cweijan.vscode-office",
"esben.prettier-vscode",
"redhat.vscode-xml",
"tamasfe.even-better-toml"
]
}
}
}
12 changes: 12 additions & 0 deletions .devcontainer/base_station/post_create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail

set +u
source "/opt/ros/${ROS_DISTRO}/setup.bash"
set -u

sudo apt-get update
sudo rosdep update
sudo rosdep install -r --from-paths src --ignore-src --rosdistro "$ROS_DISTRO" -y

colcon build --symlink-install
33 changes: 33 additions & 0 deletions .devcontainer/base_station/run_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -euo pipefail

config_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
repo_root="$(cd -- "${config_dir}/../.." && pwd)"
machine_type="$(basename -- "${config_dir}")"
image_name="athena-code:${machine_type}"
command=("$@")
if [[ ${#command[@]} -eq 0 ]]; then
command=(bash)
fi

docker_args=(
--rm
--interactive
--tty
--network host
--ipc host
--privileged
--env "ROS_DISTRO=humble"
--env "RMW_IMPLEMENTATION=rmw_fastrtps_cpp"
--volume "${repo_root}:/athena-code"
--workdir /athena-code
)

if [[ -n "${DISPLAY:-}" && -d /tmp/.X11-unix ]]; then
docker_args+=(
--env "DISPLAY=${DISPLAY}"
--volume /tmp/.X11-unix:/tmp/.X11-unix:rw
)
fi

docker run "${docker_args[@]}" "${image_name}" "${command[@]}"
Loading
Loading