Move PX4 Guide source into /docs (#24490)

* Add vitepress tree

* Update existing workflows so they dont trigger on changes in the docs path

* Add nojekyll, package.json, LICENCE etc

* Add crowdin docs upload/download scripts

* Add docs flaw checker workflows

* Used docs prefix for docs workflows

* Crowdin obvious fixes

* ci: docs move to self hosted runner

runs on a beefy server for faster builds

Signed-off-by: Ramon Roche <mrpollo@gmail.com>

* ci: don't run build action for docs or ci changes

Signed-off-by: Ramon Roche <mrpollo@gmail.com>

* ci: update runners

Signed-off-by: Ramon Roche <mrpollo@gmail.com>

* Add docs/en

* Add docs assets and scripts

* Fix up editlinks to point to PX4 sources

* Download just the translations that are supported

* Add translation sources for zh, uk, ko

* Update latest tranlsation and uorb graphs

* update vitepress to latest

---------

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
Co-authored-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
Hamish Willee
2025-03-13 16:08:27 +11:00
committed by GitHub
co-authored by Ramon Roche
parent 8e6d2ebe4a
commit 88d623bedb
5176 changed files with 558771 additions and 2 deletions
+401
View File
@@ -0,0 +1,401 @@
# Збірка програмного забезпечення PX4
Збірку прошивки PX4 для цільових апаратних платформ та симуляції можна здійснити з вихідного коду в консолі або в IDE.
You need to build PX4 in order to use [simulators](../simulation/index.md), or if you want to modify PX4 and create a custom build.
If you just want to try out PX4 on real hardware then [load the prebuilt binaries](../config/firmware.md) using QGroundControl (there is no need to follow these instructions).
:::info
Before following these instructions you must first install the [Developer Toolchain](../dev_setup/dev_env.md) for your host operating system and target hardware.
If you have any problems after following these steps see the [Troubleshooting](#troubleshooting) section below.
:::
## Завантаження вихідного коду PX4
The PX4 source code is stored on Github in the [PX4/PX4-Autopilot](https://github.com/PX4/PX4-Autopilot) repository.
To get the _very latest_ (`main` branch) version onto your computer, enter the following command into a terminal:
```sh
git clone https://github.com/PX4/PX4-Autopilot.git --recursive
```
Note that you may already have done this when installing the [Developer Toolchain](../dev_setup/dev_env.md)
:::info
This is all you need to do in order to get the latest code.
If needed you can also [get the source code specific to a particular release](../contribute/git_examples.md#get-a-specific-release).
[GIT Examples](../contribute/git_examples.md) provides a lot more information working with releases and contributing to PX4.
:::
## First Build (Using a Simulator)
Спочатку ми зберемо цільову платформу симуляції з використанням консольного середовища.
Це дозволяє нам перевірити налаштування системи перед її запуском на реальному обладнанні та IDE.
Navigate into the **PX4-Autopilot** directory.
Depending on your operating system you will have installed either [Gazebo SITL](../sim_gazebo_gz/index.md) or [Gazebo Classic SITL](../sim_gazebo_classic/index.md) (if you don't know which you can try both).
:::: tabs
:::tab Gazebo
Start [Gazebo SITL](../sim_gazebo_gz/index.md) using the following command:
```sh
make px4_sitl gz_x500
```
:::
:::tab Gazebo-Classic
Start [Gazebo SITL](../sim_gazebo_gz/index.md) using the following command:
```sh
make px4_sitl gazebo-classic
```
:::
::::
This will bring up the PX4 console:
![PX4 Console](../../assets/toolchain/console_gazebo.png)
:::info
You may need to start _QGroundControl_ before proceeding, as the default PX4 configuration requires a ground control connection before takeoff.
This can be [downloaded from here](https://docs.qgroundcontrol.com/master/en/qgc-user-guide/getting_started/download_and_install.html).
:::
The drone can be flown by typing the following command (as shown in the console above):
```sh
pxh> commander takeoff
```
The vehicle will take off and you'll see this in the simulator UI:
:::: tabs
:::tab Gazebo
![Gazebo UI with vehicle taking off](../../assets/toolchain/gazebo_takeoff.png)
:::
:::tab Gazebo-Classic
![Gazebo Classic UI with vehicle taking off](../../assets/toolchain/gazebo_classic_takeoff.png)
:::
::::
The drone can be landed by typing `commander land` and the whole simulation can be stopped by doing **CTRL+C** (or by entering `shutdown`).
Симуляція польоту з управлінням з боку наземного оператора є ближчою до реального запуску дрону.
В польоті (режимі зльоту) натисніть на місце розташування на карті та пересуньте (увімкніть) повзунковий перемикач.
Це перемістить літальний засіб.
![QGroundControl GoTo](../../assets/toolchain/qgc_goto.jpg)
## Плати на основі NuttX / Pixhawk
### Збірка під NuttX
To build for NuttX- or Pixhawk- based boards, navigate into the **PX4-Autopilot** directory and then call `make` with the build target for your board.
For example, to build for [Pixhawk 4](../flight_controller/pixhawk4.md) hardware you could use the following command:
```sh
cd PX4-Autopilot
make px4_fmu-v5_default
```
Успішне виконання виведе в консолі приблизно наступне в кінці:
```sh
-- Build files have been written to: /home/youruser/src/PX4-Autopilot/build/px4_fmu-v4_default
[954/954] Creating /home/youruser/src/PX4-Autopilot/build/px4_fmu-v4_default/px4_fmu-v4_default.px4
```
The first part of the build target `px4_fmu-v4` indicates the target flight controller hardware for the firmware.
The suffix, in this case `_default`, indicates a firmware _configuration_, such as supporting or omitting particular features.
:::info
The `_default` suffix is optional.
For example, `make px4_fmu-v5` and `px4_fmu-v5_default` result in the same firmware.
:::
The following list shows the build commands for the [Pixhawk standard](../flight_controller/autopilot_pixhawk_standard.md) boards:
- [Holybro Pixhawk 6X-RT (FMUv6X)](../flight_controller/pixhawk6x-rt.md): `make px4_fmu-v6xrt_default`
- [Holybro Pixhawk 6X (FMUv6X)](../flight_controller/pixhawk6x.md): `make px4_fmu-v6x_default`
- [Holybro Pixhawk 6C (FMUv6C)](../flight_controller/pixhawk6c.md): `make px4_fmu-v6c_default`
- [Holybro Pixhawk 6C Mini (FMUv6C)](../flight_controller/pixhawk6c_mini.md): `make px4_fmu-v6c_default`
- [Holybro Pix32 v6 (FMUv6C)](../flight_controller/holybro_pix32_v6.md): `make px4_fmu-v6c_default`
- [Holybro Pixhawk 5X (FMUv5X)](../flight_controller/pixhawk5x.md): `make px4_fmu-v5x_default`
- [Pixhawk 4 (FMUv5)](../flight_controller/pixhawk4.md): `make px4_fmu-v5_default`
- [Pixhawk 4 Mini (FMUv5)](../flight_controller/pixhawk4_mini.md): `make px4_fmu-v5_default`
- [CUAV V5+ (FMUv5)](../flight_controller/cuav_v5_plus.md): `make px4_fmu-v5_default`
- [CUAV V5 nano (FMUv5)](../flight_controller/cuav_v5_nano.md): `make px4_fmu-v5_default`
- [Pixracer (FMUv4)](../flight_controller/pixracer.md): `make px4_fmu-v4_default`
- [Pixhawk 3 Pro](../flight_controller/pixhawk3_pro.md): `make px4_fmu-v4pro_default`
- [Pixhawk Mini](../flight_controller/pixhawk_mini.md): `make px4_fmu-v3_default`
- [Pixhawk 2 (Cube Black) (FMUv3)](../flight_controller/pixhawk-2.md): `make px4_fmu-v3_default`
- [mRo Pixhawk (FMUv3)](../flight_controller/mro_pixhawk.md): `make px4_fmu-v3_default` (supports 2MB Flash)
- [Holybro pix32 (FMUv2)](../flight_controller/holybro_pix32.md): `make px4_fmu-v2_default`
- [Pixfalcon (FMUv2)](../flight_controller/pixfalcon.md): `make px4_fmu-v2_default`
- [Dropix (FMUv2)](../flight_controller/dropix.md): `make px4_fmu-v2_default`
- [Pixhawk 1 (FMUv2)](../flight_controller/pixhawk.md): `make px4_fmu-v2_default`
:::warning
You **must** use a supported version of GCC to build this board (e.g. the same as used by [CI/docker](../test_and_ci/docker.md)) or remove modules from the build. Збірка прошивки за допомогою компілятора GCC, який не підтримується може зазнати невдачі, оскільки обсяг памʼяті, який займає PX4, близький до ліміту пам'яті плати в 1 МБ.
:::
- Pixhawk 1 with 2 MB flash: `make px4_fmu-v3_default`
Build commands for non-Pixhawk NuttX fight controllers (and for all other-boards) are provided in the documentation for the individual [flight controller boards](../flight_controller/index.md).
### Завантаження прошивки (Прошивка плати)
Append `upload` to the make commands to upload the compiled binary to the autopilot hardware via USB.
Наприклад
```sh
make px4_fmu-v4_default upload
```
Успішне виконання виведе в консолі приблизно наступне:
```sh
Erase : [====================] 100.0%
Program: [====================] 100.0%
Verify : [====================] 100.0%
Rebooting.
[100%] Built target upload
```
:::tip
This is not supported when developing on WSL2.
See [ Windows Development Environment (WSL2-Based) > Flash a Control Board](../dev_setup/dev_env_windows_wsl.md#flash-a-flight-control-board).
:::
## Інші плати
Build commands for other boards are given the [board-specific flight controller pages](../flight_controller/index.md) (usually under a heading _Building Firmware_).
Список усіх конфігурацій й цілей можна викликати командою:
```sh
make list_config_targets
```
## Компіляція в графічному IDE
[VSCode](../dev_setup/vscode.md) is the officially supported (and recommended) IDE for PX4 development.
VSCode просто налаштувати та може використатися для компіляції PX4 як для симуляцій так і для апаратних середовищ.
## Усунення проблем
### Загальні помилки збірки
Більшість проблем при збірці спричинені залежними гілками коду які не збігаються або не до кінця очищеним середовищем збірки.
Updating the submodules and doing a `distclean` can fix these kinds of errors:
```sh
git submodule update --recursive
make distclean
```
### Прошивка переповнена на XXX байт
The `region 'flash' overflowed by XXXX bytes` error indicates that the firmware is too large for the target hardware platform.
This is common for `make px4_fmu-v2_default` builds, where the flash size is limited to 1MB.
If you're building the _vanilla_ master branch, the most likely cause is using an unsupported version of GCC.
In this case, install the version specified in the [Developer Toolchain](../dev_setup/dev_env.md) instructions.
If building your own branch, it is possible that you have increased the firmware size over the 1MB limit.
В цьому випадку вам доведеться видалити всі не потрібні при цій збірці модулі та драйвера.
### macOS: Помилка "надто багато відкритих файлів"
MacOS дозволяє тримати за замовчуванням відкритими не більше 256 файлів в усіх запущених процесах.
При збірці PX4 відкривається велика кількість файлів, тож може статися перевищення цього ліміту.
The build toolchain will then report `Too many open files` for many files, as shown below:
```sh
/usr/local/Cellar/gcc-arm-none-eabi/20171218/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld: cannot find NuttX/nuttx/fs/libfs.a: Too many open files
```
Рішення полягає в збільшенні максимально дозволеної кількості відкритих файлів (наприклад, до 300).
You can do this in the macOS _Terminal_ for each session:
- Run this script [Tools/mac_set_ulimit.sh](https://github.com/PX4/PX4-Autopilot/blob/main/Tools/mac_set_ulimit.sh), or
- Введіть наступну команду:
```sh
ulimit -S -n 300
```
### macOS Catalina: Складнощі при використанні cmake
As of macOS Catalina 10.15.1 there may be problems when trying to build the simulator with _cmake_.
Якщо у вас виникли проблеми на цій платформі, спробуйте виконати наступну команду в терміналі:
```sh
xcode-select --install
sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/* /usr/local/include/
```
### Ubuntu 18.04: Помилки компіляції пов'язані з arm_none_eabi_gcc
Build issues related to `arm_none_eabi_gcc`may be due to a broken g++ toolchain installation.
Ви можете перевірити чи це так, перевіряючи чи є відсутні залежності:
```sh
arm-none-eabi-gcc --version
arm-none-eabi-g++ --version
arm-none-eabi-gdb --version
arm-none-eabi-size --version
```
Приклад виводу bash з відсутніми залежностями:
```sh
arm-none-eabi-gdb --version
arm-none-eabi-gdb: command not found
```
This can be resolved by removing and [reinstalling the compiler](https://askubuntu.com/questions/1243252/how-to-install-arm-none-eabi-gdb-on-ubuntu-20-04-lts-focal-fossa).
### Ubuntu 18.04: "Visual Studio Code не може спостерігати за змінами в коді у великому робочому середовищі
See [Visual Studio Code IDE (VSCode) > Troubleshooting](../dev_setup/vscode.md#troubleshooting).
### Не вдалося імпортувати пакети Python
"Failed to import" errors when running the `make px4_sitl jmavsim` command indicates that some Python packages are not installed (where expected).
```sh
Failed to import jinja2: No module named 'jinja2'
You may need to install it using:
pip3 install --user jinja2
```
Якщо ці залежності вже встановлені, це може бути тому, що на комп'ютері є декілька версій Python (наприклад Python 2.7.16, Python 3.8.3) і модуль не існує в версії, яка використовується в інструментарії збірки.
Ви зможете виправити це явним чином встановивши залежності як показано:
```sh
pip3 install --user pyserial empty toml numpy pandas jinja2 pyyaml pyros-genmsg packaging
```
## Цілі збірки PX4
The previous sections showed how you can call _make_ to build a number of different targets, start simulators, use IDEs etc.
This section shows how _make_ options are constructed and how to find the available choices.
The full syntax to call _make_ with a particular configuration and initialization file is:
```sh
make [VENDOR_][MODEL][_VARIANT] [VIEWER_MODEL_DEBUGGER_WORLD]
```
**VENDOR_MODEL_VARIANT**: (also known as `CONFIGURATION_TARGET`)
- **VENDOR:** The manufacturer of the board: `px4`, `aerotenna`, `airmind`, `atlflight`, `auav`, `beaglebone`, `intel`, `nxp`, etc.
The vendor name for Pixhawk series boards is `px4`.
- **MODEL:** The _board model_ "model": `sitl`, `fmu-v2`, `fmu-v3`, `fmu-v4`, `fmu-v5`, `navio2`, etc.
- **VARIANT:** Indicates particular configurations: e.g. `bootloader`, `cyphal`, which contain components that are not present in the `default` configuration.
Most commonly this is `default`, and may be omitted.
:::tip
You can get a list of _all_ available `CONFIGURATION_TARGET` options using the command below:
```sh
make list_config_targets
```
:::
**VIEWER_MODEL_DEBUGGER_WORLD:**
- **VIEWER:** This is the simulator ("viewer") to launch and connect: `gz`, `gazebo`, `jmavsim`, `none` <!-- , ?airsim -->
:::tip
`none` can be used if you want to launch PX4 and wait for a simulator (jmavsim, Gazebo, Gazebo Classic, or some other simulator).
For example, `make px4_sitl none_iris` launches PX4 without a simulator (but with the iris airframe).
:::
- **MODEL:** The _vehicle_ model to use (e.g. `iris` (_default_), `rover`, `tailsitter`, etc), which will be loaded by the simulator.
The environment variable `PX4_SIM_MODEL` will be set to the selected model, which is then used in the [startup script](../simulation/index.md#startup-scripts) to select appropriate parameters.
- **DEBUGGER:** Debugger to use: `none` (_default_), `ide`, `gdb`, `lldb`, `ddd`, `valgrind`, `callgrind`.
For more information see [Simulation Debugging](../debug/simulation_debugging.md).
- **WORLD:** (Gazebo Classic only).
Set the world ([PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/worlds](https://github.com/PX4/PX4-SITL_gazebo-classic/tree/main/worlds)) that is loaded.
Default is [empty.world](https://github.com/PX4/PX4-SITL_gazebo-classic/blob/main/worlds/empty.world).
For more information see [Gazebo Classic > Loading a Specific World](../sim_gazebo_classic/index.md#loading-a-specific-world).
:::tip
You can get a list of _all_ available `VIEWER_MODEL_DEBUGGER_WORLD` options using the command below:
```sh
make px4_sitl list_vmd_make_targets
```
:::
::: info
- Most of the values in the `CONFIGURATION_TARGET` and `VIEWER_MODEL_DEBUGGER` have defaults, and are hence optional.
For example, `gazebo-classic` is equivalent to `gazebo-classic_iris` or `gazebo-classic_iris_none`.
- Ви можете використати три підкреслювання, якщо хочете вказати значення за замовчуванням між двома іншими налаштуваннями.
For example, `gazebo-classic___gdb` is equivalent to `gazebo-classic_iris_gdb`.
- You can use a `none` value for `VIEWER_MODEL_DEBUGGER` to start PX4 and wait for a simulator.
For example start PX4 using `make px4_sitl_default none` and jMAVSim using `./Tools/simulation/jmavsim/jmavsim_run.sh -l`.
:::
The `VENDOR_MODEL_VARIANT` options map to particular _px4board_ configuration files in the PX4 source tree under the [/boards](https://github.com/PX4/PX4-Autopilot/tree/main/boards) directory.
Specifically `VENDOR_MODEL_VARIANT` maps to a configuration file **boards/VENDOR/MODEL/VARIANT.px4board**
(e.g. `px4_fmu-v5_default` corresponds to [boards/px4/fmu-v5/default.px4board](https://github.com/PX4/PX4-Autopilot/blob/main/boards/px4/fmu-v5/default.px4board)).
Додаткові цілі збірки обговорюються в відповідних розділах:
- `bloaty_compare_master`: [Binary Size Profiling](../debug/binary_size_profiling.md)
- ...
## Firmware Version & Git Tags
The _PX4 Firmware Version_ and _Custom Firmware Version_ are published using the MAVLink [AUTOPILOT_VERSION](https://mavlink.io/en/messages/common.html#AUTOPILOT_VERSION) message, and displayed in the _QGroundControl_ **Setup > Summary** airframe panel:
![Firmware info](../../assets/gcs/qgc_setup_summary_airframe_firmware.jpg)
These are extracted at build time from the active _git tag_ for your repo tree.
The git tag should be formatted as `<PX4-version>-<vendor-version>` (e.g. the tag in the image above was set to `v1.8.1-2.22.1`).
:::warning
If you use a different git tag format, versions information may not be displayed properly.
:::
+58
View File
@@ -0,0 +1,58 @@
# Initial Setup & Configuration
Ми рекомендуємо розробникам отримати базове обладнання та програмне забезпечення, описане нижче (або подібне).
## Базове обладнання
:::tip
PX4 can be used with a much wider range of equipment than described here, but new developers will benefit from going with one of the standard setups.
A Taranis RC and a mid-range Android tablet make a very inexpensive field kit.
:::
Нижченаведене обладнання дуже рекомендується:
- **RC controller** for the safety pilot
- [Taranis Plus](https://www.frsky-rc.com/product/taranis-x9d-plus-2/) RC control (or equivalent)
- **Development computer**
::: info
The listed computers have acceptable performance, but a more recent and powerful computer is recommended.
:::
- Lenovo Thinkpad with i5-core running Windows 11
- MacBook Pro (early 2015 and later) with macOS 10.15 or later
- Lenovo Thinkpad i5 with Ubuntu Linux 20.04 or later
- **Ground control station** (computer or tablet):
- iPad (may require Wifi telemetry adapter)
- Будь-який ноутбук MacBook або Ubuntu Linux (може бути комп'ютером для розробки)
- A recent mid-range Android tablet or phone with a large enough screen to run _QGroundControl_ effectively (6 inches).
- **Vehicle capable of running PX4**:
- [Get a prebuilt vehicle](../complete_vehicles_mc/index.md)
- [Build your own](../frames_multicopter/kits.md)
- **Safety glasses**
- **Tether** (multicopter only - for more risky tests)
## Конфігурація рухомого засобу
Install the [QGroundControl Daily Build](../dev_setup/qgc_daily_build.md) for a **desktop OS**.
Для налаштування засобу:
1. [Install PX4 firmware](../config/firmware.md#installing-px4-main-beta-or-custom-firmware) (including "custom" firmware with your own changes).
2. [Start with the airframe](../config/airframe.md) that best-matches your vehicle from the [airframe reference](../airframes/airframe_reference.md).
3. [Basic Configuration](../config/index.md) explains how to perform basic configuration.
4. [Parameter Configuration](../advanced_config/parameters.md) explains how you can find and modify individual parameters.
::: info
- _QGroundControl_ mobile variants do not support vehicle configuration.
- The _daily build_ includes development tools and new features that are not available in the official release.
- Конфігурації в довіднику планерів літали на реальних засобах та є хорошою стартовою точкою для "відриву від землі".
:::
+30
View File
@@ -0,0 +1,30 @@
# Налаштування середовища розробника (Інструментарію)
The _supported platforms_ for PX4 development are:
- [Ubuntu Linux (22.04/20.04/18.04)](../dev_setup/dev_env_linux_ubuntu.md) — Recommended
- [Windows (10/11)](../dev_setup/dev_env_windows_wsl.md) — via WSL2
- [Mac OS](../dev_setup/dev_env_mac.md)
## Цільові платформи що підтримуються
Таблиця нижче показує, які цільові платформи PX4 можна побудувати на кожній ОС.
| Цільова платформа | Linux (Ubuntu) | Mac | Windows |
| ------------------------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------: | :-: | :-----: |
| **NuttX based hardware:** [Pixhawk Series](../flight_controller/pixhawk_series.md), [Crazyflie](../complete_vehicles_mc/crazyflie2.md) | ✓ | ✓ | ✓ |
| **Linux-based hardware:** [Raspberry Pi 2/3](../flight_controller/raspberry_pi_navio2.md) | ✓ | | |
| **Simulation:** [Gazebo SITL](../sim_gazebo_gz/index.md) | ✓ | ✓ | ✓ |
| **Simulation:** [Gazebo Classic SITL](../sim_gazebo_classic/index.md) | ✓ | ✓ | ✓ |
| **Simulation:** [ROS with Gazebo Classic](../simulation/ros_interface.md) | ✓ | | ✓ |
| **Simulation:** ROS 2 with Gazebo | ✓ | | ✓ |
Experienced Docker users can also build with the containers used by our continuous integration system: [Docker Containers](../test_and_ci/docker.md)
## Наступні кроки
Після того, як ви закінчите налаштування одного з інструментаріїв вище:
- Install [VSCode](../dev_setup/vscode.md) (if you prefer using an IDE to the command line).
- Install the [QGroundControl Daily Build](../dev_setup/qgc_daily_build.md)
- Continue to [Building PX4 Software](../dev_setup/building_px4.md).
@@ -0,0 +1,36 @@
# Розширені варіанти налаштування Linux
## Використання адаптерів з програмування JTAG
Користувачам Linux потрібно явно дозволити доступ до USB шини для адаптерів програмування JTAG.
:::info
For Archlinux: replace the group plugdev with uucp in the following commands
:::
Run a simple `ls` in `sudo` mode to ensure the commands below succeed:
```sh
sudo ls
```
Then with `sudo` rights temporarily granted, run this command:
```sh
cat > $HOME/rule.tmp <<_EOF
# All 3D Robotics (includes PX4) devices
SUBSYSTEM=="usb", ATTR{idVendor}=="26AC", GROUP="plugdev"
# FTDI (and Black Magic Probe) Devices
SUBSYSTEM=="usb", ATTR{idVendor}=="0483", GROUP="plugdev"
# Olimex Devices
SUBSYSTEM=="usb", ATTR{idVendor}=="15ba", GROUP="plugdev"
_EOF
sudo mv $HOME/rule.tmp /etc/udev/rules.d/10-px4.rules
sudo /etc/init.d/udev restart
```
The user needs to be added to the group **plugdev**:
```sh
sudo usermod -a -G plugdev $USER
```
+1
View File
@@ -0,0 +1 @@
<Redirect to="dev_env_linux_ubuntu" />
+50
View File
@@ -0,0 +1,50 @@
# Середовище розробки Arch Linux
:::warning
This development environment is [community supported and maintained](../advanced/community_supported_dev_env).
Це може працювати або не працювати з поточними версіями PX4.
Дивіться [Встановлення інструментарію](../dev_setup/dev_env.md) для інформації про середовища та інструменти, що підтримуються основною командою розробників.
:::
The PX4-Autopilot repository provides a convenient script to set your Arch installation up for PX4 development: [Tools/setup/arch.sh](https://github.com/PX4/PX4-Autopilot/blob/main/Tools/setup/arch.sh). <!-- NEED px4_version -->
The script installs (by default) all tools to build PX4 for NuttX targets and run simulation with [JMAVSim](../sim_jmavsim/index.md).
You can additionally install the [Gazebo Classic](../sim_gazebo_classic/index.md) simulator by specifying the command line argument: `--gazebo`.
![Gazebo on Arch](../../assets/simulation/gazebo_classic/arch-gazebo.png)
:::info
The instructions have been tested on [Manjaro](https://manjaro.org/) (Arch based distribution) as it is much easier to set up than Arch Linux.
:::
Щоб отримати та запустити скрипти, виконайте одне із наступного:
- [Download PX4 Source Code](../dev_setup/building_px4.md) and run the scripts in place:
```sh
git clone https://github.com/PX4/PX4-Autopilot.git
bash PX4-Autopilot/Tools/setup/arch.sh
```
- Завантажте лише необхідні скрипти та запустіть їх:
```sh
wget https://raw.githubusercontent.com/PX4/PX4-Autopilot/main/Tools/setup/arch.sh
wget https://raw.githubusercontent.com/PX4/PX4-Autopilot/main/Tools/setup/requirements.txt
bash arch.sh
```
Скрипт приймає наступні параметри:
- `--gazebo`: Add this parameter to install Gazebo from the [AUR](https://aur.archlinux.org/packages/gazebo/).
::: info
Gazebo gets compiled from source.
It takes some time to install and requires entering the `sudo` password multiple times (for dependencies).
:::
- `--no-nuttx`: Do not install the NuttX/Pixhawk toolchain (i.e. if only using simulation).
- `--no-sim-tools`: Do not install jMAVSim/Gazebo (i.e. if only targeting Pixhawk/NuttX targets)
+99
View File
@@ -0,0 +1,99 @@
# Середовище розробки CentOS
:::warning
This development environment is [community supported and maintained](../advanced/community_supported_dev_env.md).
Це може працювати або не працювати з поточними версіями PX4.
Дивіться [Встановлення інструментарію](../dev_setup/dev_env.md) для інформації про середовища та інструменти, що підтримуються основною командою розробників.
:::
Збірка потребує Python 2.7.5. Тому потрібно використовувати CentOS 7 на момент написання.
(Для попередніх релізів CentOS можна встановити python v2.7.5 поряд із версією із дистрибутиву. Але це не рекомендується тому що можна зламати yum.)
## Загальні залежності
Репозиторії EPEL необхідні для пакетів openocd libftdi-devel libftdi-python
```sh
wget https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
sudo yum install epel-release-7-5.noarch.rpm
yum update
yum groupinstall “Development Tools”
yum install python-setuptools python-numpy
easy_install pyserial
easy_install pexpect
easy_install toml
easy_install pyyaml
easy_install cerberus
yum install openocd libftdi-devel libftdi-python python-argparse flex bison-devel ncurses-devel ncurses-libs autoconf texinfo libtool zlib-devel cmake vim-common
```
:::info
You may want to also install `python-pip` and `screen`.
:::
## Встановлення інструментарію GCC.
<!-- GCC toolchain documentation used for all Linux platforms to build NuttX -->
Виконайте скрипт нижче для встановлення GCC 7-2017-q4:
:::warning
This version of GCC is out of date.
At time of writing the current version on Ubuntu is `9-2020-q2-update` (see [focal nuttx docker file](https://github.com/PX4/PX4-containers/blob/master/docker/Dockerfile_nuttx-focal#L28))
:::
```sh
pushd .
cd ~
wget https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/7-2017q4/gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2
tar -jxf gcc-arm-none-eabi-7-2017-q4-major-linux.tar.bz2
exportline="export PATH=$HOME/gcc-arm-none-eabi-7-2017-q4-major/bin:\$PATH"
if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
popd
```
Тепер перезавантажте комп'ютер.
**Troubleshooting**
Перевірте версію, ввівши наступну команду:
```sh
arm-none-eabi-gcc --version
```
Результат повинен бути схожий на:
```sh
arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]
Copyright (C) 2017 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.
```
<!-- import docs ninja build system -->
## Система збірки Ninja
[Ninja](https://ninja-build.org/) is a faster build system than _Make_ and the PX4 _CMake_ generators support it.
На Ubuntu Linux ви можете встановити її автоматично зі звичайних репозиторіїв.
```sh
sudo apt-get install ninja-build -y
```
Інші системи можуть не включати Ninja в менеджер пакетів.
В цьому випадку альтернатива - завантажити бінарний файл і додати його до вашого шляху:
```sh
mkdir -p $HOME/ninja
cd $HOME/ninja
wget https://github.com/martine/ninja/releases/download/v1.6.0/ninja-linux.zip
unzip ninja-linux.zip
rm ninja-linux.zip
exportline="export PATH=$HOME/ninja:\$PATH"
if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
. ~/.profile
```
+123
View File
@@ -0,0 +1,123 @@
# Середовище розробки Ubuntu
The following instructions use a bash script to set up the PX4 development environment on the [Ubuntu Linux LTS](https://wiki.ubuntu.com/LTS) versions supported by PX4: Ubuntu 22.04 (Jammy Jellyfish), 20.04 (Focal Fossa), and 18.04 (Bionic Beaver).
The environment includes:
- [Gazebo Simulator](../sim_gazebo_gz/index.md) ("Harmonic") on Ubuntu 22.04
- [Gazebo Classic Simulator](../sim_gazebo_classic/index.md) on Ubuntu 20.04 and Ubuntu 18.04
- [Build toolchain for Pixhawk (and other NuttX-based hardware)](../dev_setup/building_px4.md#nuttx-pixhawk-based-boards).
:::info
The build toolchain for other flight controllers, simulators, and working with ROS are discussed in the [Other Targets](#other-targets) section below.
:::
:::tip
if you need to use Gazebo on Ubuntu 20.04 you can [manually install Gazebo "Garden"](../sim_gazebo_gz/index.md#installation-ubuntu-linux), with the caveat that this is end-of-life in November 2024.
If you want to use Gazebo Classic on Ubuntu 22.04 (say) then you can manually install it by following the instructions in [Gazebo Classic > Installation](../sim_gazebo_classic/index.md#installation).
:::
## Симуляція та NuttX (Pixhawk)
Use the [ubuntu.sh](https://github.com/PX4/PX4-Autopilot/blob/main/Tools/setup/ubuntu.sh) script to set up a development environment that allows you to build for simulators and/or the [NuttX/Pixhawk](../dev_setup/building_px4.md#nuttx-pixhawk-based-boards) 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.
:::
Щоб встановити інструментарій:
1. [Download PX4 Source Code](../dev_setup/building_px4.md):
```sh
git clone https://github.com/PX4/PX4-Autopilot.git --recursive
```
::: info
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](../contribute/git_examples.md#get-a-specific-release).
:::
2. Run the **ubuntu.sh** with no arguments (in a bash shell) to install everything:
```sh
bash ./PX4-Autopilot/Tools/setup/ubuntu.sh
```
- При появі підказки по ходу виконання скрипту підтвердить вибір.
- You can use the `--no-nuttx` and `--no-sim-tools` options to omit the NuttX and/or simulation tools.
3. Перезавантажте комп'ютер при завершенні.
:::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 the `gcc` version as shown:
```sh
$arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Arm Embedded Toolchain 9-2020-q2-update) 9.3.1 20200408 (release)
Copyright (C) 2019 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](https://github.com/PX4/PX4-Autopilot/blob/main/Tools/setup/ubuntu.sh) and [requirements.txt](https://github.com/PX4/PX4-Autopilot/blob/main/Tools/setup/requirements.txt) and then run **ubuntu.sh**:
```sh
wget 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
```
:::
## Відеоінструкція
This video shows how to install the toolchain for NuttX and simulation targets ([as covered below](#simulation-and-nuttx-pixhawk-targets)) along with the basic testing covered in [Building PX4 Software](../dev_setup/building_px4.md).
:::warning
The video suggests that you build source using JMAVSim, entering the command: `make px4_sitl jmavsim`.
As JMAVSim is now community-supported, you should instead build using Gazebo or Gazebo Classic, as shown in [Building the Code](../dev_setup/building_px4.md#first-build-using-a-simulator)
:::
<lite-youtube videoid="OtValQdAdrU" title=" Setting up your PX4 development environment on Linux"/>
## 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
- [Raspberry Pi 2/3 Navio2 Autopilot > PX4 Development Environment](../flight_controller/raspberry_pi_navio2.md#px4-development-environment)
- [Raspberry Pi 2/3/4 PilotPi Shield](../flight_controller/raspberry_pi_pilotpi.md).
ROS
- ROS 2: [ROS 2 User Guide > Installation & Setup](../ros2/user_guide.md#installation-setup).
- ROS (1): [ROS (1) Installation Guide](../ros/mavros_installation.md)
## Наступні кроки
Після того, як ви закінчите налаштування інструментів командного рядка:
- Install [VSCode](../dev_setup/vscode.md) (if you prefer using an IDE to the command line).
- Install the [QGroundControl Daily Build](../dev_setup/qgc_daily_build.md)
:::tip
The _daily build_ includes development tools that hidden in release builds.
Вона також може надати доступ до нових функцій PX4, які ще не підтримуються в релізних збірках.
:::
- Continue to the [build instructions](../dev_setup/building_px4.md).
+129
View File
@@ -0,0 +1,129 @@
# Середовище розробки MacOS
Наступні інструкції для встановлення середовища розробки PX4 для macOS.
Це середовище може бути використане для збірки PX4 для:
- Pixhawk та іншого апаратного забезпечення на основі NuttX
- [Gazebo Classic Simulation](../sim_gazebo_classic/index.md)
:::tip
This setup is supported by the PX4 dev team.
To build other targets you will need to use a [different OS](../dev_setup/dev_env.md#supported-targets) (or an [unsupported development environment](../advanced/community_supported_dev_env.md)).
:::
## Відеоінструкція
<lite-youtube videoid="tMbMGiMs1cQ" title="Setting up your PX4 development environment on macOS"/>
## Базове налаштування
"Базове" налаштування macOS встановлює інструменти, необхідні для збірки прошивки та включає загальні інструменти, які будуть потрібні для встановлення/використання симуляторів.
### Налаштування середовища
:::details
Apple Silicon Macbook users!
If you have an Apple M1, M2 etc. Macbook, make sure to run the terminal as x86 by setting up an x86 terminal:
1. Locate the Terminal application within the Utilities folder (**Finder > Go menu > Utilities**)
2. Select _Terminal.app_ and right-click on it, then choose **Duplicate**.
3. Rename the duplicated Terminal app, e.g. to _x86 Terminal_
4. Now select the renamed _x86 Terminal_ app and right-click and choose \*_Get Info_
5. Check the box for **Open using Rosetta**, then close the window
6. Run the _x86 Terminal_ as usual, which will fully support the current PX4 toolchain
:::
Спочатку налаштуйте середовище
1. Enable more open files by appending the following line to the `~/.zshenv` file (creating it if necessary):
```sh
echo ulimit -S -n 2048 >> ~/.zshenv
```
::: info
If you don't do this, the build toolchain may report the error: `"LD: too many open files"`
:::
2. Enforce Python 3 by appending the following lines to `~/.zshenv`
```sh
# Point pip3 to MacOS system python 3 pip
alias pip3=/usr/bin/pip3
```
### Загальні інструменти
Для налаштування середовища з можливістю збірки для обладнання Pixhawk/NuttX (і встановлення загальних інструментів для використання симуляторів):
1. Install Homebrew by following these [installation instructions](https://brew.sh).
2. Виконайте ці команди в командній оболонці для встановлення загальних інструментів:
```sh
brew tap PX4/px4
brew install px4-dev
```
3. Встановіть необхідні пакети Python:
```sh
# install required packages using pip3
python3 -m pip install --user pyserial empty toml numpy pandas jinja2 pyyaml pyros-genmsg packaging kconfiglib future jsonschema
# if this fails with a permissions error, your Python install is in a system path - use this command instead:
sudo -H python3 -m pip install --user pyserial empty toml numpy pandas jinja2 pyyaml pyros-genmsg packaging kconfiglib future jsonschema
```
## Симуляція Gazebo Classic
To setup the environment for [Gazebo Classic](../sim_gazebo_classic/index.md) simulation:
1. Виконайте наступні команди в командній оболонці:
```sh
brew unlink tbb
sed -i.bak '/disable! date:/s/^/ /; /disable! date:/s/./#/3' $(brew --prefix)/Library/Taps/homebrew/homebrew-core/Formula/tbb@2020.rb
brew install tbb@2020
brew link tbb@2020
```
::: info
September 2021: The commands above are a workaround to this bug: [PX4-Autopilot#17644](https://github.com/PX4/PX4-Autopilot/issues/17644).
Вони можуть бути видалені після того, як вона буде виправлена (разом з цією нотаткою).
:::
2. Для встановлення симуляції SITL з Gazebo Classic:
```sh
brew install --cask temurin
brew install --cask xquartz
brew install px4-sim-gazebo
```
3. Run the macOS setup script: `PX4-Autopilot/Tools/setup/macos.sh`
The easiest way to do this is to clone the PX4 source, and then run the script from the directory, as shown:
```sh
git clone https://github.com/PX4/PX4-Autopilot.git --recursive
cd PX4-Autopilot/Tools/setup
sh macos.sh
```
## Наступні кроки
Після того, як ви закінчите налаштування інструментів командного рядка:
- Install [VSCode](../dev_setup/vscode.md) (if you prefer using an IDE to the command line).
- Install the [QGroundControl Daily Build](../dev_setup/qgc_daily_build.md)
:::tip
The _daily build_ includes development tools that are hidden in release builds.
Вона також може надати доступ до нових функцій PX4, які ще не підтримуються в релізних збірках.
:::
- Continue to the [build instructions](../dev_setup/building_px4.md).
+1
View File
@@ -0,0 +1 @@
<Redirect to="dev_env_windows_wsl" />
+155
View File
@@ -0,0 +1,155 @@
# Середовище розробки Windows (засноване на Cygwin)
:::warning
This development environment is [community supported and maintained](../advanced/community_supported_dev_env.md).
Це може працювати або не працювати з поточними версіями PX4.
Цей інструментарій був рекомендований раніше, але наразі не працює з PX4 v1.12 і новіше через проблеми з пакетами.
The [Windows WSL2-Based Development Environment](../dev_setup/dev_env_windows_wsl.md) should be used by preference.
Дивіться [Встановлення інструментарію](../dev_setup/dev_env.md) для інформації про середовища та інструменти, що підтримуються основною командою розробників.
:::
Наступні інструкції пояснюють як налаштувати (на базі Cygwin) середовище розробки на Windows 10 для PX4.
Це середовище може бути використане для збірки PX4 для:
- Pixhawk та іншого апаратного забезпечення на основі NuttX
- [jMAVSim Simulation](../sim_jmavsim/index.md)
<a id="installation"></a>
## Інструкції з установки
1. Download the latest version of the ready-to-use MSI installer from: [Github releases](https://github.com/PX4/windows-toolchain/releases) or [Amazon S3](https://s3-us-west-2.amazonaws.com/px4-tools/PX4+Windows+Cygwin+Toolchain/PX4+Windows+Cygwin+Toolchain+0.9.msi) (fast download).
2. Запустіть, оберіть потрібне місце установки, дочекайтесь встановлення:
![jMAVSimOnWindows](../../assets/toolchain/cygwin_toolchain_installer.png)
3. Tick the box at the end of the installation to _clone the PX4 repository, build and run simulation with jMAVSim_ (this simplifies the process to get you started).
::: info
If you missed this step you will need to [clone the PX4-Autopilot repository manually](#getting-started).
:::
:::warning
At time of writing the installer is missing some dependencies (and cannot yet be rebuilt to add them - see [PX4-windows-toolchain#31](https://github.com/PX4/PX4-windows-toolchain/issues/31)).
Щоб додати їх самостійно:
1. Перейдіть в директорію встановлення інструментів (за замовчуванням **C:\\PX4\\**)
2. Run **run-console.bat** (double click) to start the linux-like Cygwin bash console
3. Введіть в консолі наступну команду:
```sh
pip3 install --user kconfiglib jsonschema future
```
:::
## Початок роботи
The toolchain uses a specially configured console window (started by running the **run-console.bat** script) from which you can call the normal PX4 build commands:
1. Перейдіть в директорію встановлення інструментів (за замовчуванням **C:\\PX4\\**)
2. Run **run-console.bat** (double click) to start the linux-like Cygwin bash console (you must use this console to build PX4).
3. Клонуйте репозиторій PX4 PX4-Autopilot з цієї консолі:
::: info
Skip this step if you ticked the installer option to _clone the PX4 repository, build and run simulation with jMAVSim_.
Клонування потрібно зробити тільки один раз!
:::
```sh
# Clone the PX4-Autopilot repository into the home folder & loads submodules in parallel
git clone --recursive -j8 https://github.com/PX4/PX4-Autopilot.git
```
Тепер можна використовувати консоль/PX4-Autopilot репозиторій для збірки PX4.
4. Наприклад, для запуску JMAVSim:
```sh
# Navigate to PX4-Autopilot repo
cd Firmware
# Build and runs SITL simulation with jMAVSim to test the setup
make px4_sitl jmavsim
```
Після цього консоль покаже:
![jMAVSimOnWindows](../../assets/simulation/jmavsim/jmavsim_windows_cygwin.png)
## Наступні кроки
Після того, як ви закінчите налаштування інструментів командного рядка:
- Install the [QGroundControl Daily Build](../dev_setup/qgc_daily_build.md)
- Continue to the [build instructions](../dev_setup/building_px4.md).
## Усунення проблем
### Інструменти моніторингу файлів проти швидкості інструментарію
Антивірус та інші інструменти моніторингу файлів у фоні можуть суттєво сповільнити встановлення інструментів та збірки PX4.
Можливо знадобиться тимчасово зупинити їх під час збірки (на власний розсуд).
### Windows & Git Special Cases
#### Символи закінчення рядків Windows CR+LF проти Unix LF
Ми рекомендуємо примусити використання закінчення рядків Unix LF для кожного репозиторію, з яким ви працюєте з цим інструментарієм (також використовуйте редактор, який залишає їх незмінними під час збереження змін, тобто Eclipse або VSCode).
Compilation of source files also works with CR+LF endings checked out locally, but there are cases in Cygwin (e.g. execution of shell scripts) that require Unix line endings (otherwise you get errors like `$'\r': Command not found.`).
На щастя, git може це зробити для вас, якщо виконаєте дві команди в кореневому каталозі вашого репозиторію:
```sh
git config core.autocrlf false
git config core.eol lf
```
Якщо ви працюєте з цим інструментарієм в декількох репозиторіях, ви також можете встановити ці дві конфігурації глобально для вашого комп'ютера:
```sh
git config --global ...
```
Це не рекомендується, оскільки це може вплинути на будь-які інші (непов'язані) випадки використання git на вашій Windows машині.
#### Біт виконання прав доступу Unix
Під Unix є прапорець в правах доступу кожного файлу, який вказує на те, чи дозволено файлу виконуватись.
_git_ under Cygwin supports and cares about that bit (even though the Windows NTFS file system does not use it).
This often results in _git_ finding "false-positive" differences in permissions.
Вивід diff в результаті може виглядати так:
```sh
diff --git ...
old mode 100644
new mode 100755
```
Ми рекомендуємо відключити глобально перевірку прав доступу у Windows, щоб уникнути проблем:
```sh
# глобально відключити перевірку біту виконання для комп'ютера
git config --global core.fileMode false
```
Для наявних репозиторіїв, що мають цю проблему викликану локальною конфігурацією, додатково виконайте:
```sh
# прибрати локальну конфігурацію, щоб застосувати глобальну
git config --unset core.filemode
# прибрати локальну конфігурацію для всіх підмодулів
git submodule foreach --recursive git config --unset core.filemode
```
<!--
Instructions for building/updating this toolchain are covered in [Windows Cygwin Development Environment (Maintenance Instructions)](../dev_setup/dev_env_windows_cygwin_packager_setup.md)
-->
@@ -0,0 +1,167 @@
# Середовище розробки Windows Cygwin (Інструкції з обслуговування)
:::warning
This development environment is [community supported and maintained](../advanced/community_supported_dev_env.md).
Це може працювати або не працювати з поточними версіями PX4.
Дивіться [Встановлення інструментарію](../dev_setup/dev_env.md) для інформації про середовища та інструменти, що підтримуються основною командою розробників.
:::
This topic explains how to construct and extend the development environment used for the no-longer-supported [Cygwin-based Windows Development Environment](../dev_setup/dev_env_windows_cygwin.md).
## Додаткова інформація
### Можливості / Проблеми
Відомо що наступні можливості працюють (версія 2.0):
- Building and running SITL with jMAVSim with significantly better performance than a VM (it generates a native windows binary **px4.exe**).
- Збірка та завантаження NuttX збірок (напр.: px4_fmu-v2 та px4_fmu-v4)
- Style check with _astyle_ (supports the command: `make format`)
- Автодоповнення в командному рядку
- Неінвазивний встановлювач! Встановлювач НЕ впливає на систему і глобальний шлях (лише змінює вибрану директорію установки, наприклад \*\*C:\PX4\*\* і використовує тимчасовий локальний шлях).
- Встановлювач підтримує оновлення до нової версії зі збереженням ваших особистих змін у теці інструментарію.
Відсутні:
- Симуляція: Gazebo та ROS не підтримуються.
- Підтримуються лише збірки NuttX і JMAVSim/SITL.
- [Known problems](https://github.com/orgs/PX4/projects/6) (Also use to report issues).
### Встановлення за допомогою скриптів оболонки
Ви також можете встановити середовище за допомогою скриптів в Github проєкті.
1. Make sure you have [Git for Windows](https://git-scm.com/download/win) installed.
2. Клонуйте репозиторій https://github.com/PX4/windows-toolchain туди куди ви хочете встановити інструментарій. Default location and naming is achieved by opening the `Git Bash` and executing:
```sh
cd /c/
git clone https://github.com/PX4/windows-toolchain PX4
```
3. If you want to install all components navigate to the freshly cloned folder and double click on the script `install-all-components.bat` located in the folder `toolchain`. If you only need certain components and want to safe Internet traffic and or disk space you can navigate to the different component folders like e.g. `toolchain\cygwin64` and click on the **install-XXX.bat** scripts to only fetch something specific.
4. Continue with [Getting Started](../dev_setup/dev_env_windows_cygwin.md#getting-started).
### Ручне встановлення (для розробників інструментарію)
Цей розділ описує як налаштувати інструментарій Cygwin вручну самостійно, із вказанням на відповідні скрипти з репозитарію установки за допомогою скриптів.
Результат повинен бути таким самим як при використанні скриптів, так і встановлювачі MSI.
:::info
The toolchain gets maintained and hence these instructions might not cover every detail of all the future changes.
:::
1. Create the _folders_: \*\*C:\PX4\*\*, \*\*C:\PX4\toolchain\*\* and \*\*C:\PX4\home\*\*
2. Download the _Cygwin installer_ file [setup-x86_64.exe](https://cygwin.com/setup-x86_64.exe) from the [official Cygwin website](https://cygwin.com/install.html)
3. Запустіть завантажений файл встановлювача
4. У майстрі оберіть встановлення в теку: \*\*C:\PX4\toolchain\cygwin64\*\*
5. Оберіть для встановлення стандартні основні пакети Cygwin і найновішу версію додаткових пакетів:
- **Category:Packagename**
- Devel:cmake (3.3.2 не дає попереджень про застарілість, 3.6.2 працює, але попереджає про це)
- Devel:gcc-g++
- Devel:gdb
- Devel:git
- Devel:make
- Devel:ninja
- Devel:patch
- Editors:xxd
- Editors:nano (якщо ви не професіонал із vim)
- Python:python2
- Python:python2-pip
- Python:python2-numpy
- Python:python2-jinja2
- Python:python2-pyyaml
- Python:python2-cerberus
- Archive:unzip
- Utils:astyle
- Shells:bash-completion
- Web:wget
::: info
Do not select as many packages as possible which are not on this list, there are some which conflict and break the builds.
:::
::: info
That's what [cygwin64/install-cygwin-px4.bat](https://github.com/MaEtUgR/PX4Toolchain/blob/master/toolchain/cygwin64/install-cygwin-px4.bat) does.
:::
6. Write up or copy the **batch scripts** [`run-console.bat`](https://github.com/MaEtUgR/PX4Toolchain/blob/master/run-console.bat) and [`setup-environment.bat`](https://github.com/PX4/windows-toolchain/blob/master/toolchain/scripts/setup-environment.bat).
Причиною запуску всіх інструментів розробки через підготовлений пакетні скрипти є те, що вони налаштовують початкову програму використовувати локальне, портативне середовище Cygwin всередині директорії інструментарію.
This is done by always first calling the script [**setup-environment.bat**](https://github.com/PX4/windows-toolchain/blob/master/toolchain/scripts/setup-environment.bat) and the desired application like the console after that.
The script [setup-environment.bat](https://github.com/PX4/windows-toolchain/blob/master/toolchain/scripts/setup-environment.bat) locally sets environmental variables for the workspace root directory `PX4_DIR`, all binary locations `PATH`, and the home directory of the unix environment `HOME`.
7. Add necessary **python packages** to your setup by opening the Cygwin toolchain console (double clicking **run-console.bat**) and executing
```sh
pip2 install toml
pip2 install pyserial
pip2 install pyulog
```
::: info
That's what [cygwin64/install-cygwin-python-packages.bat](https://github.com/MaEtUgR/PX4Toolchain/blob/master/toolchain/cygwin64/install-cygwin-python-packages.bat) does.
:::
8. Download the [**ARM GCC compiler**](https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads) as zip archive of the binaries for Windows and unpack the content to the folder `C:\PX4\toolchain\gcc-arm`.
::: info
This is what the toolchain does in: [gcc-arm/install-gcc-arm.bat](https://github.com/MaEtUgR/PX4Toolchain/blob/master/toolchain/gcc-arm/install-gcc-arm.bat).
:::
9. Встановіть JDK:
- Download Java 14 from [Oracle](https://www.oracle.com/java/technologies/javase-jdk14-downloads.html) or [AdoptOpenJDK](https://adoptopenjdk.net/).
- Оскільки, на жаль, не існує портативного архіву, який містить безпосередньо бінарні файли вам потрібно встановити Java.
- Find the binaries and move/copy them to **C:\PX4\toolchain\jdk**.
- Ви можете видалити Java із вашої системи Windows, нам були потрібні лише бінарні файли для набору інструментів.
::: info
This is what the toolchain does in: [jdk/install-jdk.bat](https://github.com/MaEtUgR/PX4Toolchain/blob/master/toolchain/jdk/install-jdk.bat).
:::
10. Download [**Apache Ant**](https://ant.apache.org/bindownload.cgi) as zip archive of the binaries for Windows and unpack the content to the folder `C:\PX4\toolchain\apache-ant`.
:::tip
Make sure you don't have an additional folder layer from the folder which is inside the downloaded archive.
:::
::: info
This is what the toolchain does in: [apache-ant/install-apache-ant.bat](https://github.com/MaEtUgR/PX4Toolchain/blob/master/toolchain/apache-ant/install-apache-ant.bat).
:::
11. Download, build and add _genromfs_ to the path:
- Clone the source code to the folder **C:\PX4\toolchain\genromfs\genromfs-src** with
```sh
cd /c/toolchain/genromfs
git clone https://github.com/chexum/genromfs.git genromfs-src
```
- Скомпілюйте це:
```sh
cd genromfs-src
make all
```
- Copy the resulting binary **genromfs.exe** one folder level out to: **C:\PX4\toolchain\genromfs**
12. Make sure all the binary folders of all the installed components are correctly listed in the `PATH` variable configured by [**setup-environment.bat**](https://github.com/PX4/windows-toolchain/blob/master/toolchain/scripts/setup-environment.bat).
+124
View File
@@ -0,0 +1,124 @@
# Інструментарій на віртуальних машинах Windows
:::warning
This development environment is [community supported and maintained](../advanced/community_supported_dev_env.md).
Це може працювати або не працювати з поточними версіями PX4.
Дивіться [Встановлення інструментарію](../dev_setup/dev_env.md) для інформації про середовища та інструменти, що підтримуються основною командою розробників.
:::
Розробники на Windows можуть використовувати інструментарій PX4 у віртуальній машині (VM) з гостьовою операційною системою Linux.
Після створення віртуальної машини, установка та налаштування PX4 у VM така сама, як і на звичайному комп'ютері з Linux.
Хоч використання віртуальної машини - це простий спосіб налаштувати та протестувати середовище для збірки прошивки, користувачі повинні взяти до уваги:
1. Збірка прошивки буде повільніша, ніж нативна збірка на Linux.
2. У симуляції JMAVSim частота кадрів набагато повільніша, ніж на рідному Linux.
В деяких випадках засіб може розбитися через проблеми, пов'язані з недостатніми ресурсами віртуальної машини.
3. Gazebo та ROS встановлюються, але повільні настільки що ними неможливо користуватись.
:::tip
Allocate as many CPU cores and memory resources to the VM as possible.
:::
Існує кілька способів налаштування VM, яка здатна виконувати PX4 середовище на вашій системі.
Цей посібник допоможе вам налаштувати VMWare.
В кінці є неповний розділ для VirtualBox (і ми запрошуємо до розширення цього розділу когось з членів спільноти).
## Налаштування VMWare
Ефективність VMWare прийнятна для основного застосування (збірки прошивки) але не для запуску ROS чи Gazebo Classic.
1. Download [VMWare Player Freeware](https://www.vmware.com/products/workstation-player/workstation-player-evaluation.html)
2. Установіть його на вашу Windows систему
3. Download the desired version of [Ubuntu Desktop ISO Image](https://www.ubuntu.com/download/desktop).
(see [Linux Instructions Page](../dev_setup/dev_env_linux.md) for recommended Ubuntu version).
4. Open _VMWare Player_.
5. Enable 3D acceleration in the VM's settings: **VM > Settings > Hardware > Display > Accelerate 3D graphics**
::: info
This option is required to properly run 3D simulation environments like jMAVSim and Gazebo Classic.
Рекомендуємо зробити це перед встановленням Linux у віртуальному середовищі.
:::
6. Перейдіть до створення нової віртуальної машини.
7. У майстрі створення VM оберіть завантажений ISO образ з Ubuntu як носій установки з якого буде автоматично виявлено операційну систему, яку ви хочете використати.
8. Також у майстрі, оберіть ресурси, які ви хочете виділити віртуальній машині під час роботи.
Виділіть стільки пам'яті та ядер процесора скільки зможете таким чином щоб вашою основною Windows системою можна було продовжити користуватись.
9. Запустіть нову VM в кінці майстра та завершіть встановлення Ubuntu відповідно до інструкцій з установки.
Запам'ятайте, всі налаштування потрібні тільки для використання у вашій основній операційній системі, тому можна вимкнути будь-який режим збереження екрана та функції безпеки локальні робочої станції, що не збільшують ризик мережевої атаки.
10. Once the new VM is booted up make sure you install _VMWare tools drivers and tools extension_ inside your guest system.
Це підвищить продуктивність та зручність користування віртуальною машиною:
- Значно поліпшена продуктивність графіки
- Належна підтримка використання апаратного забезпечення, наприклад розподілу портів USB (важливо для завантаження прошивок), прокручування коліщатком миші, підтримка звуку
- Адаптація роздільної здатності дисплею гостя до розміру вікна емулятора
- Спільний доступ до буфера обміну з основної ОС
- Спільний доступ до файлів з основної ОС
11. Continue with [PX4 environment setup for Linux](../dev_setup/dev_env_linux.md)
## Налаштування VirtualBox 7
Налаштування VirtualBox схоже на VMWare.
Учасники спільноти, запрошуємо до створення покрокових інструкцій для цього розділу!
### Пропускання USB для QGroundControl / запису прошивки
:::tip
This section has been tested for VirtualBox 7 running Ubuntu 20.04 LTS on a Windows 10 host machine.
:::
One limitation of virtual machines is that you can't automatically connect to a flight controller attached to the host computer USB port in order to [build and upload PX4 firmware from a terminal](../dev_setup/building_px4.md#uploading-firmware-flashing-the-board).
Також, не можна приєднатися до польотного контролера з QGroundControl в віртуальній машині.
Щоб дозволити це, необхідно налаштувати параметри пропуску USB:
1. Переконайтеся, що користувач був доданий в групу dialout в VM використовуючи команду терміналу:
```sh
sudo usermod -a -G dialout $USER
```
Потім перезавантажте Ubuntu у віртуальній машині.
2. Enable serial port(s) in VM: **VirtualBox > Settings > Serial Ports 1/2/3/etc...**
3. Enable USB controller in VM: **VirtualBox > Settings > USB**
4. Add USB filters for the bootloader in VM: **VirtualBox > Settings > USB > Add new USB filter**.
- Відкрийте меню і під'єднайте USB-кабель, підключений до автопілота.
Select the `...Bootloader` device when it appears in the UI.
::: info
The bootloader device only appears for a few seconds after connecting USB.
Якщо він зникає до того як ви змогли обрати його, від'єднайте та повторно під'єднайте USB.
:::
- Select the `...Autopilot` device when it appears (this happens after the bootloader completes).
5. Select the device in the VM instance's dropdown menu **VirtualBox > Devices > your_device**
If successful, your device will show up with `lsusb` and QGroundControl will connect to the device automatically.
Ви також матимете можливість збирати та завантажувати прошивку за допомогою команди:
```sh
make px4_fmu-v5_default upload
```
### Телеметрія через WiFi для QGroundControl
If using _QGroundControl_ within a virtual machine you should set the VM networking settings to "Bridged Adapter" mode.
Це дає гостьовій ОС прямий доступ до мережевого обладнання на основній машині.
Якщо ви використовуєте режим трансляції мережевих адрес (NAT), який встановлюється за замовчуванням для VirtualBox 7 для Ubuntu 20.04 LTS, це заблокує вихідні UDP-пакети, які використовує QGroundControl для зв'язку з рухомим засобом.
+352
View File
@@ -0,0 +1,352 @@
# Середовище розробки Windows (засноване на WSL2)
The following instructions explain how to set up a PX4 development environment on Windows 10 or 11, running on Ubuntu Linux within [WSL2](https://docs.microsoft.com/en-us/windows/wsl/about).
Це середовище може бути використане для збірки PX4 для:
- [Pixhawk and other NuttX-based hardware](../dev_setup/building_px4.md#nuttx-pixhawk-based-boards)
- [Gazebo Simulation](../sim_gazebo_gz/index.md)
- [Gazebo-Classic Simulation](../sim_gazebo_classic/index.md)
:::tip
This setup is supported by the PX4 dev team.
Середовище в теорії має бути здатне збирати будь-яку ціль збірки, яку можна зібрати на Ubuntu.
The list above are those targets that are regularly tested.
:::
## Загальний огляд
The [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/about) ([WSL2](https://docs.microsoft.com/en-us/windows/wsl/compare-versions)) allows users to install and run the [Ubuntu Development Environment](../dev_setup/dev_env_linux_ubuntu.md) on Windows, _almost_ as though we were running it on a Linux computer.
В цьому середовищі розробники можуть:
- Build any simulator or hardware target supported by [Ubuntu Development Environment](../dev_setup/dev_env_linux_ubuntu.md) in the WSL Shell.
(Ubuntu є платформою розробки PX4, яка підтримується та протестована найкраще).
- Debug code in [Visual Studio Code](dev_env_windows_wsl.md#visual-studio-code-integration) running on Windows.
- Monitor a _simulation_ using _QGroundControl for Linux_ running in WSL.
QGC для Linux автоматично під'єднується до симуляції.
_QGroundControl for Windows_ is additionally required if you need to:
- [Update firmware](#flash-a-flight-control-board) on a real vehicle.
- Спостерігати за справжнім засобом.
Note that you can also use it to monitor a simulation, but you must manually [connect to the simulation running in WSL](#qgroundcontrol-on-windows).
:::info
Connecting to a USB device from within WSL is not supported, so you can't update firmware using the [`upload`](../dev_setup/building_px4.md#uploading-firmware-flashing-the-board) option when building on the command line, or from _QGroundControl for Linux_.
:::
:::info
The approach is similar to installing PX4 in your _own_ virtual machine, as described in [Windows VM-Hosted Toolchain](../dev_setup/dev_env_windows_vm.md).
Перевага WSL2 полягає в тому, що її віртуальна машина глибоко інтегрована в Windows, керується системою та оптимізована для ефективності.
:::
## Встановлення
### Встановлення WSL2
Щоб встановити WSL2 з Ubuntu на новій установці Windows 10 або 11:
1. Переконайтеся, що функція віртуалізації увімкнена в BIOS вашого комп'ютера.
Зазвичай її називають "Virtualization Technology", "Intel VT-x" чи "AMD-V" відповідно.
2. Open _cmd.exe_ as administrator.
This can be done by pressing the start key, typing `cmd`, right-clicking on the _Command prompt_ entry and selecting **Run as administrator**.
3. Виконайте наступні команди для встановлення WSL2 та певної версії Ubuntu:
- Версія за замовчуванням (Ubuntu 22.04):
```sh
wsl --install
```
- Ubuntu 20.04 ([Gazebo-Classic Simulation](../sim_gazebo_classic/index.md))
```sh
wsl --install -d Ubuntu-20.04
```
- Ubuntu 22.04 ([Gazebo Simulation](../sim_gazebo_gz/index.md))
```sh
wsl --install -d Ubuntu-22.04
```
::: info
You can also install[Ubuntu 20.04](https://www.microsoft.com/store/productId/9MTTCL66CPXJ) and [Ubuntu 22.04](https://www.microsoft.com/store/productId/9PN20MSR04DW) from the store, which allows you to delete the application using the normal Windows Add/Remove settings:
:::
4. WSL запитає про ім'я користувача та пароль для встановлення Ubuntu.
Запишіть ці облікові дані, оскільки вони знадобляться пізніше!
Тепер командний рядок є терміналом в нововстановленому середовищі Ubuntu.
### Відкриття оболонки WSL
Всі операції для встановлення та збірки PX4 повинні бути виконані в оболонці WSL (можна використати ту саму оболонку в якій встановлювалася WSL2 або відкрити нову).
If you're using [Windows Terminal](https://learn.microsoft.com/en-us/windows/terminal/install) you can open a shell into an installed WSL environment as shown, and exit it by closing the tab.
![Windows Terminal showing how to select a Ubuntu shell](../../assets/toolchain/wsl_windows_terminal.png)
Щоб відкрити оболонку WSL за допомогою командного рядка:
1. Відкрийте командний рядок:
- Press the Windows **Start** key.
- Type `cmd` and press **Enter** to open the prompt.
2. Щоб запустити WSL і отримати доступ до WSL оболонки, виконайте команду:
```sh
wsl -d <distribution_name>
```
Наприклад:
```sh
wsl -d Ubuntu
```
```sh
wsl -d Ubuntu-20.04
```
If you only have one version of Ubuntu, you can just use `wsl`.
Введіть наступні команди, щоб спочатку закрити WSL оболонку, а потім завершити WSL:
```sh
exit
wsl -d <distribution_name> --shutdown
```
Alternatively, after entering `exit` you can just close the prompt.
### Встановлення інструментарію PX4
Next we download the PX4 source code within the WSL2 environment, and use the normal _Ubuntu installer script_ to set up the developer environment.
This will install the toolchain for Gazebo Classic simulation and Pixhawk/NuttX hardware.
Щоб встановити інструментарій розробки:
1. [Open a WSL2 Shell](#opening-a-wsl-shell) (if it is still open you can use the same one that was used to install WSL2).
2. Execute the command `cd ~` to switch to the home folder of WSL for the next steps.
:::warning
This is important!
Якщо ви працюєте за межами файлової системи WSL, то ви стикнетесь з такими проблемами, як дуже повільне виконання та помилки прав доступу/дозволів.
:::
3. Download the PX4 source code using `git` (which is already installed in WSL2):
```sh
git clone https://github.com/PX4/PX4-Autopilot.git --recursive
```
::: info
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](../contribute/git_examples.md#get-a-specific-release).
:::
4. Run the **ubuntu.sh** installer script and acknowledge any prompts as the script progresses:
```sh
bash ./PX4-Autopilot/Tools/setup/ubuntu.sh
```
::: info
This installs tools to build PX4 for Pixhawk and either Gazebo or Gazebo Classic targets:
- You can use the `--no-nuttx` and `--no-sim-tools` options to omit the NuttX and/or simulation tools.
- Other Linux build targets are untested (you can try these by entering the appropriate commands in [Ubuntu Development Environment](../dev_setup/dev_env_linux_ubuntu.md) into the WSL shell).
:::
5. Перезапустіть "комп'ютер WSL" після завершення скрипту (вийти з оболонки, вимкнути WSL та перезапустити WSL):
```sh
exit
wsl --shutdown
wsl
```
6. Перейдіть в репозиторій PX4 в домашній директорії WSL:
```sh
cd ~/PX4-Autopilot
```
7. Зберіть ціль PX4 SITL та перевірте середовище:
```sh
make px4_sitl
```
For more build options see [Building PX4 Software](../dev_setup/building_px4.md).
## Інтеграція з Visual Studio Code
VS Code на Windows добре інтегрований з WSL.
Для налаштування інтеграції:
1. [Download](https://code.visualstudio.com/) and install Visual Studio Code (VS Code) on Windows,
2. Open _VS Code_.
3. Install the extension called [Remote - WSL](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl) (marketplace)
4. [Open a WSL shell](#opening-a-wsl-shell)
5. У WSL оболонці перейдіть у директорію PX4:
```sh
cd ~/PX4-Autopilot
```
6. В оболонці WSL запустіть VS Code:
```sh
code .
```
Це відкриє IDE повністю інтегроване в WSL оболонку.
Переконайтеся, що ви завжди відкриваєте PX4 репозиторій у режимі Remote WSL.
7. Next time you want to develop WSL2 you can very easily open it again in Remote WSL mode by selecting **Open Recent** (as shown below).
Це запустить WSL.
![](../../assets/toolchain/vscode/vscode_wsl.png)
Зверніть увагу, що IP-адреса віртуальної машини WSL буде змінена, так що ви не зможете контролювати симуляцію з QGC для Windows (ви все ще можете використовувати QGC для Linux)
## QGroundControl
Для підключення до запущеної симуляції, ви можете запустити QGroundControl або в WSL або у Windows.
If you need to [flash a flight control board](#flash-a-flight-control-board) with new firmware you can only do this from the QGroundControl for Windows.
### QGroundControl у WSL
Найпростіший спосіб налаштувати та використовувати QGroundControl - це завантажити версію для Linux у WSL.
Це можна зробити з оболонки WSL.
1. In a web browser, navigate to the QGC [Ubuntu download section](https://docs.qgroundcontrol.com/master/en/qgc-user-guide/getting_started/download_and_install.html#ubuntu)
2. Right-click on the **QGroundControl.AppImage** link, and select "Copy link address".
This will be something like _https://d176td9ibe4jno.cloudfront.net/builds/master/QGroundControl.AppImage_
3. [Open a WSL shell](#opening-a-wsl-shell) and enter the following commands to download the appimage and make it executable (replace the AppImage URL where indicated):
```sh
cd ~
wget <the_copied_AppImage_URL>
chmod +x QGroundControl.AppImage
```
4. Запустіть QGroundControl:
```sh
./QGroundControl.AppImage
```
QGroundControl запуститься та автоматично приєднається до запущеної симуляції, що дозволить вам спостерігати та контролювати ваші рухомі засоби.
Ви не зможете використовувати його для встановлення прошивки PX4, оскільки WSL не надає доступу до послідовних пристроїв.
### QGroundControl on Windows
Install [QGroundControl on Windows](https://docs.qgroundcontrol.com/master/en/qgc-user-guide/getting_started/download_and_install.html#windows) if you want to be able to update hardware with firmware created within PX4.
Ці кроки описують, як ви можете під'єднатися до симуляції, яке працює в WSL:
1. [Open a WSL shell](#opening-a-wsl-shell)
2. Check the IP address of the WSL virtual machine by running the command `ip addr | grep eth0`:
```sh
$ ip addr | grep eth0
6: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
inet 172.18.46.131/20 brd 172.18.47.255 scope global eth0
```
Copy the first part of the `eth0` interface `inet` address to the clipboard.
In this case: `172.18.46.131`.
3. In QGC go to **Q > Application Settings > Comm Links**
4. Add a UDP Link called "WSL" to port `18570` of the IP address copied above.
5. Збережіть і під'єднайтеся до нього.
:::info
You will have to update the WSL comm link in QGC every time WSL restarts (because it gets a dynamic IP address).
:::
## Прошивка плати керування польотом
Flashing a custom built PX4 binary has to be done using [QGroundControl for Windows](#qgroundcontrol-on-windows).
:::info
WSL2 does not natively offer direct access to serial/USB devices like Pixhawk flight controllers connected to your computer.
That means you can't connect QGC running inside WSL2 to a flight controller to install firmware, or use the `upload` command to [upload firmware as it is built](../dev_setup/building_px4.md#uploading-firmware-flashing-the-board).
Instead you connect [QGroundControl for Windows](#qgroundcontrol-on-windows) to PX4 running in WSL2 and to the Flight controller in order to upload the firmware.
:::
Зробіть наступні кроки для прошивки вашого бінарного файлу, зібраного у WSL:
1. If you haven't already built the binary in WSL e.g. with a [WSL shell](dev_env_windows_wsl.md#opening-a-wsl-shell) and by running:
```sh
cd ~/PX4-Autopilot
make px4_fmu-v5
```
::: tip
Use the correct `make` target for your board.
`px4_fmu-v5` can be used for a Pixhawk 4 board.
:::
2. Detach the USB cable of your Pixhawk board from the computer if it was connected.
3. Open QGC and navigate to **Q > Vehicle Setup > Firmware**.
4. Plug your Pixhawk board via USB
5. Once connected select "PX4 Flight Stack", check **Advanced settings** and choose _Custom firmware file ..._ from the drop down below.
6. Continue and select the firmware binary you just built in WSL.
У відкритому діалозі знайдіть розташування "Linux" з іконкою пінгвіна на лівій панелі.
Зазвичай, вона в самому низу.
Choose the file in the path: `Ubuntu\home\{your WSL user name}\PX4-Autopilot\build\{your build target}\{your build target}.px4`
::: info
You can add the folder to the favourites to access it quickly next time.
:::
7. Почніть прошивку.
For more information see [Installing PX4 Main, Beta or Custom Firmware (Loading Firmware)](../config/firmware.md#installing-px4-main-beta-or-custom-firmware).
## Усунення проблем
If you have any problems with your setup, check the current [Microsoft WSL installation documentation](https://learn.microsoft.com/en-us/windows/wsl/install).
We also recommend that you have the latest Windows GPU drivers installed and also install a recent version of [kisak mesa](https://launchpad.net/~kisak/+archive/ubuntu/kisak-mesa) in your Ubuntu environment so that most OpenGL features get emulated:
```sh
sudo add-apt-repository ppa:kisak/kisak-mesa
sudo apt update
sudo apt upgrade
```
+9
View File
@@ -0,0 +1,9 @@
# Початок роботи
Цей розділ містить теми про те, як почати PX4 розробку:
- [Initial Setup](../dev_setup/config_initial.md)
- [Toolchain Installation](../dev_setup/dev_env.md)
- [Building the Code](../dev_setup/building_px4.md)
- [Writing an Application](../modules/hello_sky.md)
- [Application/Module Template](../modules/module_template.md)
+9
View File
@@ -0,0 +1,9 @@
# QGroundControl Daily Build
The QGroundControl _Daily Build_ includes development tools that are hidden in release builds, and provides access to new PX4 features that are not yet supported in release builds.
![QGroundControl](../../assets/toolchain/qgc_goto.jpg)
It should be used instead of the stable release when working with new code forked from the PX4 `main` branch.
- [Download daily builds](https://docs.qgroundcontrol.com/master/en/qgc-user-guide/releases/daily_builds.html)
+59
View File
@@ -0,0 +1,59 @@
# Qt Creator IDE
:::warning
This development environment is [community supported and maintained](../advanced/community_supported_dev_env.md).
Це може працювати або не працювати з поточними версіями PX4.
Qt Creator has been replaced by [VSCode](../dev_setup/vscode.md) as the officially supported (and recommended) IDE for PX4 development.
Дивіться [Встановлення інструментарію](../dev_setup/dev_env.md) для інформації про середовища та інструменти, що підтримуються основною командою розробників.
:::
[Qt Creator](https://www.qt.io/download-open-source) is a popular cross-platform open-source IDE that can be used to compile and debug PX4.
## Функціональні можливості Qt Creator
Qt creator пропонує роботу із символами мови Сі за допомогою миші, автодоповнення для всієї бази коду, збірки та запису прошивки.
![Screenshot of Qt Creator](../../assets/toolchain/qtcreator.png)
Наведене нижче відео показує, як воно використовується.
<lite-youtube videoid="Bkk8zttWxEI" title="(Qt Creator) PX4 Flight Stack Build Experience"/>
## Налаштування IDE
### Qt Creator на Linux
Before starting Qt Creator, the [project file](https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/Generator-Specific-Information#codeblocks-generator) needs to be created:
```sh
cd ~/src/PX4-Autopilot
mkdir ../Firmware-build
cd ../Firmware-build
cmake ../PX4-Autopilot -G "CodeBlocks - Unix Makefiles"
```
Then load the CMakeLists.txt in the root PX4-Autopilot folder via **File > Open File or Project** (Select the CMakeLists.txt file).
After loading, the **play** button can be configured to run the project by selecting 'custom executable' in the run target configuration and entering 'make' as executable and 'upload' as argument.
### Qt Creator на Windows
:::info
Windows has not been tested for PX4 development with Qt Creator.
:::
### Qt Creator на macOS
Before starting Qt Creator, the [project file](https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/Generator-Specific-Information#codeblocks-generator) needs to be created:
```sh
cd ~/src/PX4-Autopilot
mkdir -p build/creator
cd build/creator
cmake ../.. -G "CodeBlocks - Unix Makefiles"
```
Ось і все! Start _Qt Creator_ and then set up the project to build.
<!-- note, video here was removed/made private, and in any case out of date. Just hoping people can work it out -->
+141
View File
@@ -0,0 +1,141 @@
# Visual Studio Code IDE (VSCode)
[Visual Studio Code](https://code.visualstudio.com/) is a powerful cross-platform source code editor/IDE that can be used for PX4 development on Ubuntu, Windows, and macOS.
Є багато причин використання VSCode для розробки PX4:
- Getting setup _really_ only takes a few minutes.
- A rich extension ecosystem that enables a huge range of tools needed for PX4 development: C/C++ (with solid _cmake_ integration), _Python_, _Jinja2_, ROS messages, and even DroneCAN dsdl.
- Чудова інтеграція з Github.
Цей розділ пояснює, як налаштувати IDE і почати розробку.
:::info
There are other powerful IDEs, but they typically take more effort to integrate with PX4.
With _VScode_, configuration is stored in the PX4/PX4-Autopilot tree ([PX4-Autopilot/.vscode](https://github.com/PX4/PX4-Autopilot/tree/main/.vscode)) so the setup process is as simple as adding the project folder.
:::
## Передумови
You must already have installed the command line [PX4 developer environment](../dev_setup/dev_env.md) for your platform and downloaded the _Firmware_ source code repo.
## Installation & Setup
1. [Download and install VSCode](https://code.visualstudio.com/) (you will be offered the correct version for your OS).
2. Відкрийте VSCode і додайте вихідний код PX4:
- Select _Open folder ..._ option on the welcome page (or using the menu: **File > Open Folder**):
![Open Folder](../../assets/toolchain/vscode/welcome_open_folder.jpg)
- З'явиться діалогове вікно вибору файлу.
Select the **PX4-Autopilot** directory and then press **OK**.
The project files and configuration will then load into _VSCode_.
3. Press **Install All** on the _This workspace has extension recommendations_ prompt (this will appear on the bottom right of the IDE).
![Install extensions](../../assets/toolchain/vscode/prompt_install_extensions.jpg)
VSCode will open the _Extensions_ panel on the left hand side so you can watch the progress of installation.
![PX4 loaded into VSCode Explorer](../../assets/toolchain/vscode/installing_extensions.jpg)
4. Багато повідомлень/підказок може з'явитися в правому нижньому куті
:::tip
If the prompts disappear, click the little "alarm" icon on the right of the bottom blue bar.
:::
- If prompted to install a new version of _cmake_:
- Say **No** (the right version is installed with the [PX4 developer environment](../dev_setup/dev_env.md)).
- If prompted to sign into _github.com_ and add your credentials:
- Це ваш розсуд! Це забезпечує глибоку інтеграцію між Github та IDE, що може спростити ваш робочий процес.
- Інші підказки необов'язкові та можуть бути встановлені, якщо вважаються корисними. <!-- perhaps add screenshot of these prompts -->
<a id="building"></a>
## Збірка PX4
Для збірки:
1. Оберіть свою ціль збірки ("cmake build config"):
- The current _cmake build target_ is shown on the blue _config_ bar at the bottom (if this is already your desired target, skip to next step).
![Select Cmake build target](../../assets/toolchain/vscode/cmake_build_config.jpg)
::: info
The cmake target you select affects the targets offered for when [building/debugging](#debugging) (i.e. for hardware debugging you must select a hardware target like `px4_fmu-v6`).
:::
- Натисніть на ціль на панелі config, щоб показати інші параметри та вибрати ту, яка вам потрібна (це замінить обрану ціль).
- _Cmake_ will then configure your project (see notification in bottom right).
![Cmake config project](../../assets/toolchain/vscode/cmake_configuring_project.jpg)
- Зачекайте, поки налаштування завершиться.
When this is done the notification will disappear and you'll be shown the build location:
![Cmake config project](../../assets/toolchain/vscode/cmake_configuring_project_done.jpg).
2. You can then kick off a build from the config bar (select either **Build** or **Debug**).
![Run debug or build](../../assets/toolchain/vscode/run_debug_build.jpg)
After building at least once you can now use [code completion](#code completion) and other _VSCode_ features.
## Відлагодження
<a id="debugging_sitl"></a>
### Налагодження SITL
Для налагодження PX4 в SITL:
1. Select the debug icon on the sidebar (marked in red) to display the debug panel.
![Run debug](../../assets/toolchain/vscode/vscode_debug.jpg)
2. Then choose your debug target (e.g. _Debug SITL (Gazebo Iris)_) from the top bar debug dropdown (purple box).
::: info
The debug targets that are offered (purple box) match your build target (yellow box on the bottom bar).
Наприклад, для налагодження цілей збірки SITL, ваша ціль повинна містити SITL.
:::
3. Почніть налагодження, натиснувши стрілку "play" налагодження (поруч із ціллю налагодження у верхній панелі - позначено рожевою рамкою).
Під час налагодження ви можете встановити точки зупинки, переходити до коду, на відміну від нормального процесу розробки.
### Апаратне налагодження
The instructions in [SWD Debug Port](../debug/swd_debug.md) explain how to connect to the SWD interface on common flight controllers (for example, using the Dronecode or Blackmagic probes).
After connecting to the SWD interface, hardware debugging in VSCode is then the same as for [SITL Debugging](#debugging_sitl) except that you select a debug target appropriate for your debugger type (and firmware) - e.g. `jlink (px4_fmu-v5)`.
:::tip
To see the `jlink` option you must have selected a [cmake target for building firmware](#building-px4).
:::
![Image showing hardware targets with options for the different probes](../../assets/toolchain/vscode/vscode_hardware_debugging_options.png)
<a id="code completion"></a>
## Автодоповнення коду
In order for the code completion to work (and other IntelliSense magic) you need an active configuration and to have [built the code](#building).
Після того, як це зроблено, вам не потрібно нічого робити; інструментарій автоматично запропонує вам символи мови поки ви друкуєте.
![IntelliSense](../../assets/toolchain/vscode/vscode_intellisense.jpg)
## Усунення проблем
Цей розділ включає вказівки для помилок з налаштування та збірки.
### Ubuntu 18.04: "Visual Studio Code не може спостерігати за змінами в коді у великому робочому середовищі"
Ця помилка з'являється при старті.
On some systems, there is an upper-limit of 8192 file handles imposed on applications, which means that VSCode might not be able to detect file modifications in `/PX4-Autopilot`.
Ви можете збільшити цей ліміт, щоб уникнути помилки, коштом споживання пам'яті.
Follow the [instructions here](https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc).
Значення 65536 має бути більш ніж достатнім.