# Install SUAVE locally To install the exemplar locally, you have to [install Gazebo Garden](#install-gazebo-garden), [install ROS2 Humble](#install-ros2-humble), [install ArduSub](#install-ardusub), [install the ArduSub plugin](#install-ardusub-plugin), and finally [install the SUAVE workspace](#install-suave-workspace). ## Install Gazebo Garden Follow the [official instructions](https://gazebosim.org/docs/garden/install_ubuntu) for installing Gazebo Garden. ## Install ROS2 Humble Follow the [official instructions](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html) for installing ROS2 Humble. ## Install ArduSub ArduSub is a subproject within ArduPilot for piloting underwater vehicles. **Disclaimer:** Problems may occur with different combinations of ArduPilot and MavROS versions. This repo was tested with [this ArduPilot commit](https://github.com/ArduPilot/ardupilot/tree/94ba4ece5f9ccdf632b95938f8e644a622f5ee75) and [mavros 2.4.0](https://github.com/mavlink/mavros/tree/01eccd8). Unfortunately, at least at the time of writing this README, the releases available in Ubuntu 22.04 do not match. ```Bash cd ~/ git clone https://github.com/ArduPilot/ardupilot.git cd ardupilot git checkout e9f46b9 git submodule update --init --recursive ``` Note that the script used to install prerequisites available for this version of ArduSub does not work in Ubuntu 22.04. Therefore, you need to replace them before running ArduSub. To install the ArduPilot prerequisites, do the following. ```Bash cd ~/ardupilot cd Tools/environment_install/ rm install-prereqs-ubuntu.sh wget https://raw.githubusercontent.com/ArduPilot/ardupilot/master/Tools/environment_install/install-prereqs-ubuntu.sh cd ~/ardupilot chmod +x Tools/environment_install/install-prereqs-ubuntu.sh Tools/environment_install/install-prereqs-ubuntu.sh -y . ~/.profile ``` To test if the installation worked, run: ```Bash sim_vehicle.py -v ArduSub -L RATBeach --console --map ``` ArduPilot SITL should open and a console plus a map should appear. ## Install ArduSub plugin Install the dependencies: ```Bash sudo apt install libgz-sim7-dev rapidjson-dev ``` Clone and build the repository: ```Bash cd ~/ git clone https://github.com/ArduPilot/ardupilot_gazebo cd ardupilot_gazebo mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo make -j4 ``` Add the required paths: Assuming that you have cloned the repository in `$HOME/ardupilot_gazebo`, run: ```bash echo 'export GZ_SIM_SYSTEM_PLUGIN_PATH=$HOME/ardupilot_gazebo/build:${GZ_SIM_SYSTEM_PLUGIN_PATH}' >> ~/.bashrc echo 'export GZ_SIM_RESOURCE_PATH=$HOME/ardupilot_gazebo/models:$HOME/ardupilot_gazebo/worlds:${GZ_SIM_RESOURCE_PATH}' >> ~/.bashrc ``` Now that new environmental variables have been added to your terminal, you need to reload it with ```bash source ~/.bashrc ``` More info about the plugin can be found in the corresponding [repository](https://github.com/ArduPilot/ardupilot_gazebo/). ## Install SUAVE workspace Create the workspace and download the required repositories: ```Bash mkdir -p ~/suave_ws/src/ cd ~/suave_ws/ ``` If you want to get the most updated version of the repo: ```Bash wget https://raw.githubusercontent.com/kas-lab/suave/main/suave.rosinstall vcs import src < suave.rosinstall --recursive ``` **SEAMS2023:** If you want to get the version submitted to SEAMS 2023 instead of the most updated version get the following dependencies instead: ```Bash wget https://raw.githubusercontent.com/kas-lab/suave/9e6468896ce766376557ca9522d84f92b70129f1/suave.rosinstall vcs import src < suave.rosinstall --recursive ``` Before building the `ros_gz` package (one of the dependencies), you need to export the gazebo version: ``` export GZ_VERSION="garden" ``` You can also add this to your `~/.bashrc` to make this process easier. Install the dependencies: ```Bash source /opt/ros/humble/setup.bash cd ~/suave_ws/ rosdep install --from-paths src --ignore-src -r -y ``` Build the project: ```Bash cd ~/suave_ws/ colcon build --symlink-install ``` If you have memory problems while building the package, run the following command instead, it is slower but uses less memory: ```Bash colcon build --symlink-install --executor sequential --parallel-workers 1 ``` Install a MAVROS dependency: ```Bash wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh sudo bash ./install_geographiclib_datasets.sh ```