Summary: This set of instructions guides you through the installation of Ardupilot and Software-in-the-Loop (SITL) along with Gazebo simulation. It involves cloning a repository, setting up Ardupilot, configuring Gazebo, and testing the integration of Ardupilot with Gazebo.
Requirements:
- Ubuntu 20.04 or 22.04
- Graphics card recommended
- git
sudo apt install git
- up to date packages
sudo apt-get update && sudo apt-get upgrade -y
Instructions:
- Install Ardupilot & SITL:
- Setup Ardupilot & SITL
git clone https://github.com/Sky-Labs-Research/Ardupilot-SITL-Gazebo-Setup.git cd Ardupilot-SITL-Gazebo-Setup . ./setup_ardupilot.sh . ~/.profile
- Test Ardupilot SITL
# In another console (CTRL+T Opens a new console tab) sim_vehicle.py -v ArduCopter -w --map --console
- Setup Ardupilot & SITL
- Install Gazebo [Garden/7 or Harmonic/8, see here for which version is compatible with your OS]:
- Setup Gazebo
for Garden
for Harmonic
. ./setup_gazebo_garden.sh
. ./setup_gazebo_harmonic.sh
- Test Gazebo
gz sim -v4 -r shapes.sdf
- Setup Gazebo
for Garden
- Install Ardupilot + Gazebo:
- Setup Ardupilot Gazebo for garden
or harmonic
echo 'export GZ_VERSION=garden' >> ~/.bashrc source ~/.bashrc . ./setup_ardupilot_gazebo_garden.sh 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 source ~/.bashrc
echo 'export GZ_VERSION=harmonic' >> ~/.bashrc source ~/.bashrc . ./setup_ardupilot_gazebo_harmonic.sh 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 source ~/.bashrc
- Test Ardupilot and Gazebo
# In one console gz sim -v4 -r iris_runway.sdf # In another console (CTRL+T Opens a new console tab) sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --map --console # Arm and Take off # STABILIZE> mode guided # GUIDED> arm throttle # GUIDED> takeoff 5
- Setup Ardupilot Gazebo for garden
Common Issues:
sim_vehicle.py: command not found
: Try to refresh your terminal profile with. ~/.profile
gz-sim Unable to find or download file
: gazebo is unable to find the installed worlds and models from ardupilot_gazebo. Ensure you exported the paths to bashrc and refresh your terminal environment withsource ~/.bashrc
Virtual Box Simulation Speed Tip:
If running on VirtualBox you can get higher simulation speed by enabling 3D acceleration for the Virtual Machine.
- Open the Terminal on your machine and navigate to the Virtualbox directory.
cd "C:\Program Files\Oracle\Virtualbox"
- Modify your virtual machine (In this case "Ubuntu") to use 256 mb VRAM
vboxmanage modifyvm "Ubuntu" --vram 256
- Modify your gazebo start command to use a differnt render engine
--render-engine ogre
Gz sim -v4 -r --render-engine ogre iris_runway.sdf
References:
- Ardupilot setup: Building Setup for Linux
- Setting up SITL on Linux: Ardupilot Documentation
- Gazebo setup: Install Gazebo on Ubuntu
- Ardupilot with Gazebo: SITL with Gazebo
No Script (Manual) Instructions:
Please view each .sh script for line by line comments of each command.
This software includes components from the ArduPilot project, which are licensed under the GNU General Public License version 3 (GPLv3). You can find the source code for ArduPilot at https://github.com/ArduPilot/ardupilot. The full text of the GPLv3 license can be found at https://www.gnu.org/licenses/gpl-3.0.html.