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

Workflow: Rework and build for ROS2 Humble and Jazzy #375

Merged
merged 2 commits into from
Oct 31, 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
131 changes: 95 additions & 36 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,101 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
build: # On Linux, iterates on all ROS 1 and ROS 2 distributions.
runs-on: ubuntu-latest
strategy:
matrix:
ros_distribution:
- noetic
- humble
- jazzy

# Steps represent a sequence of tasks that will be executed as part of the job
# Define the Docker image(s) associated with each ROS distribution.
# The include syntax allows additional variables to be defined, like
# docker_image in this case. See documentation:
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-configurations-in-a-matrix-build
#
# Platforms are defined in REP 3 and REP 2000:
# https://ros.org/reps/rep-0003.html
# https://ros.org/reps/rep-2000.html
include:
# Noetic Ninjemys (May 2020 - May 2025)
- docker_image: ghcr.io/catthehacker/ubuntu:act-20.04
ros_distribution: noetic
ros_version: 1

# Humble Hawksbill (May 2022 - May 2027)
- docker_image: ghcr.io/catthehacker/ubuntu:act-22.04
ros_distribution: humble
ros_version: 2

# Jazzy Jalisco (May 2024 - May 2029)
- docker_image: ubuntu:24.04
ros_distribution: jazzy
ros_version: 2

container:
image: ${{ matrix.docker_image }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
submodules: recursive

# Runs a set of commands using the runners shell
- name: Setup ROS
uses: betwo/github-setup-catkin@v1.3.0
with:
# Version range or exact version of ROS version to use, using SemVer's version range syntax.
ros-version: 'noetic'
build-tool: 'catkin_tools'
# Root directory of the catkin workspace
workspace: ./ros

- name: Compilation settings
run: |
sudo apt-get -y install rsync libyaml-cpp-dev libcurl4-openssl-dev
- name: Update Git
run: |
apt-get update
apt-get install git -y

- name: Setup AirSim
run: |
./setup.sh
./build.sh
working-directory: ./AirSim

- name: Build catkin ws
run: |
set -ex o pipefail
catkin build
working-directory: ./ros
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Ubuntu 24.04 specific apt packages
if: ${{ contains(matrix.docker_image,'ubuntu:24.04') }}
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
apt-get install -y sudo python3-pip libboost-all-dev nodejs
sudo pip3 install -U rosdep --break-system-packages


- name: Act dependencies
if: ${{ env.ACT }}
run: |
apt-get install gnupg lsb-release -y

- name: setup ROS environment
uses: ros-tooling/setup-ros@0.7.9
with:
required-ros-distributions: ${{ matrix.ros_distribution }}

- name: Apt packages
run: |
apt-get update
apt-get -y install rsync libyaml-cpp-dev libcurl4-openssl-dev lsb-release wget software-properties-common gnupg

- name: Setup AirSim
run: |
./setup.sh
./build.sh
working-directory: AirSim

- name: Update rosdep
run: |
rosdep update

- name: build and test ROS 1
if: ${{ matrix.ros_version == 1 }}
shell: bash
run: |
apt-get install -y python3-catkin-tools
source /opt/ros/${{ matrix.ros_distribution }}/setup.bash
rosdep install --from-paths src --ignore-src -r -y --rosdistro ${{ matrix.ros_distribution }}
catkin init
catkin build --no-status
working-directory: ros

- name: build and test ROS 2
if: ${{ matrix.ros_version == 2 }}
shell: bash
run: |
source /opt/ros/${{ matrix.ros_distribution }}/setup.bash
rosdep install --from-paths src --ignore-src -r -y --rosdistro ${{ matrix.ros_distribution }}
colcon build
working-directory: ros2
6 changes: 6 additions & 0 deletions AirSim/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ if [ "$(uname)" == "Darwin" ]; then
elif [ "$VERSION" -lt "22" ]; then
export CC="clang-8"
export CXX="clang++-8"
elif [ "$VERSION" -lt "24" ]; then
export CC="clang-12"
export CXX="clang++-12"
elif [ "$VERSION" -lt "26" ]; then
export CC="clang-16"
export CXX="clang++-16"
else
export CC="clang-12"
export CXX="clang++-12"
Expand Down
9 changes: 8 additions & 1 deletion AirSim/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,15 @@ if [ "$VERSION" -lt "20" ]; then
sudo apt-get install -y clang-8 clang++-8 libc++-8-dev libc++abi-8-dev
elif [ "$VERSION" -lt "22" ]; then
sudo apt-get install -y clang-8 libc++-8-dev libc++abi-8-dev
else
elif [ "$VERSION" -lt "24" ]; then
wouter-heerwegh marked this conversation as resolved.
Show resolved Hide resolved
sudo apt-get install -y clang-12 clang++-12 libc++-12-dev libc++abi-12-dev
elif [ "$VERSION" -lt "26" ]; then
sudo apt-get install -y clang-16 clang++-16 libc++-16-dev libc++abi-16-dev
else
# Installing clang 12 for now in all other cases
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 12
fi

#install additional tools
Expand Down
5 changes: 5 additions & 0 deletions ros2/src/fsds_ros2_bridge/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ set(RPC_LIB_INCLUDES " ${AIRSIM_ROOT}/external/rpclib/include")
set(RPC_LIB rpc) # name of .a file with lib prefix
message(STATUS "found RPC_LIB_INCLUDES=${RPC_LIB_INCLUDES}")

message(STATUS "distro $ENV{ROS_DISTRO}")
if($ENV{ROS_DISTRO} STREQUAL "jazzy")
add_compile_options(-DJAZZY=1)
endif()

# find dependencies
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()
Expand Down
4 changes: 4 additions & 0 deletions ros2/src/fsds_ros2_bridge/include/airsim_ros_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ STRICT_MODE_OFF //todo what does this do?
#include <fs_msgs/msg/extra_info.hpp>
#include <fs_msgs/msg/wheel_states.hpp>
#include <chrono>
#ifdef JAZZY
#include <cv_bridge/cv_bridge.hpp>
#else
#include <cv_bridge/cv_bridge.h>
#endif
#include <geometry_msgs/msg/pose_stamped.hpp>
#include <geometry_msgs/msg/transform_stamped.hpp>
#include <geometry_msgs/msg/twist_with_covariance_stamped.hpp>
Expand Down
4 changes: 4 additions & 0 deletions ros2/src/fsds_ros2_bridge/src/fsds_ros2_bridge_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
#include "vehicles/car/api/CarRpcLibClient.hpp"
#include "statistics.h"
#include "rpc/rpc_error.h"
#ifdef JAZZY
#include <cv_bridge/cv_bridge.hpp>
#else
#include <cv_bridge/cv_bridge.h>
#endif
#include <math.h>

using dseconds = std::chrono::duration<double>;
Expand Down