Skip to content

Commit

Permalink
chore(devcontainer): upgrade to ros jazzy/ubuntu-24.04
Browse files Browse the repository at this point in the history
  • Loading branch information
texhnolyze committed Nov 6, 2024
1 parent 89cb2ad commit 3c6dc0c
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 30 deletions.
39 changes: 19 additions & 20 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ros:iron
FROM ros:jazzy

ARG user=bitbots
ARG uid=1000
Expand Down Expand Up @@ -59,25 +59,16 @@ RUN apt update -y \
RUN apt-get install -y \
python3-rosdep \
python3-vcstool \
ros-iron-camera-calibration \
ros-iron-desktop \
ros-iron-joint-state-publisher-gui \
ros-iron-plotjuggler \
ros-iron-plotjuggler-msgs \
ros-iron-plotjuggler-ros \
ros-iron-rmw-cyclonedds-cpp \
ros-iron-rqt-robot-monitor \
ros-iron-soccer-vision-3d-rviz-markers

# Update pip and install colcon-clean
RUN pip3 install pip -U

# Install colcon extensions / patches
RUN python3 -m pip install \
git+https://github.com/ruffsl/colcon-clean \
git+https://github.com/timonegk/colcon-core.git@colors \
git+https://github.com/timonegk/colcon-notification.git@colors \
git+https://github.com/timonegk/colcon-output.git@colors
python3-virtualenv \
ros-jazzy-camera-calibration \
ros-jazzy-desktop \
ros-jazzy-joint-state-publisher-gui \
ros-jazzy-plotjuggler \
ros-jazzy-plotjuggler-msgs \
ros-jazzy-plotjuggler-ros \
ros-jazzy-rmw-cyclonedds-cpp \
ros-jazzy-rqt-robot-monitor \
ros-jazzy-soccer-vision-3d-rviz-markers

# Set zsh as default shell
SHELL ["/bin/zsh", "-c"]
Expand All @@ -87,12 +78,20 @@ SHELL ["/bin/zsh", "-c"]
# when the host user is part of the users group.
# Then create a bitbots user with home directory and add allow it to use sudo
RUN groupdel users \
&& userdel -r ubuntu \
&& useradd -m -U -u "$uid" -G sudo -s /bin/zsh $user \
&& groupmod -g "$gid" $user \
&& echo "$user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

USER $user

# Install pip colcon extensions / patches as user
RUN python3 -m pip install --user --break-system-packages \
git+https://github.com/ruffsl/colcon-clean \
git+https://github.com/timonegk/colcon-core.git@colors \
git+https://github.com/timonegk/colcon-notification.git@colors \
git+https://github.com/timonegk/colcon-output.git@colors

# Create colcon workspace
RUN mkdir -p /home/$user/colcon_ws/src

Expand Down
6 changes: 4 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Bit-Bots Iron Dev",
"name": "Bit-Bots Jazzy Dev",

"build": { "dockerfile": "Dockerfile" },

Expand All @@ -14,7 +14,9 @@
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": { "zsh": { "path": "/bin/zsh" } }
"terminal.integrated.profiles.linux": { "zsh": { "path": "/bin/zsh" } },
"dev.containers.copyGitConfig": false,
"dev.containers.gitCredentialHelperConfigLocation": "none"
},
"extensions": ["ms-iot.vscode-ros"]
}
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ install-no-root: pull-init update-no-root

pip:
# Install and upgrade pip dependencies
pip install --upgrade -r requirements/dev.txt --user
pip install --upgrade -r requirements/dev.txt --user --break-system-packages

pre-commit:
# Install pre-commit hooks for all submodules that have a .pre-commit-config.yaml file
Expand Down Expand Up @@ -91,7 +91,7 @@ rosdep:
[ -f /etc/ros/rosdep/sources.list.d/20-default.list ] || sudo rosdep init
# Update rosdep and install dependencies from meta directory
rosdep update
rosdep install --from-paths . --ignore-src --rosdistro iron -y
rosdep install --from-paths . --ignore-src --rosdistro jazzy -y

status:
# Show status of all repositories
Expand Down
22 changes: 16 additions & 6 deletions scripts/ros.plugin.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
### Aliases and functions for ROS 2 and colcon usage. Usage for either
### Ubuntu 22.04 or in rosdocked/dev docker container
### Ubuntu 22.04/24.04 or in rosdocked/dev docker container

shell="$(basename "$SHELL")"
ros_releases=(iron jazzy rolling)
distro="$ROS_DISTRO"

rid() {
export ROS_DOMAIN_ID="$1"
Expand All @@ -12,13 +14,21 @@ rid() {
# This needs to be called every time we source something ROS 2 related.
# Previous loading of bashcompinit is required.
update_ros2_argcomplete() {
eval "$(register-python-argcomplete3 colcon)"
eval "$(register-python-argcomplete3 ros2)"
eval "$(register-python-argcomplete colcon)"
eval "$(register-python-argcomplete ros2)"
}

# Source the ROS 2 setup files if iron is installed
if [[ -d /opt/ros/iron ]]; then
source "/opt/ros/iron/setup.$shell" &> /dev/null
if [[ -n "$distro" ]]; then
source "/opt/ros/$distro/setup.$shell" &> /dev/null
else
for release in "${ros_releases[@]}"; do
if [[ -d "/opt/ros/$release" ]]; then
source "/opt/ros/$release/setup.$shell" &> /dev/null
distro="$release"
break
fi
done
fi

# Update the tab completion
Expand All @@ -45,7 +55,7 @@ alias cb='cdc && colcon build --symlink-install --continue-on-error --packages-u
alias cc='cdc && colcon clean packages --packages-select'
alias cca='cdc && colcon clean packages'

alias sr="source /opt/ros/iron/setup.$shell && update_ros2_argcomplete"
alias sr="source /opt/ros/$distro/setup.$shell && update_ros2_argcomplete"
alias sc="source \$COLCON_WS/install/setup.$shell && update_ros2_argcomplete"
alias sa='sr && sc'

Expand Down

0 comments on commit 3c6dc0c

Please sign in to comment.