Skip to content

Commit

Permalink
Add follow tests using Ignition Gazebo's test fixture and run on GitH…
Browse files Browse the repository at this point in the history
…ub actions (#40)
  • Loading branch information
chapulina authored Oct 18, 2021
1 parent 05be9db commit 6a9b6d6
Show file tree
Hide file tree
Showing 15 changed files with 593 additions and 82 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/build-and-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
set -ev
set -x

# Configuration.
export COLCON_WS=~/ws
export COLCON_WS_SRC=${COLCON_WS}/src
export DEBIAN_FRONTEND=noninteractive
export ROS_PYTHON_VERSION=3

apt update -qq
apt install -qq -y lsb-release wget curl build-essential

# Fortres isn't on packages.ros.org yet, so we get it from packages.osrfoundation.org
# Once it's on packages.ros.org, it can be installed with rosdep below
if [ "$IGNITION_VERSION" == "fortress" ]; then
echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list
wget https://packages.osrfoundation.org/gazebo.key -O - | apt-key add -

IGN_DEPS="ignition-fortress"
fi

# Tools and dependencies
echo "deb http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
apt-get update -qq
apt-get install -y $IGN_DEPS \
python3-colcon-common-extensions \
python3-rosdep \
xvfb

rosdep init
rosdep update

# Create workspace and copy Dolly code there
mkdir -p $COLCON_WS_SRC
cp -r $GITHUB_WORKSPACE $COLCON_WS_SRC

# Install ROS dependencies
rosdep install --from-paths $COLCON_WS_SRC -i -y -r --rosdistro $ROS_DISTRO

# Rendering setup
Xvfb :1 -ac -noreset -core -screen 0 1280x1024x24 &
export DISPLAY=:1.0
export MESA_GL_VERSION_OVERRIDE=3.3

# Build
source /opt/ros/$ROS_DISTRO/setup.bash
cd $COLCON_WS
colcon build --event-handlers console_direct+

# Test
colcon test --event-handlers console_direct+ --packages-select-regex dolly
colcon test-result
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and test

on: [push, pull_request]

jobs:
build_and_test:
name: Build and test
runs-on: ubuntu-latest
strategy:
matrix:
include:
- docker-image: "ubuntu:20.04"
ignition-version: "fortress"
ros-distro: "rolling"
container:
image: ${{ matrix.docker-image }}
steps:
- name: Checkout dolly
uses: actions/checkout@v2
with:
path: main
# Compiling ros_ign from source because Rolling isn't using Fortress yet
- name: Checkout ros_ign
uses: actions/checkout@v2
with:
repository: ignitionrobotics/ros_ign
ref: ros2
path: ros_ign
- name: Build and test
run: main/.github/workflows/build-and-test.sh
env:
DOCKER_IMAGE: ${{ matrix.docker-image }}
IGNITION_VERSION: ${{ matrix.ignition-version }}
ROS_DISTRO: ${{ matrix.ros-distro }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__/
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .travis/build

This file was deleted.

15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/chapulina/dolly.svg?branch=master)](https://travis-ci.org/chapulina/dolly)
[![Build and test](https://github.com/chapulina/dolly/actions/workflows/ci.yml/badge.svg)](https://github.com/chapulina/dolly/actions/workflows/ci.yml)

# Dolly the robot

Expand All @@ -21,7 +21,7 @@ Branch | ROS | Gazebo-classic | Ignition | OS
[dashing](https://github.com/chapulina/dolly/tree/dashing) | Dashing | Gazebo 9 | :x: | Ubuntu Bionic, macOS Sierra
[eloquent](https://github.com/chapulina/dolly/tree/eloquent) | Eloquent | Gazebo 9, Gazebo 11 | Citadel | Ubuntu Bionic
[foxy](https://github.com/chapulina/dolly/tree/foxy) | Foxy | Gazebo 11 | Citadel | Ubuntu Focal
[galactic](https://github.com/chapulina/dolly/tree/galactic) | Galactic, Rolling | Gazebo 11 | Edifice | Ubuntu Focal
[galactic](https://github.com/chapulina/dolly/tree/galactic) | Galactic, Rolling | Gazebo 11 | Edifice, Fortress | Ubuntu Focal

## Packages

Expand All @@ -31,6 +31,7 @@ This repository contains the following packages:
* `dolly_follow`: Provides node with follow logic.
* `dolly_gazebo`: Robot model, simulation world and launch scripts for Gazebo-classic.
* `dolly_ignition`: Robot model, simulation world and launch scripts for Ignition.
* `dolly_tests`: Simulation-based automated tests

## Install

Expand Down Expand Up @@ -128,11 +129,15 @@ should be enabled.
* ⌨️ [Source code](https://github.com/chapulina/simslides/tree/QConSF_Nov2018)
* InfoQ
* 📰 [Open Source Robotics: Getting Started with Gazebo and ROS 2](https://www.infoq.com/articles/ros-2-gazebo-tutorial/)
* ROS Developers Live Class
* 🎥 [#70 How to Control a Robot with ROS2 (Dashing)](https://www.youtube.com/watch?v=qB4SaP3TZog)
* 🎥 [#71 How to visualize sensor data in ROS2](https://www.youtube.com/watch?v=s3fBGSpmER0)
* The Construct's ROS tutorials
* 🎥 [ROS Developers LIVE Class #70: How to Control a Robot with ROS2 (Dashing)](https://www.youtube.com/watch?v=qB4SaP3TZog)
* 🎥 [ROS Developers Live Class n.71: How to visualize sensor data in ROS2](https://www.youtube.com/watch?v=s3fBGSpmER0)
* 🎥 [Exploring ROS2 with wheeled robot - #1 - Launch ROS2 Simulation](https://www.youtube.com/watch?v=T4iRJqESQAk)
* 🎥 [Exploring ROS2 with wheeled robot - #2 - How to subscribe to ROS2 laser scan topic](https://www.youtube.com/watch?v=2-qO79V_Cik)
* 🎥 [Exploring ROS2 using wheeled Robot - #3 - Moving the Robot](https://www.youtube.com/watch?v=SinvFQ9Vobg)
* ROSConJP 2019
* 🎥 [これからのGazebo: ROSのシミュレーションの次世代](https://vimeo.com/370247782)
* ⌨️ [Source code](https://github.com/chapulina/rosconjp_2019)
* ROS Developers Day 2020
* 🎥 [Hands-on with Ignition and ROS2 | ROSDevDay2020 Trailer #1](https://www.youtube.com/watch?v=VO0ZUrr7ib8)
* 🎥 [Hands-on with Ignition and ROS2](https://youtu.be/nLp4uzN5NMs?t=622)
21 changes: 16 additions & 5 deletions dolly_ignition/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@ cmake_minimum_required(VERSION 3.5)

project(dolly_ignition)

# Skip if Ignition not present
find_package(ignition-gazebo5 QUIET)
if(NOT ignition-gazebo5_FOUND)
message(WARNING "Ignition Gazebo 5 not found, proceeding without that simulator.")
return()
# Fortress
if("$ENV{IGNITION_VERSION}" STREQUAL "fortress")
find_package(ignition-gazebo6 REQUIRED)

message(STATUS "Using Ignition Fortress")
# Default to Edifice
else()
find_package(ignition-gazebo5 QUIET)

if(NOT ignition-gazebo5_FOUND)
# Skip if Ignition not present
message(WARNING "Ignition Gazebo 5 or 6 not found, proceeding without that simulator.")
return()
else()
message(STATUS "Using Ignition Edifice")
endif()
endif()

find_package(ament_cmake REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion dolly_ignition/models/dolly_ignition/model.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
<iyz>0</iyz>
<izz>3.45e-06</izz>
</inertia>
<pose frame=''>0 0 -0.04 0 -0 0</pose>
<pose>0 0 -0.04 0 -0 0</pose>
</inertial>
<visual name='visual'>
<geometry>
Expand Down
4 changes: 4 additions & 0 deletions dolly_tests/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package dolly_tests
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

61 changes: 61 additions & 0 deletions dolly_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
cmake_minimum_required(VERSION 3.5)

project(dolly_tests)

# Fortress
if("$ENV{IGNITION_VERSION}" STREQUAL "fortress")
find_package(ignition-gazebo6 REQUIRED)
set(IGN_GAZEBO_VER 6)

message(STATUS "Compiling against Ignition Fortress")
# Default to Edifice
else()
find_package(ignition-gazebo5 QUIET)
set(IGN_GAZEBO_VER 5)

if(NOT ignition-gazebo5_FOUND)
# Skip if Ignition not present
message(WARNING "Ignition Gazebo 5 or 6 not found, proceeding without that simulator.")
return()
else()
message(STATUS "Compiling against Ignition Edifice")
endif()
endif()

find_package(ament_cmake REQUIRED)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()

find_package(ament_cmake_gtest REQUIRED)
find_package(launch_testing_ament_cmake REQUIRED)
ament_find_gtest()

set("PROJECT_BINARY_PATH" ${CMAKE_CURRENT_BINARY_DIR})
set("PROJECT_SOURCE_PATH" ${CMAKE_CURRENT_SOURCE_DIR})
configure_file(test/constants.hh.in constants.hh @ONLY)

set(TEST_NAME follow_ignition_TEST)
ament_add_gtest_executable(${TEST_NAME} test/${TEST_NAME}.cpp)
target_link_libraries(${TEST_NAME}
ignition-gazebo${IGN_GAZEBO_VER}::ignition-gazebo${IGN_GAZEBO_VER}
)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
install(
TARGETS ${TEST_NAME}
DESTINATION lib/${PROJECT_NAME}
)
add_launch_test(launch/${TEST_NAME}.launch.py
TIMEOUT 200
)
endif()

install(
DIRECTORY
worlds
DESTINATION
share/${PROJECT_NAME}/
)

ament_package()
Loading

0 comments on commit 6a9b6d6

Please sign in to comment.