Skip to content

Commit

Permalink
feat: Add ROS 2 Jazzy (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiryoh committed May 26, 2024
1 parent daffb2d commit 9bae044
Show file tree
Hide file tree
Showing 9 changed files with 235 additions and 30 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/installers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ on:
- main
paths:
- "ros2-humble-**.sh"
- "ros2-iron-**.sh"
- "ros2-jazzy-**.sh"
- ".github/workflows/installers.yml"
pull_request:
branches:
- main
paths:
- "ros2-humble-**.sh"
- "ros2-iron-**.sh"
- "ros2-jazzy-**.sh"
- ".github/workflows/installers.yml"
schedule:
- cron: "0 1 * * 1"
Expand All @@ -26,6 +30,16 @@ jobs:
run: |
./.test/bats/bin/bats ./.test/test-os-check-jammy.bats
os-check-on-ubuntu-noble:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Run bats test
run: |
./.test/bats/bin/bats ./.test/test-os-check-noble.bats
humble-ros-base-main:
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -75,3 +89,29 @@ jobs:
run: |
sed -e 's/^\(ROS_DISTRO=.*\)/#\1\nROS_DISTRO=iron/g' -i tutorial.sh
bash <(head -n -2 ./tutorial.sh)
jazzy-ros-base-main:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Run the install script
run: |
./ros2-jazzy-ros-base-main.sh
- name: Run the test script
run: |
sed -e 's/^\(ROS_DISTRO=.*\)/#\1\nROS_DISTRO=jazzy/g' -i tutorial.sh
sed -e 's/^\(source \/opt.*bash\)$/\1\nrosdep install -r -y -i --from-paths ./g' -i tutorial.sh
bash <(head -n -2 ./tutorial.sh)
jazzy-desktop-main:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Run the install script
run: |
./ros2-jazzy-desktop-main.sh
- name: Run the test script
run: |
sed -e 's/^\(ROS_DISTRO=.*\)/#\1\nROS_DISTRO=jazzy/g' -i tutorial.sh
bash <(head -n -2 ./tutorial.sh)
12 changes: 12 additions & 0 deletions .test/test-os-check-focal.bats
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,15 @@ setup() {
[ "$status" -eq 1 ]
assert_output --partial "ERROR: This OS (version: focal) is not supported"
}

@test "Iron fail on Ubuntu 20.04" {
run ./ros2-iron-desktop-main.sh
[ "$status" -eq 1 ]
assert_output --partial "ERROR: This OS (version: focal) is not supported"
}

@test "Jazzy fail on Ubuntu 20.04" {
run ./ros2-jazzy-desktop-main.sh
[ "$status" -eq 1 ]
assert_output --partial "ERROR: This OS (version: focal) is not supported"
}
6 changes: 6 additions & 0 deletions .test/test-os-check-jammy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ setup() {
[ "$status" -eq 1 ]
assert_output --partial "ERROR: This OS (version: jammy) is not supported"
}

@test "Jazzy fail on Ubuntu 22.04" {
run ./ros2-jazzy-desktop-main.sh
[ "$status" -eq 1 ]
assert_output --partial "ERROR: This OS (version: jammy) is not supported"
}
19 changes: 19 additions & 0 deletions .test/test-os-check-noble.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bats

setup() {
load 'test_helper/bats-support/load'
load 'test_helper/bats-assert/load'
}


@test "Humble fail on Ubuntu 24.04" {
run ./ros2-humble-desktop-main.sh
[ "$status" -eq 1 ]
assert_output --partial "ERROR: This OS (version: noble) is not supported"
}

@test "Iron fail on Ubuntu 24.04" {
run ./ros2-iron-desktop-main.sh
[ "$status" -eq 1 ]
assert_output --partial "ERROR: This OS (version: noble) is not supported"
}
47 changes: 20 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,11 @@ After downloading this repository, just run the following command.

## Usage

By default, `run.sh` will install `ros-humble-desktop`.
If you need to install another package, edit line8-9 in `run.sh`.

```sh
CHOOSE_ROS_DISTRO=humble # or foxy, iron, etc...
INSTALL_PACKAGE=desktop # or ros-base
```

For example, if you want to install ros-base package of ROS 2 Foxy,
edit like the followings.

```sh
CHOOSE_ROS_DISTRO=foxy # or foxy, iron, etc...
INSTALL_PACKAGE=ros-base # or ros-base
```

After editing, run `run.sh` to install the packages.

```sh
./run.sh
```
By default, `run.sh` will install `ros-jazzy-desktop`.
If you need to install another package, use indivitual installers listed bellow.

### Individual installers

In addition, there are other ways to use the installers.

ROS 2 Humble (LTS)

* To install `ros-humble-ros-base`, use [`ros2-humble-ros-base-main.sh`](./ros2-humble-ros-base-main.sh) instead of `run.sh`.
Expand All @@ -54,6 +33,13 @@ ROS 2 Iron
* To install `ros-iron-ros-base`, use [`ros2-iron-ros-base-main.sh`](./ros2-iron-ros-base-main.sh) instead of `run.sh`.
* To install `ros-iron-desktop`, use [`ros2-iron-desktop-main.sh`](./ros2-iron-desktop-main.sh) instead of `run.sh`.

ROS 2 Jazzy (LTS)

* To install `ros-jazzy-ros-base`, use [`ros2-jazzy-ros-base-main.sh`](./ros2-jazzy-ros-base-main.sh) instead of `run.sh`.
* To install `ros-jazzy-desktop`, use [`ros2-jazzy-desktop-main.sh`](./ros2-jazzy-desktop-main.sh) instead of `run.sh`.

#### Old versions

ROS 2 Dashing (EOL)

* To install `ros-dashing-ros-base`, use [`ros2-dashing-ros-base-main.sh`](./ros2-dashing-ros-base-main.sh) instead of `run.sh`.
Expand All @@ -80,15 +66,22 @@ Reference: [REP-0003](https://ros.org/reps/rep-0003.html), [REP-2000](https://ro

| Ubuntu | ROS 1 | ROS 2 |
| ------ | ----- | ----- |
| Ubuntu 18.04<br>EOL: May 2023 | Melodic<br>EOL: May 2023 | Dashing<br>EOL: May 2021 |
| Ubuntu 20.04<br>EOL: May 2025 | Noetic<br>EOL: May 2025 | Foxy<br>EOL: May 2023 |
| Ubuntu 22.04<br>EOL: May 2027 | - | Humble<br>EOL: May 2027 |
| Ubuntu 18.04<br>EOL: May 2023[^2] | Melodic<br>EOL: May 2023 | Dashing<br>EOL: May 2021 |
| Ubuntu 20.04<br>EOL: April 2025[^3] | Noetic<br>EOL: May 2025 | Foxy<br>EOL: May 2023 |
| Ubuntu 22.04<br>EOL: April 2027[^4] | - | Humble<br>EOL: May 2027 |
| Ubuntu 24.04<br>EOL: June 2029[^5] | - | Jazzy<br>EOL: May 2029 |

* Note: Here, EOL for Ubuntu refers to the end of normal support, which is not Ubuntu Pro.

[^2]: https://ubuntu.com//blog/18-04-end-of-standard-support
[^3]: https://wiki.ubuntu.com/FocalFossa/ReleaseNotes
[^4]: https://discourse.ubuntu.com/t/jammy-jellyfish-release-notes/24668
[^5]: https://discourse.ubuntu.com/t/noble-numbat-release-notes/39890

## LICENSE

```
Copyright 2019-2023 Tiryoh
Copyright 2019-2024 Tiryoh
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
67 changes: 67 additions & 0 deletions ros2-jazzy-desktop-main.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/usr/bin/env bash
set -eu

# Copyright 2019-2024 Tiryoh
# https://github.com/Tiryoh/ros2_setup_scripts_ubuntu
# Licensed under the Apache License, Version 2.0
#
# REF: https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html
# by Open Robotics, licensed under CC-BY-4.0
# source: https://github.com/ros2/ros2_documentation

CHOOSE_ROS_DISTRO=jazzy
INSTALL_PACKAGE=desktop
TARGET_OS=noble

# Check OS version
if ! which lsb_release > /dev/null ; then
sudo apt-get update
sudo apt-get install -y curl lsb-release
fi

if [[ "$(lsb_release -sc)" == "$TARGET_OS" ]]; then
echo "OS Check Passed"
else
printf '\033[33m%s\033[m\n' "=================================================="
printf '\033[33m%s\033[m\n' "ERROR: This OS (version: $(lsb_release -sc)) is not supported"
printf '\033[33m%s\033[m\n' "=================================================="
exit 1
fi

if ! dpkg --print-architecture | grep -q 64; then
printf '\033[33m%s\033[m\n' "=================================================="
printf '\033[33m%s\033[m\n' "ERROR: This architecture ($(dpkg --print-architecture)) is not supported"
printf '\033[33m%s\033[m\n' "See https://www.ros.org/reps/rep-2000.html"
printf '\033[33m%s\033[m\n' "=================================================="
exit 1
fi

# Install
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y universe
sudo apt-get install -y curl gnupg2 lsb-release build-essential

sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt-get update
sudo apt-get install -y ros-$CHOOSE_ROS_DISTRO-$INSTALL_PACKAGE
sudo apt-get install -y python3-argcomplete python3-colcon-clean
sudo apt-get install -y python3-colcon-common-extensions
sudo apt-get install -y python3-rosdep python3-vcstool # https://index.ros.org/doc/ros2/Installation/Linux-Development-Setup/
[ -e /etc/ros/rosdep/sources.list.d/20-default.list ] ||
sudo rosdep init
rosdep update
grep -F "source /opt/ros/$CHOOSE_ROS_DISTRO/setup.bash" ~/.bashrc ||
echo "source /opt/ros/$CHOOSE_ROS_DISTRO/setup.bash" >> ~/.bashrc
# From ROS 2 Iron, it uses ROS_AUTOMATIC_DISCOVERY_RANGE instead of ROS_LOCALHOST_ONLY
# https://docs.ros.org/en/iron/Releases/Release-Iron-Irwini.html#improved-discovery-options
grep -F "export ROS_AUTOMATIC_DISCOVERY_RANGE=" ~/.bashrc ||
echo "# export ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST" >> ~/.bashrc

set +u

source /opt/ros/$CHOOSE_ROS_DISTRO/setup.bash

echo "success installing ROS2 $CHOOSE_ROS_DISTRO"
echo "Run 'source /opt/ros/$CHOOSE_ROS_DISTRO/setup.bash'"
67 changes: 67 additions & 0 deletions ros2-jazzy-ros-base-main.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/usr/bin/env bash
set -eu

# Copyright 2019-2024 Tiryoh
# https://github.com/Tiryoh/ros2_setup_scripts_ubuntu
# Licensed under the Apache License, Version 2.0
#
# REF: https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html
# by Open Robotics, licensed under CC-BY-4.0
# source: https://github.com/ros2/ros2_documentation

CHOOSE_ROS_DISTRO=jazzy
INSTALL_PACKAGE=ros-base
TARGET_OS=noble

# Check OS version
if ! which lsb_release > /dev/null ; then
sudo apt-get update
sudo apt-get install -y curl lsb-release
fi

if [[ "$(lsb_release -sc)" == "$TARGET_OS" ]]; then
echo "OS Check Passed"
else
printf '\033[33m%s\033[m\n' "=================================================="
printf '\033[33m%s\033[m\n' "ERROR: This OS (version: $(lsb_release -sc)) is not supported"
printf '\033[33m%s\033[m\n' "=================================================="
exit 1
fi

if ! dpkg --print-architecture | grep -q 64; then
printf '\033[33m%s\033[m\n' "=================================================="
printf '\033[33m%s\033[m\n' "ERROR: This architecture ($(dpkg --print-architecture)) is not supported"
printf '\033[33m%s\033[m\n' "See https://www.ros.org/reps/rep-2000.html"
printf '\033[33m%s\033[m\n' "=================================================="
exit 1
fi

# Install
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y universe
sudo apt-get install -y curl gnupg2 lsb-release build-essential

sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt-get update
sudo apt-get install -y ros-$CHOOSE_ROS_DISTRO-$INSTALL_PACKAGE
sudo apt-get install -y python3-argcomplete python3-colcon-clean
sudo apt-get install -y python3-colcon-common-extensions
sudo apt-get install -y python3-rosdep python3-vcstool # https://index.ros.org/doc/ros2/Installation/Linux-Development-Setup/
[ -e /etc/ros/rosdep/sources.list.d/20-default.list ] ||
sudo rosdep init
rosdep update
grep -F "source /opt/ros/$CHOOSE_ROS_DISTRO/setup.bash" ~/.bashrc ||
echo "source /opt/ros/$CHOOSE_ROS_DISTRO/setup.bash" >> ~/.bashrc
# From ROS 2 Iron, it uses ROS_AUTOMATIC_DISCOVERY_RANGE instead of ROS_LOCALHOST_ONLY
# https://docs.ros.org/en/iron/Releases/Release-Iron-Irwini.html#improved-discovery-options
grep -F "export ROS_AUTOMATIC_DISCOVERY_RANGE=" ~/.bashrc ||
echo "# export ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST" >> ~/.bashrc

set +u

source /opt/ros/$CHOOSE_ROS_DISTRO/setup.bash

echo "success installing ROS2 $CHOOSE_ROS_DISTRO"
echo "Run 'source /opt/ros/$CHOOSE_ROS_DISTRO/setup.bash'"
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -eu
# by Open Robotics, licensed under CC-BY-4.0
# source: https://github.com/ros2/ros2_documentation

CHOOSE_ROS_DISTRO=humble # or iron, etc...
CHOOSE_ROS_DISTRO=jazzy # or humble, iron, etc...
INSTALL_PACKAGE=desktop # or ros-base

sudo apt update
Expand Down
5 changes: 3 additions & 2 deletions tutorial.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/env bash
set -e

ROS_DISTRO=humble
ROS_DISTRO=jazzy

which rosdep > /dev/null
which vcs > /dev/null

mkdir -p ~/ros2_example_ws/src
cd ~/ros2_example_ws
git clone -b ${ROS_DISTRO} https://github.com/ros2/examples src/examples
git clone -b ${ROS_DISTRO} https://github.com/ros2/examples.git src/examples
rosdep install -riy --from-paths src
source /opt/ros/${ROS_DISTRO}/setup.bash
#colcon build --symlink-install
colcon build --symlink-install --parallel-workers 1 # build one package at once https://github.com/Tiryoh/ros2_setup_scripts_ubuntu/issues/4
Expand Down

0 comments on commit 9bae044

Please sign in to comment.