Linux allows you to build for all PX4 targets (NuttX based hardware, Qualcomm Snapdragon Flight hardware, Linux-based hardware, Simulation, ROS).
Tip Ubuntu Linux LTS 16.04 is the tested/supported Linux distribution for most development. Ubuntu 18.04 LTS with ROS Melodic is used for ROS development. Instructions are also provided for CentOS and Arch Linux.
The following instructions explain how to set up a development environment on Ubuntu LTS using convenience bash scripts. Instructions for manually installing these and additional targets can be found in Ubuntu/Debian Linux.
The instructions below show how you can use our convenience bash scripts to setup the developer toolchain on Ubuntu LTS. All the scripts install the Qt Creator IDE, Ninja Build System, Common Dependencies, FastRTPS, and also download the PX4 source to your computer (~/src/Firmware).
Tip The scripts have been tested on clean Ubuntu LTS 16.04 and Ubuntu LTS 18.04 installations. They may not work as expected if installed on top of an existing system or on another Ubuntu release. If you have any problems then follow the manual installation instructions.
First make the user a member of the group "dialout":
- On the command prompt enter:
sudo usermod -a -G dialout $USER
- Logout and login again (the change is only made after a new login).
Then follow the instructions for your development target in the sections below.
To install the development toolchain:
- Download ubuntu_sim_nuttx.sh.
- Run the script in a bash shell:
You may need to acknowledge some prompts as the script progresses.
source ubuntu_sim_nuttx.sh
- Restart the computer on completion.
Setup instructions for Snapdragon Flight are provided in the PX4 User Guide:
To install the development toolchain:
- Download ubuntu_sim_common_deps.sh (this contains the jMAVSim simulator and common toolchain dependencies).
- Run the script in a bash shell:
You may need to acknowledge some prompts as the script progresses.
source ubuntu_sim_common_deps.sh
- Follow setup instructions in Ubuntu/Debian Linux for Raspberry Pi.
Follow the (manual) instructions here: Ubuntu/Debian Linux > Parrot Bebop.
To install the Gazebo9 and jMAVSim simulators:
- Download ubuntu_sim.sh.
- Run the script in a bash shell:
You may need to acknowledge some prompts as the script progresses.
source ubuntu_sim.sh
Tip If you just need jMAVSim, instead download and run ubuntu_sim_common_deps.sh.
Note PX4 works with Gazebo 7, 8, and 9. The script installs Gazebo 9.
Note PX4 is tested with ROS Melodic on Ubuntu 18.04 LTS. ROS Melodic does not work on Ubuntu 16.04.
To install the development toolchain:
- Download ubuntu_sim_ros_melodic.sh.
- Run the script in a bash shell:
You may need to acknowledge some prompts as the script progresses.
source ubuntu_sim_ros_melodic.sh
Note:
- ROS Melodic is installed with Gazebo9 by default.
- Your catkin (ROS build system) workspace is created at ~/catkin_ws/.
After setting up the build/simulation toolchain, see Additional Tools for information about other useful tools.
Once you have finished setting up the environment, continue to the build instructions.