Skip to content

Commit

Permalink
Update to work with Ubuntu 20.04 and ROS2 Foxy. (#24)
Browse files Browse the repository at this point in the history
* Update to work with Ubuntu 20.04 and ROS2 Foxy.

* Change CMake to use ament_export_targets instead of ament_export_interfaces. This likely breaks support for ROS2 Eloquent.

* Switch Actions CI from 18.04/Eloquent to 20.04/Foxy.

* Change launch file instances of node-name to name.

* Fix for installing tzdata to accept default option.

* Switch CI to use ROS Docker image instead of Ubuntu Docker image.

* Remove rosdep init since it is already done in ROS image.

* Remove install of packages included in ROS Docker image.

* Revert schedule for CI runs.

* Enable CI on push.

* Remove unused CI environment variable.

* Revert CI distribution variable.

* Fix yaml error for CI. Simplify env variables.

* Remove DEBIAN_FRONTENT.

* Switch scipy use of factorial from misc module to special module.

* More robust way to import factorial.

* Rename all node_* variables in python so that the node_ prefix is removed.

* Switch CI from using Gazebo 9 to 11.

* Updated thruster default axis value

* Launch files now use a topic / param to load the robot description

* Updated thruster_manager to parse an urdf from a string instead of a file to get the thrust axes

* Updated tests to load the robot description from a topic / param

* Updated CI to use both Gazebo 9 and 11

* Fixed syntax error

* Updates about sim time request

* Updated changelog and readme

Co-authored-by: Thomas Denewiler <thomas.denewiler@navy.mil>
Co-authored-by: jpliquid <65894393+jpliquid@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 15, 2020
1 parent 7693fdb commit d3f5417
Show file tree
Hide file tree
Showing 132 changed files with 521 additions and 627 deletions.
150 changes: 52 additions & 98 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,132 +1,86 @@
---
name: CI

on:
on: # NOLINT
pull_request:
push:
schedule:
- cron: '0 0 */2 * *' # Every 2 days at midnight
# push:
# branches: [ master ]
# pull_request:
# branches: [ master ]
- cron: '0 0 */2 * *' # Every 2 days at midnight

jobs:
test_docker:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ros_distribution:
- eloquent

build_path:
- ros_ws/src
gazebo-version: [9, 11]
# 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:
# Eloquent Elusor (November 2019 - November 2020)
- docker_image: ubuntu:bionic
ros_distribution: eloquent
ros_version: 2

container:
image: ${{ matrix.docker_image }}
# Foxy Fitzroy (May 2020 - May 2023)
- docker_image: ros:foxy
ros_distribution: foxy

steps:
- name: sudo
run: |
apt-get update
apt-get install --no-install-recommends --quiet --yes sudo
container: ${{ matrix.docker_image }}

# Base packages + killall (for killing gazebo)
- name: base
run: |
apt-get update
apt-get install build-essential clang cmake git wget libasio-dev libtinyxml2-dev lcov -y
apt-get install psmisc
defaults:
run:
shell: bash

# action/setup-ros is not used yet as it installs pytest > 6.0 which leads to syntax errors...
- name: install ros
steps:
- uses: actions/checkout@v2
with:
path: src/plankton

- name: Install Tools
run: |
apt update && apt install locales
locale-gen en_US en_US.UTF-8
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
bash -c echo 'Etc/UTC' > /etc/timezone
ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime
apt install tzdata -y
apt update && apt install curl gnupg2 lsb-release -y
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'
apt update
apt install ros-${{ matrix.ros_distribution }}-desktop -y
apt install python3-rosdep -y
rosdep init
sudo apt update
sudo apt install -y build-essential clang cmake git wget libasio-dev libtinyxml2-dev lcov psmisc
rosdep update
apt install python3-colcon-common-extensions python3-colcon-coveragepy-result python3-colcon-lcov-result python3-colcon-library-path python3-colcon-metadata python3-colcon-mixin -y
#- name: setup ROS environment
# uses: ros-tooling/setup-ros@0.0.25
# with:
# required-ros-distributions: ${{ matrix.ros_distribution }}
sudo apt install -y python3-colcon-coveragepy-result
sudo apt install -y python3-colcon-lcov-result
#install Gazebo, install eloquent specific packages, create src directory
- name: prepare
- name: Install Gazebo
run: |
apt-get -qq update
apt-get -qq upgrade -y
echo Installing Gazebo ${{ matrix.gazebo-version }}
sudo sh -c '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 - | sudo apt-key add -
apt-get install gazebo9 -y
apt-get install libgazebo9-dev -y
apt install ros-${{ matrix.ros_distribution }}-gazebo-ros-pkgs -y
apt install ros-eloquent-launch-xml -y
apt install ros-eloquent-launch-yaml -y
mkdir -p ${{ matrix.build_path }}
- name: checkout
uses: actions/checkout@v2
with:
path: ${{ matrix.build_path }}

- name: rosdep
run: DEBIAN_FRONTEND=noninteractive rosdep update && rosdep install --from-paths ${{ matrix.build_path }} --ignore-src --rosdistro ${{ matrix.ros_distribution }} -y
sudo apt update
sudo apt install -y gazebo${{ matrix.gazebo-version }}
sudo apt install -y libgazebo${{ matrix.gazebo-version }}-dev
sudo apt install -y ros-${{ matrix.ros_distribution }}-gazebo-ros-pkgs
- name: build
run: . /opt/ros/${{ matrix.ros_distribution }}/setup.sh && colcon build --packages-up-to plankton --merge-install
- name: Install Dependencies
run: |
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro ${{ matrix.ros_distribution }} -y
- name: Build Packages
run: |
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh
colcon build --packages-up-to plankton --merge-install
- name: run tests
- name: Run Unit Tests
id: action_ros_ci_step
run: . /opt/ros/${{ matrix.ros_distribution }}/setup.sh && colcon test --merge-install --packages-up-to plankton --event-handlers console_cohesion+

- name: echo results
run: . /opt/ros/${{ matrix.ros_distribution }}/setup.sh && colcon test-result --all --verbose

- name: upload Logs
run: |
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh
colcon test --merge-install --packages-up-to plankton --event-handlers console_cohesion+
- name: Unit Test Results
run: |
echo Results for Gazebo ${{ matrix.gazebo-version }}
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh
colcon test-result --all --verbose
- name: Upload Logs
uses: actions/upload-artifact@v1
with:
name: colcon-logs-linux
path: log/
if: always()

# This workflow contains a single job called "build"
#build:
# The type of runner that the job will run on
# runs-on: ubuntu-18.04

# steps:
# - uses: actions/checkout@v2
# - uses: ros-tooling/setup-ros@0.0.25
# with:
# required-ros-distributions: eloquent
# - uses: ros-tooling/action-ros-ci@0.0.19
# with:
# package-name: plankton
# target-ros2-distro: eloquent



15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## 0.6.0
### General

- Migration to ROS 2 Foxy
- Added support for Gazebo 11
- Files parsed by Xacro are now directly output as a string and loaded as a node parameter in the various launch files
- Known issue: teleop shows unexpected behaviour with the trajectory control package's controllers, as well as the rov_mb_sm controller / rov_nl_pid_controller
- Known issue: the CPC sensor and the custom battery plugins crash when loaded
- Known issue: DVL and camera sensor won't show in Rviz
- Known issue: The subprocess based sim time request fails when the plankton sim time node is launched within the same launch file. A simple fix is to start the sim time node first and separately

### uuv_thruster_manager

- [**thruster_manager.py**] The thruster manager now gets and parse the urdf robot description from a topic instead of a file

## 0.5.3

### General
Expand Down
40 changes: 19 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It is a maritime environment simulator with an open source core, and a special f

We intend to build a sustainable and open source core simulator for maritime robotics research. This core will support flexible specification of sensor suites and environmental conditions.

This project benefits from great open source advances in the simulation domain, mainly ROS, gazebo and its plugin UUV Simulator.
This project benefits from great open source advances in the simulation domain, mainly ROS, Gazebo and its plugin UUV Simulator.
It is also built on data characterizing the needs of robotics researchers in terms of simulation. We gathered these data in our [wiki](https://github.com/Liquid-ai/Plankton/wiki), including the results of our [own survey](https://github.com/Liquid-ai/Plankton/blob/master/user_needs/Survey_about_simulators_for_robotics_research.pdf) on simulation needs.

# Roadmap #
Expand All @@ -34,34 +34,38 @@ So you are considering making a code contribution, great! We love to have contri
Before starting hands-on on coding, please check out our issue board to see if we are already working on that, it would be a pity putting an effort into something just to discover that someone else was already working on that. In case of doubt or to discuss how to proceed, please contact one of us (or send an email to info@liquid-tech.ai).

# Installation #
Plankton currently relies (and has only been tested with) on **Ubuntu 18.04**, **ROS 2 Eloquent** and **Gazebo 9**, even if the package should work with later versions, considering some adjustments.
Plankton currently supports:

### 1. Install ROS 2 Eloquent
- **ROS 2 Foxy** with **Gazebo 9** or **Gazebo 11** and **Ubuntu 20.04**

If you don’t have ROS 2 eloquent installed, follow the instructions below and prefer to install the `ros-eloquent-desktop` package:
<https://index.ros.org/doc/ros2/Installation/Eloquent/Linux-Install-Debians/>
- **ROS 2 Eloquent**, **Ubuntu 18.04** and **Gazebo 9**

### 2. Install Gazebo 9
### 1. Install ROS 2 Foxy

If you don't have Gazebo 9 installed, open a terminal and follow the steps below:
If you don’t have ROS 2 Foxy installed, follow the instructions below and prefer to install the `ros-foxy-desktop` package:
<https://index.ros.org/doc/ros2/Installation/Foxy/Linux-Install-Debians/>

### 2. Install Gazebo 11

If you don't have Gazebo 11 installed, open a terminal and follow the steps below:

```
sudo sh -c '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 - | sudo apt-key add -
sudo apt-get update
sudo apt-get install gazebo9
sudo apt-get install libgazebo9-dev
sudo apt-get install gazebo11
sudo apt-get install libgazebo11-dev
```

You can write `gazebo` in a terminal to make sure that gazebo runs correctly. Write `gazebo --version` to ensure that the version number is 9.X.
You can write `gazebo` in a terminal to make sure that gazebo runs correctly. Write `gazebo --version` to ensure that the version number is 11.X.

>For more information about the installation of Gazebo, refer to the official installation documentation (beware that the default installation command will not install the version 9):
>For more information about the installation of Gazebo, refer to the official installation documentation (beware that the default installation command will not install the version 11):
><http://gazebosim.org/tutorials?tut=install_ubuntu&cat=install>
### 3. Install the ros packages for gazebo

Write in a terminal:
`sudo apt install ros-eloquent-gazebo-ros-pkgs`
`sudo apt install ros-foxy-gazebo-ros-pkgs`

>See <http://gazebosim.org/tutorials?tut=ros2_installing&cat=connect_ros> for more detailed information about gazebo and ROS 2 connection.
Expand All @@ -81,7 +85,7 @@ Now, clone the Plankton repository:

At this point, you need to source 2 different files described below to configure ROS 2 and Gazebo environment variables:
- For ROS 2 variables
`source /opt/ros/eloquent/setup.bash`
`source /opt/ros/foxy/setup.bash`
- For Gazebo
`source /usr/share/gazebo/setup.sh`

Expand All @@ -95,7 +99,7 @@ rosdep update
Browse to the root of your workspace and check for missing dependencies:
```
cd ~/ros2_ws/
rosdep install -i --from-path src --rosdistro eloquent -y
rosdep install -i --from-path src --rosdistro foxy -y
```

Install Colcon, the build tool system:
Expand All @@ -107,12 +111,6 @@ Build the Plankton repository:
Source the file for your installation workspace (change the path accordingly)
`source $HOME/ros2_ws/install/setup.bash`

Now, install the XML / YAML frontend for launch files, which are missing in Eloquent:
```
sudo apt install ros-eloquent-launch-xml
sudo apt install ros-eloquent-launch-yaml
```

Next step is… No next step, you are already done!
If everything went well, you should be able to run example cases.

Expand All @@ -121,7 +119,7 @@ If everything went well, you should be able to run example cases.
Note: Every time you open a new terminal, you need to source 3 different files described below to configure ROS 2 and Gazebo environment variables. Write the following each time you start a new terminal to deal with ROS 2 / Gazebo stuff, or prefer to add them at the end of your .bashrc file with `gedit ~/.bashrc`. For the latter, don’t forget to source your .bashrc to enforce the update after saving these changes, or open a fresh terminal.

- For ROS 2 variables
`source /opt/ros/eloquent/setup.bash`
`source /opt/ros/foxy/setup.bash`
- For your installation workspace (change the path accordingly)
`source $HOME/ros2_ws/install/setup.bash`
- For Gazebo
Expand Down
2 changes: 1 addition & 1 deletion plankton/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<package format="3">
<name>plankton</name>
<version>0.5.3</version>
<version>0.6.0</version>
<description>Open source simulator for maritime robotics research</description>

<author email="loic.mougeolle@naval-group.com">Loïc Mougeolle</author>
Expand Down
2 changes: 1 addition & 1 deletion plankton_utils/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<package format="3">
<name>plankton_utils</name>

<version>0.5.3</version>
<version>0.6.0</version>
<description>A collection of functions to help interacting with ROS 2 API</description>

<author email="jean-philip-a.royer@naval-group.com">Jean-Philip Royer</author>
Expand Down
2 changes: 1 addition & 1 deletion plankton_utils/src/plankton_utils/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __is_sim_time_subprocess(timeout_sec= 5, default_value=False, return_param=T
from subprocess import TimeoutExpired

output = subprocess.check_output(
['ros2', 'param', 'get', '/plankton_global_sim_time', 'use_sim_time'],
['ros2 param get /plankton_global_sim_time use_sim_time'],
timeout=max(timeout_sec - (time.time() - starting_time), 0),
shell=True
)
Expand Down
5 changes: 4 additions & 1 deletion uuv_assistants/launch/message_to_tf.launch
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
<arg name="world_frame" default="world"/>
<arg name="child_frame_id" default="/$(var namespace)/base_link"/>
<arg name="odometry_topic" default="/$(var namespace)/pose_gt"/>
<arg name="use_sim_time" default="true"/>

<group>
<push-ros-namespace namespace="$(var namespace)"/>
<!-- publish state and tf for in relation to the world frame -->
<node node-name="ground_truth_to_tf_$(var namespace)" pkg="uuv_assistants" exec="uuv_message_to_tf" output="screen">
<node name="ground_truth_to_tf_$(var namespace)" pkg="uuv_assistants" exec="uuv_message_to_tf" output="screen">
<param name="odometry_topic" value="$(var odometry_topic)" />
<param name="frame_id" value="$(var world_frame)" />
<param name="stabilized_frame_id" value="/$(var namespace)/base_stabilized" />
<param name="footprint_frame_id" value="/$(var namespace)/base_footprint" />
<param name="child_frame_id" value="$(var child_frame_id)" />
<!-- FIXME Directy test sim time value in the node -->
<param name="use_sim_time" value="$(var use_sim_time)" />
</node>
</group>
</launch>
2 changes: 1 addition & 1 deletion uuv_assistants/launch/publish_body_sname.launch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<group>
<push-ros-namespace namespace="$(var uuv_name)"/>
<node pkg="tf2_ros" exec="static_transform_publisher" node-name="sname_frame_publisher"
<node pkg="tf2_ros" exec="static_transform_publisher" name="sname_frame_publisher"
args="0 0 0 0 0 3.141592653589793 /$(var uuv_name)/base_link /$(var uuv_name)/base_link_ned" />
<param name="use_sim_time" value="$(var use_sim_time)"/>
</group>
Expand Down
2 changes: 1 addition & 1 deletion uuv_assistants/launch/publish_footprints.launch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<launch>
<node node-name="publish_footprints" pkg="uuv_assistants" exec="publish_footprints.py" output="screen"/>
<node name="publish_footprints" pkg="uuv_assistants" exec="publish_footprints.py" output="screen"/>
</launch>

6 changes: 3 additions & 3 deletions uuv_assistants/launch/publish_vehicle_footprint.launch
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

<group>
<push-ros-namespace namespace="$(arg uuv_name)"/>
<node node-name="publish_footprints"
pkg="uuv_assistants"
exec="publish_vehicle_footprint.py"
<node name="publish_footprints"
pkg="uuv_assistants"
exec="publish_vehicle_footprint.py"
output="screen">
<remap from="odom" to="$(arg odom_topic)"/>
<param name="scale_footprint" value="$(var scale_footprint)"/>
Expand Down
2 changes: 1 addition & 1 deletion uuv_assistants/launch/publish_world_ned_frame.launch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<launch>
<arg name="use_sim_time" default="true"/>

<node pkg="tf2_ros" exec="static_transform_publisher" node-name="world_ned_frame_publisher"
<node pkg="tf2_ros" exec="static_transform_publisher" name="world_ned_frame_publisher"
args="0 0 0 1.5707963267948966 0 3.141592653589793 world world_ned" >
<param name="use_sim_time" value="$(var use_sim_time)"/>
</node>
Expand Down
2 changes: 1 addition & 1 deletion uuv_assistants/launch/set_simulation_timer.launch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<arg name="timeout" />

<!-- FIXME Required is currently not defined in the xml and needs python way launch files... -->
<node node-name="simulation_timeout" pkg="uuv_assistants" exec="set_simulation_timer.py" required="true"
<node name="simulation_timeout" pkg="uuv_assistants" exec="set_simulation_timer.py" required="true"
output="screen">
<param name="timeout" value="$(var timeout)"/>
</node>
Expand Down
Loading

0 comments on commit d3f5417

Please sign in to comment.