Середовище розробки Ubuntu
The following instructions use a bash script to set up the PX4 development environment on the Ubuntu Linux LTS versions supported by PX4: Ubuntu 24.04 (Nimble Numbat) and Ubuntu 22.04 (Jammy Jellyfish).
The environment includes:
- Gazebo Simulator (Gazebo Harmonic)
- Build toolchain for Pixhawk (and other NuttX-based hardware) using the
gcc-arm-none-eabicompiler from the Ubuntu package manager.
The build toolchain for other flight controllers, simulators, and working with ROS are discussed in the Other Targets section below.
INFO
PX4 targets the current Ubuntu LTS (24.04) for CI and release builds, with the previous LTS (22.04) also supported. Older Ubuntu versions are not supported and may not work.
Симуляція та NuttX (Pixhawk)
Use the ubuntu.sh script to set up a development environment that allows you to build for simulators and/or the NuttX/Pixhawk toolchain.
TIP
The script is intended to be run on clean Ubuntu LTS installations, and may not work if run "on top" of an existing system, or on a different Ubuntu release.
Щоб встановити інструментарій:
- sh
git clone https://github.com/PX4/PX4-Autopilot.git --recursiveINFO
The environment setup scripts in the source usually work for recent PX4 releases. If working with an older version of PX4 you may need to get the source code specific to your release.
:::
Run the ubuntu.sh with no arguments (in a bash shell) to install everything:
shbash ./PX4-Autopilot/Tools/setup/ubuntu.sh- При появі підказки по ходу виконання скрипту підтвердить вибір.
- You can use the
--no-nuttxand--no-sim-toolsoptions to omit the NuttX and/or simulation tools.
Перезавантажте комп'ютер при завершенні.
Details
Additional notes These notes are provided "for information only":
This setup is supported by the PX4 Dev Team. Інструкції також можуть працювати на інших системах заснованих на Debian Linux.
You can verify the NuttX installation by confirming
gccis available. The version depends on your Ubuntu release (e.g. GCC 13.2.1 on Ubuntu 24.04):sh$ arm-none-eabi-gcc --version arm-none-eabi-gcc (15:13.2.rel1-2) 13.2.1 20231009 Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.Вам все одно потрібен вихідний код PX4. But if you just wanted to set up the development environment without getting all the source code you could instead just download ubuntu.sh and requirements.txt and then run ubuntu.sh:
shwget https://raw.githubusercontent.com/PX4/PX4-Autopilot/main/Tools/setup/ubuntu.sh wget https://raw.githubusercontent.com/PX4/PX4-Autopilot/main/Tools/setup/requirements.txt bash ubuntu.sh
Other Targets
The Ubuntu development environment for ROS, other simulators, and other hardware targets, is covered in their respective documentation. A subset of the relevant topics are linked below.
Raspberry Pi
ROS
- ROS 2: ROS 2 User Guide > Installation & Setup.
- ROS (1): ROS (1) Installation Guide
Наступні кроки
Після того, як ви закінчите налаштування інструментів командного рядка:
Install VSCode (if you prefer using an IDE to the command line).
Install the QGroundControl Daily Build
TIP
The daily build includes development tools that hidden in release builds. Вона також може надати доступ до нових функцій PX4, які ще не підтримуються в релізних збірках.
:::
- Continue to the build instructions.