Skip to content

Commit 3c6dc0c

Browse files
committed
chore(devcontainer): upgrade to ros jazzy/ubuntu-24.04
1 parent 89cb2ad commit 3c6dc0c

File tree

4 files changed

+41
-30
lines changed

4 files changed

+41
-30
lines changed

.devcontainer/Dockerfile

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ros:iron
1+
FROM ros:jazzy
22

33
ARG user=bitbots
44
ARG uid=1000
@@ -59,25 +59,16 @@ RUN apt update -y \
5959
RUN apt-get install -y \
6060
python3-rosdep \
6161
python3-vcstool \
62-
ros-iron-camera-calibration \
63-
ros-iron-desktop \
64-
ros-iron-joint-state-publisher-gui \
65-
ros-iron-plotjuggler \
66-
ros-iron-plotjuggler-msgs \
67-
ros-iron-plotjuggler-ros \
68-
ros-iron-rmw-cyclonedds-cpp \
69-
ros-iron-rqt-robot-monitor \
70-
ros-iron-soccer-vision-3d-rviz-markers
71-
72-
# Update pip and install colcon-clean
73-
RUN pip3 install pip -U
74-
75-
# Install colcon extensions / patches
76-
RUN python3 -m pip install \
77-
git+https://github.com/ruffsl/colcon-clean \
78-
git+https://github.com/timonegk/colcon-core.git@colors \
79-
git+https://github.com/timonegk/colcon-notification.git@colors \
80-
git+https://github.com/timonegk/colcon-output.git@colors
62+
python3-virtualenv \
63+
ros-jazzy-camera-calibration \
64+
ros-jazzy-desktop \
65+
ros-jazzy-joint-state-publisher-gui \
66+
ros-jazzy-plotjuggler \
67+
ros-jazzy-plotjuggler-msgs \
68+
ros-jazzy-plotjuggler-ros \
69+
ros-jazzy-rmw-cyclonedds-cpp \
70+
ros-jazzy-rqt-robot-monitor \
71+
ros-jazzy-soccer-vision-3d-rviz-markers
8172

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

9486
USER $user
9587

88+
# Install pip colcon extensions / patches as user
89+
RUN python3 -m pip install --user --break-system-packages \
90+
git+https://github.com/ruffsl/colcon-clean \
91+
git+https://github.com/timonegk/colcon-core.git@colors \
92+
git+https://github.com/timonegk/colcon-notification.git@colors \
93+
git+https://github.com/timonegk/colcon-output.git@colors
94+
9695
# Create colcon workspace
9796
RUN mkdir -p /home/$user/colcon_ws/src
9897

.devcontainer/devcontainer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "Bit-Bots Iron Dev",
2+
"name": "Bit-Bots Jazzy Dev",
33

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

@@ -14,7 +14,9 @@
1414
"vscode": {
1515
"settings": {
1616
"terminal.integrated.defaultProfile.linux": "zsh",
17-
"terminal.integrated.profiles.linux": { "zsh": { "path": "/bin/zsh" } }
17+
"terminal.integrated.profiles.linux": { "zsh": { "path": "/bin/zsh" } },
18+
"dev.containers.copyGitConfig": false,
19+
"dev.containers.gitCredentialHelperConfigLocation": "none"
1820
},
1921
"extensions": ["ms-iot.vscode-ros"]
2022
}

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ install-no-root: pull-init update-no-root
1717

1818
pip:
1919
# Install and upgrade pip dependencies
20-
pip install --upgrade -r requirements/dev.txt --user
20+
pip install --upgrade -r requirements/dev.txt --user --break-system-packages
2121

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

9696
status:
9797
# Show status of all repositories

scripts/ros.plugin.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
### Aliases and functions for ROS 2 and colcon usage. Usage for either
2-
### Ubuntu 22.04 or in rosdocked/dev docker container
2+
### Ubuntu 22.04/24.04 or in rosdocked/dev docker container
33

44
shell="$(basename "$SHELL")"
5+
ros_releases=(iron jazzy rolling)
6+
distro="$ROS_DISTRO"
57

68
rid() {
79
export ROS_DOMAIN_ID="$1"
@@ -12,13 +14,21 @@ rid() {
1214
# This needs to be called every time we source something ROS 2 related.
1315
# Previous loading of bashcompinit is required.
1416
update_ros2_argcomplete() {
15-
eval "$(register-python-argcomplete3 colcon)"
16-
eval "$(register-python-argcomplete3 ros2)"
17+
eval "$(register-python-argcomplete colcon)"
18+
eval "$(register-python-argcomplete ros2)"
1719
}
1820

1921
# Source the ROS 2 setup files if iron is installed
20-
if [[ -d /opt/ros/iron ]]; then
21-
source "/opt/ros/iron/setup.$shell" &> /dev/null
22+
if [[ -n "$distro" ]]; then
23+
source "/opt/ros/$distro/setup.$shell" &> /dev/null
24+
else
25+
for release in "${ros_releases[@]}"; do
26+
if [[ -d "/opt/ros/$release" ]]; then
27+
source "/opt/ros/$release/setup.$shell" &> /dev/null
28+
distro="$release"
29+
break
30+
fi
31+
done
2232
fi
2333

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

48-
alias sr="source /opt/ros/iron/setup.$shell && update_ros2_argcomplete"
58+
alias sr="source /opt/ros/$distro/setup.$shell && update_ros2_argcomplete"
4959
alias sc="source \$COLCON_WS/install/setup.$shell && update_ros2_argcomplete"
5060
alias sa='sr && sc'
5161

0 commit comments

Comments
 (0)