Development Guide

Gazebo Simulation

Gazebo is a 3D simulation environment for autonomous robots. It can be used with ROS as complete robotics simulation suite or standalone, and this guide covers the simpler to set up standalone operation.

graph LR; Gazebo-->Plugin; Plugin-->MAVLink; MAVLink-->SITL;


The installation requires to install Gazebo and our simulation plugin.

Mac OS

Mac OS requires Gazebo 6.

brew install gazebo6


The PX4 SITL uses the Gazebo simulator, but does not depend on ROS. The simulation can be interfaced to ROS the same way as normal flight code is.

ROS Users

If you plan to use PX4 with ROS, make sure to follow the Gazebo version guide for version 6 for ROS.

Normal Installation

Follow the Linux installation instructions for Gazebo 6.

Running the Simulation

From within the source directory of the PX4 Firmware run the PX4 SITL with one of the airframes (Quads, planes and VTOL are supported, including optical flow):


cd ~/src/Firmware
make posix_sitl_default gazebo

Quadrotor with Optical Flow

cd ~/src/Firmware
make posix gazebo_iris_opt_flow

Standard VTOL

cd ~/src/Firmware
make posix_sitl_default gazebo_standard_vtol

Tailsitter VTOL

cd ~/src/Firmware
make posix_sitl_default gazebo_tailsitter

This will bring up the PX4 shell:

[init] shell id: 140735313310464
[init] task name: mainapp

______  __   __    ___
| ___ \ \ \ / /   /   |
| |_/ /  \ V /   / /| |
|  __/   /   \  / /_| |
| |     / /^\ \ \___  |
\_|     \/   \/     |_/

Ready to fly.


Taking it to the Sky

The system will print the home position once it finished intializing (telem> home: 55.7533950, 37.6254270, -0.00). You can bring it into the air by typing:

pxh> commander takeoff

Extending and Customizing

To extend or customize the simulation interface, edit the files in the Tools/sitl_gazebo folder. The code can be accessed through the sitl_gazebo repository on Github.

Interfacing to ROS

The simulation can be interfaced to ROS the same way as onboard a real vehicle.