ArduPilot & SITL

is a simulator that allows you to run ArduPilot on your PC without any special hardware. It is a build of the autopilot code using an ordinary C++ compiler, giving you a native executable that allows

  • Versioning Warning:

    • Might need Gazebo Garden

Installation Instructions [1]

Open the terminal with Ctrl + Alt + T

sudo apt-get update
sudo apt-get install git
sudo apt-get install gitk git-gui
git clone --recurse-submodules https://github.com/ArduPilot/ardupilot.git

Note: this takes a minute

cd ardupilot
Tools/environment_install/install-prereqs-ubuntu.sh -y

Note: this takes a minute

. ~/.profile

SITL Set up [2]

cd ~/ardupilot/ArduCopter
sim_vehicle.py -w

Note: this is only ran once right after installing

wait until [ 0/1195] completes

Pop up will show of command line "Setting SIM_SPEEDUP=1.0000 ...."

Once done, hit (Ctrl + C) or (Ctrl + D) to stop program

sim_vehicle.py --console --map

Console, Map, ArduCopter with 'X' will pop up

hit (Ctrl + C) or (Ctrl + D) to stop program

#in terminal
STABILIZE> 
mode guided
arm throttle
*wait gps*
arm throttle
takeoff 1
mode LAND

Set up Gazebo with SITL

sudo apt update && sudo apt upgrade -y
sudo apt install libgz-sim7-dev rapidjson-dev -y

create workspace and clone repo

Note: this is where you will launch "gz sim etc.."

cd ~
mkdir -p gz_ws/src && cd gz_ws/src
git clone https://github.com/ArduPilot/ardupilot_gazebo

Build the plugin

cd ardupilot_gazebo
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j4

Note: need to run following two before sim (every time)

export GZ_SIM_SYSTEM_PLUGIN_PATH=$HOME/gz_ws/src/ardupilot_gazebo/build:$GZ_SIM_SYSTEM_PLUGIN_PATH
export GZ_SIM_RESOURCE_PATH=$HOME/gz_ws/src/ardupilot_gazebo/models:$HOME/gz_ws/src/ardupilot_gazebo/worlds:$GZ_SIM_RESOURCE_PATH

Sources

[1] ArduPilot Setup on Linux (Note: Finished at "Cleaning" step) [2] SITL Setup [x] ArduPilot SITL Tutorial

Last updated