UAV Systems Engineering · M6-L1 · Hands-on lab (runs on your machine)
Install PX4
Get a working PX4 build environment, the foundation for every simulation lab that follows.
What you will do
You will clone PX4-Autopilot, run its Ubuntu setup script, and build the SITL target. PX4 documents which Ubuntu releases and simulators are supported for each release: check the “Development environment” page of the PX4 documentation for your version first and follow it where it differs from the commands below, which reflect the documented flow for recent releases.
Before you start
- A 64-bit Ubuntu machine, VM or container with at least 20 GB free disk and a few GB of RAM (check the PX4 docs for the supported Ubuntu version).
- git, a stable internet connection and sudo rights for the setup script.
- Lessons M6-T1 and M6-T3 (what PX4 is and its architecture) are recommended.
Steps
- Clone the repository with its submodules:
git clone https://github.com/PX4/PX4-Autopilot.git --recursive. - Run the setup script:
bash ./PX4-Autopilot/Tools/setup/ubuntu.sh. It installs the toolchain and, by default, the simulator dependencies. Log out and back in (or reboot) when it tells you to. - Check out the release tag you want to work with (
git checkout v1.15.0for example, or the tag you choose), thengit submodule update --init --recursive. Record the tag: you will need it for px4_msgs. - Build the SITL target:
cd PX4-Autopilot && make px4_sitl.
git clone https://github.com/PX4/PX4-Autopilot.git --recursive
bash ./PX4-Autopilot/Tools/setup/ubuntu.sh
cd PX4-Autopilot
git describe --tags # note the version you are on
make px4_sitl # builds the SITL firmware (first build takes several minutes)How to know it worked
make px4_sitlfinishes without errors and the build directorybuild/px4_sitl_defaultexists.- You have written down the exact PX4 tag or commit and your Ubuntu version.
- You can state which simulator your PX4 version uses by default (the next lab runs it).
If it does not work
| Symptom | Likely cause | What to check |
|---|---|---|
| Setup script fails on dependencies | Unsupported Ubuntu release or missing sudo | Compare with the supported releases in the PX4 documentation; use a supported version or container |
| Out of disk or memory during build | Build needs several GB | Free space; reduce parallel jobs |
| Submodule errors | Interrupted clone or wrong tag | Run git submodule update --init --recursive on the checked-out tag |
| Python or CMake version errors | Mixed system and user packages | Use the versions installed by the setup script; open a fresh shell after setup |
References
Record your progress
Saved in this browser. This lab runs on your own machine, so the site cannot check it for you.