This repo contains examples of PX4 SITL with Gazebo.
The PX4 firmware is installed as git submodule. The examples here assume to use that code without modifications, and it is separated from the src/
directory. To clone this repo, you need to use the following command instead of the regular git clone
:
git clone --recursive <project_url>
Before running anything, you need to make the PX4 Firmware, follow the instruction here executed in the directory /px4-firmware
. The last step of those instructions could be:
make px4_sitl gazebo
And then ctl+c to turn off the execution when successfully you see the drone on Gazebo.
More information about other targets could be found here
This code depends on a few packages most of them are already installed on a full-desktop-ROS installation and the compilation of the PX4 firmware. In addition to that, you need to install MAVROS.
To compile the examples use catkin:
catkin_make
Each example will have a launch-*.sh
script that will set up the environment variables as described here to run the example package and PX4. Those common variables are expressed in launch-common.sh.
-
Running PX4 + Gazebo:
launch-px4-sitl.sh
-
Offboard example:
launch-offb.sh
. This is the MAVROS Offboard control example wrapped on a ROS packageoffb
. The script uses the launch fileoffb.launch
including themavros_posix_stil.launch
. -
Offboard velocity example:
launch-offb-velocity.sh
. Offboard control example from Intel Aero sample apps. Video