srmainwaring / asv_wave_sim

This package contains plugins that support the simulation of waves and surface vessels in Gazebo.
GNU General Public License v3.0
114 stars 31 forks source link

Add ship landing example #20

Closed srmainwaring closed 2 years ago

srmainwaring commented 2 years ago

This issue is to track adding a ship landing example using the WAM-V (scaled) and an Alti-Transition quad-plane from ArduPilot/SITL_Models. It is intended as a PoC / demo and is not intended to be merged back into the ignition-marine branch.

Example branch

https://github.com/srmainwaring/asv_wave_sim/tree/feature/ship-landing-demo

Tasks

srmainwaring commented 2 years ago

Example session - speed up 8x.

Run on a 2013 MacBook with 8GB RAM (which is only just enough to run Ignition). A modern high-spec machine with 16+GB RAM is a must to run the example at near RT speeds.

https://user-images.githubusercontent.com/24916364/162032176-a2d503a0-4f75-4785-b2e2-f24ba90b1819.mov

User Guide

The example should be considered very much a beta version. It depends upon development branches of Ignition and ArduPilot/ardupilot_gazebo. It has only been tested on macOS and while it should port to Ubuntu this is not guaranteed.

Dependencies

Build

Follow the ignition-marine branch instructions for installing dependencies and building. If you have the dependencies, the main steps are:

$ mkdir -p ~/ign_marine_ws/src && cd ~/ign_marine_ws/src
$ git clone https://github.com/srmainwaring/asv_wave_sim -b feature/ship-landing-demo
$ export IGNITION_VERSION=garden
$ colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_MACOSX_RPATH=FALSE -DCMAKE_INSTALL_NAME_DIR=$(pwd)/install/lib

Configure

Configure each terminal that will be used to run Ignition commands:

#--------------------------------------------------------------------------
# Set Ignition environment variables
export IGN_VERBOSE=0
export IGN_IP=127.0.0.1

# assuming Ignition is built from source in a colcon workspace 
export IGN_CONFIG_PATH=\
$HOME/ign_fortress_ws/install/share/ignition

# location of model and world files, edit as required
export IGN_GAZEBO_RESOURCE_PATH=\
$HOME/ardupilot_gazebo/models:\
$HOME/ardupilot_gazebo/worlds:\
$HOME/SITL_Models/Ignition/models:\
$HOME/SITL_Models/Ignition/worlds:\
$HOME/ign_marine_ws/src/asv_wave_sim/ign-marine-models/models:\
$HOME/ign_marine_ws/src/asv_wave_sim/ign-marine-models/world_models:\
$HOME/ign_marine_ws/src/asv_wave_sim/ign-marine-models/worlds

# location of system plugins, edit as required
export IGN_GAZEBO_SYSTEM_PLUGIN_PATH=\
$HOME/ardupilot_gazebo/build:\
$HOME/ign_marine_ws/install/lib

#--------------------------------------------------------------------------
# Use brew version of ruby to avoid SIP issues
export PATH=/usr/local/opt/ruby/bin:$PATH

Run

ArduPilot

Start SITL:

# the script assumes SITL will be launched from the ardupilot root directory
$ cd ~/ardupilot

# edit the paths for the script variables: ARDUPILOT_ROOT, SITL_MODELS_DIR,
# IGN_MARINE_MODELS_DIR as required, then run the script 
$ ~/ign_marine_ws/src/asv_wave_sim/ign-marine-models/launch/ship-quadplane-landing.sh

Start MAVProxy:

# the argument 2 represents the number of vehicles 
$ ~/ign_marine_ws/src/asv_wave_sim/ign-marine-models/launch/mavproxy-multi-vehicle.sh 2
Ignition Gazebo

Remember to source the Ignition workspace and export the environment variables from the configure step above before running Ignition.

Start the server:

$ ign gazebo -v4 -s -r waves.sdf

Start the client:

$ ign gazebo -v4 -g
srmainwaring commented 2 years ago

The two ship-landing examples are available on:

The second version is used in this presentation https://youtu.be/NY5wKlkeJAs at the ArduPilot dev conference 2022