Skip to content

Commit

Permalink
Ubuntu 24.04 support for Rolling and Jazzy
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun-Prasad-V committed Jun 11, 2024
1 parent 047d601 commit 8b5207a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
28 changes: 18 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ jobs:
strategy:
fail-fast: false
matrix:
ros_distro: [rolling, iron, humble, foxy]
ros_distro: [rolling, iron, humble, foxy, jazzy]
include:
- ros_distro: 'rolling'
os: ubuntu-22.04
os: ubuntu-24.04
- ros_distro: 'iron'
os: ubuntu-22.04
- ros_distro: 'humble'
os: ubuntu-22.04
- ros_distro: 'foxy'
os: ubuntu-20.04
- ros_distro: 'jazzy'
os: ubuntu-24.04

steps:

Expand All @@ -53,14 +55,14 @@ jobs:
./pr_check.sh
# setup-ros@v0.6 is the last version supporting foxy (EOL)
# setup-ros@v0.7 is needed to support humble/iron/rolling
# setup-ros@v0.7 is needed to support humble/iron/rolling/jazzy
# so, seperating steps with if conditions
- name: build ROS2 for foxy
if: ${{ matrix.ros_distro == 'foxy' }}
uses: ros-tooling/setup-ros@v0.6
with:
required-ros-distributions: ${{ matrix.ros_distro }}
- name: build ROS2 for humble/iron/rolling
- name: build ROS2 for humble/iron/rolling/jazzy
if: ${{ matrix.ros_distro != 'foxy' }}
uses: ros-tooling/setup-ros@v0.7
with:
Expand Down Expand Up @@ -90,15 +92,14 @@ jobs:
source ${{github.workspace}}/.bashrc
cd ${{github.workspace}}/ros2
echo "================= ROSDEP UPDATE ====================="
# temp fix for rolling sources.. TODO: track when we can remove the two commands below
# see https://discourse.ros.org/t/psa-rolling-ci-or-docker-build-fix-from-rosdep-errors-in-24-04-transition/36902
sudo sed -i "s|ros\/rosdistro\/master|ros\/rosdistro\/rolling\/2024-02-28|" /etc/ros/rosdep/sources.list.d/20-default.list
export ROSDISTRO_INDEX_URL=https://raw.githubusercontent.com/ros/rosdistro/rolling/2024-02-28/index-v4.yaml
rosdep update --rosdistro ${{ matrix.ros_distro }} --include-eol-distros
echo "================= ROSDEP INSTALL ===================="
rosdep install -i --reinstall --from-path src --rosdistro ${{ matrix.ros_distro }} --skip-keys=librealsense2 -y
echo "================== COLCON BUILD ======================"
colcon build --cmake-args '-DBUILD_TOOLS=ON'
# Enable 'BUILD_TOOLS' through cmake arguments. Since, this variable is available only in realsense2_camera package
# and not in realsense2_camera_msgs and realsense2_description packages, to avoid warnings from these packages,
# use '--no-warn-unused-cli'. Ref: https://cmake.org/cmake/help/v3.0/manual/cmake.1.html
colcon build --cmake-args '-DBUILD_TOOLS=ON' --no-warn-unused-cli
## This step is commented out since we don't use rosbag files in "Run Tests" step below.
## Please uncomment when "Run Tests" step is fixed to run all tests.
Expand All @@ -114,9 +115,15 @@ jobs:

- name: Install Packages For Tests
run: |
# To avoid mixing of 'apt' provided packages and 'pip' provided packages, one way is to create virtual env
# and manage python packages within it. Ref: https://peps.python.org/pep-0668/
python3 -m venv .venv
# Activate the virtual env such that following python related commands run within it.
source .venv/bin/activate
sudo apt-get install python3-pip
pip3 install numpy --upgrade
pip3 install numpy-quaternion tqdm
pip3 install numpy-quaternion tqdm pyyaml
- name: Run Tests
run: |
Expand All @@ -126,6 +133,7 @@ jobs:
# the next command might be needed for foxy distro, since this package is not installed
# by default in ubuntu 20.04. For other distro, the apt install command will be ignored.
sudo apt install -y ros-${{matrix.ros_distro}}-sensor-msgs-py
source ../.venv/bin/activate
python3 src/realsense-ros/realsense2_camera/scripts/rs2_test.py non_existent_file
# don't run integration tests for foxy since some testing dependecies packages like
Expand Down
6 changes: 5 additions & 1 deletion realsense2_camera/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Intel Corporation. All Rights Reserved.
# Copyright 2024 Intel Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -170,6 +170,10 @@ elseif("$ENV{ROS_DISTRO}" STREQUAL "rolling")
message(STATUS "Build for ROS2 Rolling")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DROLLING")
set(SOURCES "${SOURCES}" src/ros_param_backend.cpp)
elseif("$ENV{ROS_DISTRO}" STREQUAL "jazzy")
message(STATUS "Build for ROS2 Jazzy")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DJAZZY")
set(SOURCES "${SOURCES}" src/ros_param_backend.cpp)
else()
message(FATAL_ERROR "Unsupported ROS Distribution: " "$ENV{ROS_DISTRO}")
endif()
Expand Down
2 changes: 1 addition & 1 deletion realsense2_camera/include/base_realsense_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ namespace realsense2_camera
class CimuData
{
public:
CimuData() : m_time_ns(-1) {};
CimuData() : m_data({0,0,0}), m_time_ns(-1) {};
CimuData(const stream_index_pair type, Eigen::Vector3d data, double time):
m_type(type),
m_data(data),
Expand Down

0 comments on commit 8b5207a

Please sign in to comment.