Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dual ROS 1+2 devcontainer, remove ROS Galactic from the support matrix #285

Merged
merged 4 commits into from
Feb 14, 2024
Merged
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
100 changes: 35 additions & 65 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
FROM ros:noetic-ros-core
ARG ROS_DISTRIBUTION=humble
FROM ros:$ROS_DISTRIBUTION-ros-base

# Install clang and set as default compiler.
RUN apt-get update && apt-get install -y --no-install-recommends \
clang \
&& rm -rf /var/lib/apt/lists/*

ENV CC=clang
ENV CXX=clang++

# Set environment and working directory
ENV ROS_WS /ros2_ws
WORKDIR $ROS_WS

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
Expand All @@ -11,90 +24,47 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
git \
git-lfs \
gnupg \
lsb-release \
openssh-client \
python3-catkin-tools \
python3-colcon-common-extensions \
python3-pip \
python3-rosdep \
python3-rosinstall \
python3-rosinstall-generator \
python3-wstool \
libasio-dev \
libboost-all-dev \
libssl-dev \
libwebsocketpp-dev \
nlohmann-json3-dev \
strace \
sudo \
&& rm -rf /var/lib/apt/lists/*

ENV CC=clang
ENV CXX=clang++
# Add package.xml so we can install package dependencies
COPY package.xml src/ros-foxglove-bridge/

# Authorize the ROS 2 GPG key and add the ROS 2 apt repository
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu focal main" > /etc/apt/sources.list.d/ros2.list
# Install rosdep dependencies
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
apt-get update && rosdep update --include-eol-distros && rosdep install -y \
--from-paths \
src \
--ignore-src \
&& rm -rf /var/lib/apt/lists/*

# Install ROS 2
RUN apt-get update && apt-get install -y --no-install-recommends \
ros-galactic-foxglove-msgs \
ros-galactic-ros-core \
ros-galactic-rosbag2 \
ros-galactic-rosbag2-storage-mcap \
ros-galactic-tf2-msgs \
&& rm -rf /var/lib/apt/lists/*
ENV COLCON_DEFAULTS_FILE=/ros_ws/src/ros-foxglove-bridge/.devcontainer/colcon_defaults.yaml

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

# Create a non-root user
# Taken from https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user#_creating-a-nonroot-user
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Create the user
# Create the user and add them to sudoers
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

# [Optional] Set the default user. Omit if you want to keep the default as root.
USER $USERNAME

COPY --chown=$USERNAME:$USERNAME package.xml /ros_ws/src/ros-foxglove-bridge/package.xml

# Initialize rosdep
RUN sudo rosdep init && rosdep update --include-eol-distros

# Install rosdep dependencies for ROS 1
RUN . /opt/ros/noetic/setup.sh && \
sudo apt-get update && rosdep update && rosdep install -y \
--from-paths /ros_ws/src \
--ignore-src \
&& sudo rm -rf /var/lib/apt/lists/*

# Install rosdep dependencies for ROS 2
RUN . /opt/ros/galactic/setup.sh && \
sudo apt-get update && rosdep update --include-eol-distros && rosdep install -y \
--from-paths /ros_ws/src \
--ignore-src \
&& sudo rm -rf /var/lib/apt/lists/*

RUN catkin config --init --install \
--workspace /ros_ws \
--extend /opt/ros/noetic \
--build-space build_ros1 \
--devel-space devel_ros1 \
--install-space install_ros1 \
--log-space log_ros1

ENV COLCON_DEFAULTS_FILE=/ros_ws/src/ros-foxglove-bridge/.devcontainer/colcon_defaults.yaml

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

# Unset the ROS_DISTRO and add aliases to .bashrc
# Add aliases to .bashrc
RUN echo $'\
unset ROS_DISTRO\n\
alias ros1_build_debug="catkin build -DCMAKE_BUILD_TYPE=Debug"\n\
alias ros1_build_release="catkin build -DCMAKE_BUILD_TYPE=RelWithDebInfo"\n\
alias ros1_foxglove_bridge="/ros_ws/install_ros1/env.sh roslaunch foxglove_bridge foxglove_bridge.launch --screen"\n\
alias ros2_build_debug="source /opt/ros/galactic/setup.bash && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Debug"\n\
alias ros2_build_release="source /opt/ros/galactic/setup.bash && colcon build --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo"\n\
alias ros2_build_debug="source /opt/ros/humble/setup.bash && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Debug"\n\
alias ros2_build_release="source /opt/ros/humble/setup.bash && colcon build --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo"\n\
alias ros2_foxglove_bridge="source /ros_ws/install_ros2/setup.bash && ros2 run foxglove_bridge foxglove_bridge --ros-args --log-level debug --log-level rcl:=INFO"\n\
' >> ~/.bashrc
5 changes: 2 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// -*- jsonc -*-
{
// ROS 1 / ROS 2 hybrid dev environment
"name": "ROS 1 + 2",
"name": "ROS 2",
"workspaceFolder": "/ros_ws/src/ros-foxglove-bridge",
"workspaceMount": "source=${localWorkspaceFolder},target=/ros_ws/src/ros-foxglove-bridge,type=bind,consistency=cached",
"dockerFile": "./Dockerfile",
Expand Down Expand Up @@ -33,6 +32,6 @@
"capAdd": [
"SYS_PTRACE"
],
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// More info: <https://aka.ms/dev-containers-non-root>
"remoteUser": "vscode"
jhurliman marked this conversation as resolved.
Show resolved Hide resolved
}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ros_distribution: [melodic, noetic, galactic, humble, iron, rolling]
ros_distribution: [melodic, noetic, humble, iron, rolling]
jhurliman marked this conversation as resolved.
Show resolved Hide resolved

name: Test (ROS ${{ matrix.ros_distribution }})
runs-on: ubuntu-latest
Expand Down
6 changes: 2 additions & 4 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/opt/ros/galactic/include/**",
"/opt/ros/noetic/include/**",
"/opt/ros/humble/include/**",
jhurliman marked this conversation as resolved.
Show resolved Hide resolved
"/usr/include/**"
],
"browse": {
"path": [
"${workspaceFolder}",
"/opt/ros/galactic/include",
"/opt/ros/noetic/include",
"/opt/ros/humble/include",
"/usr/include"
]
},
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ROS1_DISTRIBUTIONS := melodic noetic
ROS2_DISTRIBUTIONS := galactic humble iron rolling
ROS2_DISTRIBUTIONS := humble iron rolling

define generate_ros1_targets
.PHONY: $(1)
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ foxglove_bridge

[![ROS Melodic version](https://img.shields.io/ros/v/melodic/foxglove_bridge)](https://index.ros.org/p/foxglove_bridge/github-foxglove-ros-foxglove-bridge/#melodic)
[![ROS Noetic version](https://img.shields.io/ros/v/noetic/foxglove_bridge)](https://index.ros.org/p/foxglove_bridge/github-foxglove-ros-foxglove-bridge/#noetic)
[![ROS Galactic version](https://img.shields.io/ros/v/galactic/foxglove_bridge)](https://index.ros.org/p/foxglove_bridge/github-foxglove-ros-foxglove-bridge/#galactic)
[![ROS Humble version](https://img.shields.io/ros/v/humble/foxglove_bridge)](https://index.ros.org/p/foxglove_bridge/github-foxglove-ros-foxglove-bridge/#humble)
[![ROS Iron version](https://img.shields.io/ros/v/iron/foxglove_bridge)](https://index.ros.org/p/foxglove_bridge/github-foxglove-ros-foxglove-bridge/#iron)
[![ROS Rolling version](https://img.shields.io/ros/v/rolling/foxglove_bridge)](https://index.ros.org/p/foxglove_bridge/github-foxglove-ros-foxglove-bridge/#rolling)
Expand Down Expand Up @@ -121,7 +120,7 @@ A VSCode container is provided with a dual ROS 1 and ROS 2 installation and
enough tools to build and run the bridge. Some bash aliases are defined to simplify the common workflow. Here's an example of building and running the ROS 2 node:

```bash
source /opt/ros/galactic/setup.bash
source /opt/ros/humble/setup.bash
ros2_build_debug # or ros2_build_release
ros2_foxglove_bridge
```
Expand All @@ -135,7 +134,7 @@ To test the bridge with example data, open another terminal and download the tes
Then start playback:

```bash
source /opt/ros/galactic/setup.bash
source /opt/ros/humble/setup.bash
ros2 bag play -l --clock 100 -s mcap data/nuScenes-v1.0-mini-scene-0061-ros2.mcap
```

Expand Down
Loading