Skip to content

Setup of SITL environment

Marek Kühn edited this page Oct 4, 2018 · 1 revision

Setup of SITL environment for testing PX4 autopilot with Gazebo

This is a guide to install SITL testing environment to validate PX4 functionality.

Tested with:

  • Ubuntu 18.04
  • PX4 Thunderfly fork
  • QGroundControl 3.4.3
  • Gazebo 9.4.1

Install prerequisities

QGRoundControl

wget https://s3-us-west-2.amazonaws.com/qgroundcontrol/latest/QGroundControl.AppImage
chmod +x ./QGroundControl.AppImage

To start just double click the file or use terminal:

./QGroundControl.AppImage

Gazebo 9

Follow the instructions here: [http://gazebosim.org/tutorials?tut=install_ubuntu]

Or alternatively

sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install gazebo9 libgazebo9-dev

Install additional dependencies

sudo apt-get install libprotobuf-dev libprotoc-dev protobuf-compiler libeigen3-dev \
			libxml2-utils python-rospkg python-jinja2`
sudo apt-get install python-setuptools python-dev build-essential python-pip \ 
			python-empy python-opencv libopencv-dev
sudo pip install numpy toml catkin-pkg

Checkout repos

git clone https://github.com/ThunderFly-aerospace/PX4Firmware.git
git checkout autogyro-sitl
git submodule update --init --recursive

The submodule in Tools/sitl_gazebo should also be checkout out at autogyro-sitl branch.

Run the simulations

Start the QGRoundControl. It runs independently and connects whenever there is working Gazebo with mavlink interface running.

Navigate to the PX4Firmware folder and run:

make posix_sitl_default gazebo_TF-G1

you can replace TF-G1 with any of different worlds defined in ... PX4Firmware/Tools/sitl_gazebo/worlds