New Crowdin translations - uk (#24828)

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
This commit is contained in:
PX4 Build Bot
2025-05-11 12:24:56 +10:00
committed by GitHub
parent a8618691f0
commit d04d6af696
14 changed files with 353 additions and 194 deletions
+5 -2
View File
@@ -181,6 +181,7 @@
- [Holybro Kakute H7v2](flight_controller/kakuteh7v2.md) - [Holybro Kakute H7v2](flight_controller/kakuteh7v2.md)
- [Holybro Kakute H7mini](flight_controller/kakuteh7mini.md) - [Holybro Kakute H7mini](flight_controller/kakuteh7mini.md)
- [Holybro Kakute H7](flight_controller/kakuteh7.md) - [Holybro Kakute H7](flight_controller/kakuteh7.md)
- [Holybro Kakute H7 Wing](flight_controller/kakuteh7-wing.md)
- [Holybro Durandal](flight_controller/durandal.md) - [Holybro Durandal](flight_controller/durandal.md)
- [Wiring Quickstart](assembly/quick_start_durandal.md) - [Wiring Quickstart](assembly/quick_start_durandal.md)
- [Holybro Pix32 v5](flight_controller/holybro_pix32_v5.md) - [Holybro Pix32 v5](flight_controller/holybro_pix32_v5.md)
@@ -808,8 +809,10 @@
- [Тест MC_05 - Політ у приміщенні (ручні режими)](test_cards/mc_05_indoor_flight_manual_modes.md) - [Тест MC_05 - Політ у приміщенні (ручні режими)](test_cards/mc_05_indoor_flight_manual_modes.md)
- [Модульні Тести](test_and_ci/unit_tests.md) - [Модульні Тести](test_and_ci/unit_tests.md)
- [Безперервна інтеграція](test_and_ci/continous_integration.md) - [Безперервна інтеграція](test_and_ci/continous_integration.md)
- [MAVSDK Тестування інтеграції ](test_and_ci/integration_testing_mavsdk.md) - [Integration Testing](test_and_ci/integration_testing.md)
- [ROS Тестування інтеграції ](test_and_ci/integration_testing.md) - [MAVSDK Тестування інтеграції ](test_and_ci/integration_testing_mavsdk.md)
- [PX4 ROS2 Interface Library Integration Testing](test_and_ci/integration_testing_px4_ros2_interface.md)
- [ROS 1 Integration Testing](test_and_ci/integration_testing_ros1_mavros.md)
- [Докер-контейнер](test_and_ci/docker.md) - [Докер-контейнер](test_and_ci/docker.md)
- [Підтримка](test_and_ci/maintenance.md) - [Підтримка](test_and_ci/maintenance.md)
+2 -2
View File
@@ -499,8 +499,8 @@ struct message_dropout_s {
- [MAVGAnalysis](https://github.com/ecmnet/MAVGCL): Java, ULog streaming via MAVLink and parser for plotting and analysis. - [MAVGAnalysis](https://github.com/ecmnet/MAVGCL): Java, ULog streaming via MAVLink and parser for plotting and analysis.
- [PlotJuggler](https://github.com/facontidavide/PlotJuggler): C++/Qt application to plot logs and time series. Підтримує ULog з версії 2.1.3. - [PlotJuggler](https://github.com/facontidavide/PlotJuggler): C++/Qt application to plot logs and time series. Підтримує ULog з версії 2.1.3.
- [ulogreader](https://github.com/maxsun/ulogreader): Javascript, ULog reader and parser outputs log in JSON object format. - [ulogreader](https://github.com/maxsun/ulogreader): Javascript, ULog reader and parser outputs log in JSON object format.
- [Foxglove Studio](https://github.com/foxglove/studio): an integrated visualization and diagnosis tool for robotics - [Foxglove](https://foxglove.dev): an integrated visualization and diagnosis tool for robotics data that supports ULog files.
(Typescript ULog parser: https://github.com/foxglove/ulog). - [TypeScript ULog parser](https://github.com/foxglove/ulog): TypeScript, ULog reader that outputs JS objects.
## Історія версій формату файлу ## Історія версій формату файлу
@@ -0,0 +1,84 @@
# Holybro Kakute H7 V2
:::warning
PX4 не розробляє цей (або будь-який інший) автопілот.
Contact the [manufacturer](https://holybro.com/) for hardware support or compliance issues.
:::
The [Holybro Kakute H743 Wing](https://holybro.com/products/kakute-h743-wing) is a fully featured flight controller specifically aimed at fixed-wing and VTOL applications. It has the STM32 H743 Processor running at 480 MHz and CAN Bus support, along with dual camera support & switch, ON/OFF Pit Switch, 5V, 6V/8V, 9V/12 BEC, and plug-and-play GPS, CAN, I2C ports.
:::info
This flight controller is [manufacturer supported](../flight_controller/autopilot_manufacturer_supported.md).
:::
## Де купити
Плату можна придбати в одному з наступних магазинів (наприклад):
- [Holybro](https://holybro.com/products/kakute-h743-wing)
## Конектори та контакти
| Pin | Функція | PX4 default |
| ---------------- | --------------------------------- | ------------------------------------------------------------- |
| GPS 1 | USART1 and I2C1 | GPS1 |
| R2, T2 | USART2 RX and TX | GPS2 |
| R3, T3 | USART3 RX and TX | TELEM1 |
| R5, T5 | USART5 RX and TX | TELEM2 |
| R6, T6 | USART6 RX and TX | RC (PPM, SBUS, etc.) input |
| R7, T7, RTS, CTS | UART7 RX and TX with flow control | TELEM3 |
| R8, T8 | UART8 RX and TX | Консоль |
| Buz-, Buz+ | Piezo buzzer | |
| M1 to M14 | Motor signal outputs | |
<a id="bootloader"></a>
## Оновлення завантажувача PX4
The board comes pre-installed with [Betaflight](https://github.com/betaflight/betaflight/wiki).
Before the PX4 firmware can be installed, the _PX4 bootloader_ must be flashed.
Download the [holybro_kakuteh7-wing.hex](https://github.com/PX4/PX4-Autopilot/raw/main/docs/assets/flight_controller/kakuteh7-wing/holybro_kakuteh7-wing_bootloader.hex) bootloader binary and read [this page](../advanced_config/bootloader_update_from_betaflight.md) for flashing instructions.
## Збірка прошивки
To [build PX4](../dev_setup/building_px4.md) for this target:
```
make holybro_kakuteh7-wing_default
```
## Встановлення прошивки PX4
:::info
KakuteH7-wing is supported with PX4 master & PX4 v1.16 or newer..
До випуску вам потрібно буде вручну зібрати та встановити прошивку.
:::
Прошивку можна встановити вручну будь-якими звичайними способами:
- Збудуйте та завантажте джерело:
```
make holybro_kakuteh7-wing_default upload
```
- [Load the firmware](../config/firmware.md) using _QGroundControl_.
Ви можете використовувати або готове вбудоване програмне забезпечення, або власне користувацьке програмне забезпечення.
## Налаштування послідовного порту
| UART | Пристрій | Порт | Default function |
| ------ | ---------- | --------------------------- | ---------------- |
| USART1 | /dev/ttyS0 | GPS 1 | GPS1 |
| USART2 | /dev/ttyS1 | R2, T2 | GPS2 |
| USART3 | /dev/ttyS2 | R3, T3 | TELEM1 |
| UART5 | /dev/ttyS3 | R5, T5 | TELEM2 |
| USART6 | /dev/ttyS4 | R6, (T6) | Вхід RC |
| UART7 | /dev/ttyS5 | R7, T7, RTS, CTS | TELEM3 |
| UART8 | /dev/ttyS6 | R8, T8 | Консоль |
## Відладочний порт
### Системна консоль
UART8 RX and TX are configured for use as the [System Console](../debug/system_console.md).
+11
View File
@@ -2,6 +2,17 @@
<Badge type="danger" text="Alpha" /> <Badge type="danger" text="Alpha" />
<script setup>
import { useData } from 'vitepress'
const { site } = useData();
</script>
<div v-if="site.title !== 'PX4 Guide (main)'">
<div class="custom-block danger">
<p class="custom-block-title">This page is on a release bramch, and hence probably out of date. <a href="https://docs.px4.io/main/en/releases/main.html">See the latest version</a>.</p>
</div>
</div>
This contains changes to PX4 `main` branch since the last major release ([PX v1.15](../releases/1.15.md)). This contains changes to PX4 `main` branch since the last major release ([PX v1.15](../releases/1.15.md)).
:::warning :::warning
+1 -17
View File
@@ -54,20 +54,4 @@
При відкритті запиту на PX4, CI запускає тест з інтеграції до бібліотеки. При відкритті запиту на PX4, CI запускає тест з інтеграції до бібліотеки.
Тести можуть також бути виконані локально з PX4: For more information see [PX4 ROS2 Interface Library Integration Testing](../test_and_ci/integration_testing_px4_ros2_interface.md).
```sh
./test/ros_test_runner.py
```
І щоб керувати лише одним випадком:
```sh
./test/ros_test_runner.py --verbose --case <case>
```
Ви можете скласти список доступних тестових кейсів з:
```sh
./test/ros_test_runner.py --list-cases
```
+15
View File
@@ -131,6 +131,21 @@ The simulation can be run in headless mode by prefixing the command with the `HE
HEADLESS=1 make px4_sitl gz_x500 HEADLESS=1 make px4_sitl gz_x500
``` ```
### Встановлення власного місця зльоту
The takeoff location in Gazebo Classic can be set using environment variables.
The variables to set are: PX4_HOME_LAT, PX4_HOME_LON, and PX4_HOME_ALT.
Наприклад:
```
export PX4_HOME_LAT=51.1788
export PX4_HOME_LON=-1.8263
export PX4_HOME_ALT=101
make px4_sitl gz_x500
```
### Вказання світу ### Вказання світу
Симуляція може бути запущена в певному світі додаванням бажаного світу до імені бажаного рухомого засобу. Симуляція може бути запущена в певному світі додаванням бажаного світу до імені бажаного рухомого засобу.
@@ -35,23 +35,31 @@ ARGS ./build/px4_sitl_default/bin/px4 [-i <instance>]
[Multiple vehicles with ROS 2](../ros2/multi_vehicle.md) are possible. [Multiple vehicles with ROS 2](../ros2/multi_vehicle.md) are possible.
- First follow the installation instructions for [Gazebo](../sim_gazebo_gz/index.md). - First follow the installation instructions for [Gazebo](../sim_gazebo_gz/index.md).
- Then configure your system for [ROS 2 / PX4 operations](../ros2/user_guide.md#installation-setup). - Then configure your system for [ROS 2 / PX4 operations](../ros2/user_guide.md#installation-setup).
- В різних терміналах вручну запустіть симуляцію декількох рухомих засобів. - В різних терміналах вручну запустіть симуляцію декількох рухомих засобів.
Цей приклад відтворює 2 квадрокоптери X500 та літак з фіксованим крилом aFPX: This example spawns 2 X500 Quadrotors and aFPX fixed-wing.
```sh :::info
PX4_SYS_AUTOSTART=4001 PX4_SIM_MODEL=gz_x500 ./build/px4_sitl_default/bin/px4 -i 1 Note that in the first terminal you **do not** specify standalone mode. The first terminal will start the gz-server and the other two
``` instances will connect to it.
**Terminal 1**
:::
```sh ```sh
PX4_SYS_AUTOSTART=4001 PX4_GZ_MODEL_POSE="0,1" PX4_SIM_MODEL=gz_x500 ./build/px4_sitl_default/bin/px4 -i 2 PX4_SYS_AUTOSTART=4001 PX4_SIM_MODEL=gz_x500 ./build/px4_sitl_default/bin/px4 -i 1
``` ```
```sh **Terminal 2**
PX4_SYS_AUTOSTART=4003 PX4_GZ_MODEL_POSE="0,2" PX4_SIM_MODEL=gz_rc_cessna ./build/px4_sitl_default/bin/px4 -i 3
``` ```sh
PX4_GZ_STANDALONE=1 PX4_SYS_AUTOSTART=4001 PX4_GZ_MODEL_POSE="0,1" PX4_SIM_MODEL=gz_x500 ./build/px4_sitl_default/bin/px4 -i 2
```
**Terminal 3**
```sh
PX4_GZ_STANDALONE=1 PX4_SYS_AUTOSTART=4003 PX4_GZ_MODEL_POSE="0,2" PX4_SIM_MODEL=gz_rc_cessna ./build/px4_sitl_default/bin/px4 -i 3
```
- Запустіть агента: - Запустіть агента:
+2 -3
View File
@@ -157,9 +157,8 @@ make px4_sitl none_iris
Симуляцію можна додатково налаштувати за допомогою змінних середовища: Симуляцію можна додатково налаштувати за допомогою змінних середовища:
- `PX4_ESTIMATOR`: This variable configures which estimator to use. - Any of the [PX4 parameters](../advanced_config/parameter_reference.md) can be overridden via `export PX4_PARAM_{name}={value}`.
Possible options are: `ekf2` (default), `lpe` (deprecated). For example changing the estimator: `export PX4_PARAM_EKF2_EN=0; export PX4_PARAM_ATT_EN=1`.
It can be set via `export PX4_ESTIMATOR=lpe` before running the simulation.
The syntax described here is simplified, and there are many other options that you can configure via _make_ - for example, to set that you wish to connect to an IDE or debugger. The syntax described here is simplified, and there are many other options that you can configure via _make_ - for example, to set that you wish to connect to an IDE or debugger.
For more information see: [Building the Code > PX4 Make Build Targets](../dev_setup/building_px4.md#px4-make-build-targets). For more information see: [Building the Code > PX4 Make Build Targets](../dev_setup/building_px4.md#px4-make-build-targets).
+2 -2
View File
@@ -21,7 +21,7 @@ Operating in the 2.4GHz frequency band, it allows unrestricted global use withou
- **Frequency Band:** 2.4GHz - **Frequency Band:** 2.4GHz
- **Speed:** Up to 11 Mbps (adjustable) - **Speed:** Up to 11 Mbps (adjustable)
- **Range:** Up to 500 meters (varies upon environments) - **Range:** Up to 500 meters (varies upon environments)
- **Payload Capacity:** Up to 1400 bytes - **Payload Capacity:** Up to 1024 bytes
### Network Schemes ### Network Schemes
@@ -124,7 +124,7 @@ However if you change the baud rate from 57600 you will need to create and use a
- **Smart device:** Connect to Wi-Fi network named `J.Fi-xxxxxx` (x: alphanumeric characters) - **Smart device:** Connect to Wi-Fi network named `J.Fi-xxxxxx` (x: alphanumeric characters)
- **Browser:** Go to `192.168.4.1` to open the **configuration page**. - **Browser:** Go to `192.168.4.1` to open the **configuration page**.
- **Configuration page:** Adjust settings as needed, then click **Save** - **Configuration page:** Adjust settings as needed, then click **Save**
- _LED 1_ blinks once upon saving - _LED 2_ blinks once upon saving
![J.Fi Wireless Telemetry Broadcast Communication](../../assets/hardware/telemetry/jmarple/jfi_telemetry_config.jpg) ![J.Fi Wireless Telemetry Broadcast Communication](../../assets/hardware/telemetry/jmarple/jfi_telemetry_config.jpg)
+4 -2
View File
@@ -8,7 +8,9 @@ PX4 широко протестовано за допомогою модульн
- [Test Flights](../test_and_ci/test_flights.md) - How to make test flights (e.g. to [test PRs](../contribute/code.md#pull-requests)) - [Test Flights](../test_and_ci/test_flights.md) - How to make test flights (e.g. to [test PRs](../contribute/code.md#pull-requests))
- [Unit Tests](../test_and_ci/unit_tests.md) - [Unit Tests](../test_and_ci/unit_tests.md)
- [Continuous Integration (CI)](../test_and_ci/continous_integration.md) - [Continuous Integration (CI)](../test_and_ci/continous_integration.md)
- [ROS Integration Testing](../test_and_ci/integration_testing.md) - [Integration Testing](../test_and_ci/integration_testing.md)
- [MAVSDK Integration Testing](../test_and_ci/integration_testing_mavsdk.md) - [MAVSDK Integration Testing](../test_and_ci/integration_testing_mavsdk.md)
- [PX4 ROS2 Interface Library Integration Testing](../test_and_ci/integration_testing_px4_ros2_interface.md)
- [ROS 1 Integration Testing](../test_and_ci/integration_testing_ros1_mavros.md) (Deprecated)
- [Docker](../test_and_ci/docker.md) - [Docker](../test_and_ci/docker.md)
- [Maintenance](../test_and_ci/maintenance.md) - [Maintenance](../test_and_ci/maintenance.md)
+9 -148
View File
@@ -1,152 +1,13 @@
# Тестування інтеграції з використанням ROS # Integration Testing
У цій темі пояснюється, як запускати (і розширювати) інтеграційні тести PX4 на основі ROS. Integration tests are used to verify how well larger parts of a system work together.
In PX4 this generally means testing whole features of a vehicle, usually running in simulation.
The tests are run in [Continuous Integration (CI)](../test_and_ci/continous_integration.md) on every pull request.
:::info - [MAVSDK Integration Testing](../test_and_ci/integration_testing_mavsdk.md) - MAVSDK-based test framework for PX4.
[MAVSDK Integration Testing](../test_and_ci/integration_testing_mavsdk.md) is preferred when writing new tests. _This is the recommended framework for writing new Integration tests_
Use the ROS-based integration test framework for use cases that _require_ ROS (e.g. object avoidance). - [PX4 ROS2 Interface Library Integration Testing](../test_and_ci/integration_testing_px4_ros2_interface.md) - Integration Tests for the [PX4 ROS 2 Interface Library](../ros2/px4_ros2_interface_lib.md).
All PX4 integraton tests are executed automatically by our [Continuous Integration](../test_and_ci/continous_integration.md) system. The following framework should only be used for tests that require ROS 1:
:::
## Попередня підготовка: - [ROS 1 Integration Testing](../test_and_ci/integration_testing_ros1_mavros.md) (Deprecated)
- [jMAVSim Simulator](../sim_jmavsim/index.md)
- [Gazebo Classic Simulator](../sim_gazebo_classic/index.md)
- [ROS and MAVROS](../simulation/ros_interface.md)
## Виконати тести
Щоб запустити тести MAVROS:
```sh
source <catkin_ws>/devel/setup.bash
cd <PX4-Autopilot_clone>
make px4_sitl_default sitl_gazebo
make <test_target>
```
`test_target` is a makefile targets from the set: _tests_mission_, _tests_mission_coverage_, _tests_offboard_ and _tests_avoidance_.
Test can also be executed directly by running the test scripts, located under `test/`:
```sh
source <catkin_ws>/devel/setup.bash
cd <PX4-Autopilot_clone>
make px4_sitl_default sitl_gazebo
./test/<test_bash_script> <test_launch_file>
```
Наприклад:
```sh
./test/rostest_px4_run.sh mavros_posix_tests_offboard_posctl.test
```
Тести також можна запускати за допомогою графічного інтерфейсу користувача, щоб побачити, що відбувається (за замовчуванням тести виконуються без голови):
```sh
./test/rostest_px4_run.sh mavros_posix_tests_offboard_posctl.test gui:=true headless:=false
```
The **.test** files launch the corresponding Python tests defined in `integrationtests/python_src/px4_it/mavros/`
## Напишіть новий MAVROS-тест (Python)
Цей розділ пояснює, як написати новий python тест з використанням ROS 1/MAVROS, протестувати його та додати до набору тестів PX4.
We recommend you review the existing tests as examples/inspiration ([integrationtests/python_src/px4_it/mavros/](https://github.com/PX4/PX4-Autopilot/tree/main/integrationtests/python_src/px4_it/mavros)).
The official ROS documentation also contains information on how to use [unittest](http://wiki.ros.org/unittest) (on which this test suite is based).
Щоб написати новий тест:
1. Створити новий тестовий скрипт, копіюючи порожній тестовий каркас нижче:
```python
#!/usr/bin/env python
# [... LICENSE ...]
#
# @author Example Author <author@example.com>
#
PKG = 'px4'
import unittest
import rospy
import rosbag
from sensor_msgs.msg import NavSatFix
class MavrosNewTest(unittest.TestCase):
"""
Test description
"""
def setUp(self):
rospy.init_node('test_node', anonymous=True)
rospy.wait_for_service('mavros/cmd/arming', 30)
rospy.Subscriber("mavros/global_position/global", NavSatFix, self.global_position_callback)
self.rate = rospy.Rate(10) # 10hz
self.has_global_pos = False
def tearDown(self):
pass
#
# General callback functions used in tests
#
def global_position_callback(self, data):
self.has_global_pos = True
def test_method(self):
"""Test method description"""
# FIXME: hack to wait for simulation to be ready
while not self.has_global_pos:
self.rate.sleep()
# TODO: execute test
if __name__ == '__main__':
import rostest
rostest.rosrun(PKG, 'mavros_new_test', MavrosNewTest)
```
2. Запустити лише новий тест
- Запустити симулятор
```sh
cd <PX4-Autopilot_clone>
source Tools/simulation/gazebo/setup_gazebo.bash
roslaunch launch/mavros_posix_sitl.launch
```
- Запустити тест (в новій оболонці):
```sh
cd <PX4-Autopilot_clone>
source Tools/simulation/gazebo/setup_gazebo.bash
rosrun px4 mavros_new_test.py
```
3. Додати новий тестовий вузол до файлу запуску
- In `test/` create a new `<test_name>.test` ROS launch file.
- Call the test file using one of the base scripts _rostest_px4_run.sh_ or _rostest_avoidance_run.sh_
4. (Необов'язково) Створити нову ціль в Makefile
- Відкрийте Makefile
- Search the _Testing_ section
- Додати нову назву цілі та викликати тест
Наприклад:
```sh
tests_<new_test_target_name>: rostest
@"$(SRC_DIR)"/test/rostest_px4_run.sh mavros_posix_tests_<new_test>.test
```
Запустити тести, як описані вище.
@@ -7,6 +7,10 @@ PX4 can be tested end to end to using integration tests based on [MAVSDK](https:
Інструкції нижче пояснюють, як налаштувати та запустити тести локально. Інструкції нижче пояснюють, як налаштувати та запустити тести локально.
:::note
This is the recommended integration test framework for PX4.
:::
## Вимоги ## Вимоги
### Налаштування середовища розробника ### Налаштування середовища розробника
@@ -47,21 +51,21 @@ To run all SITL tests as defined in [sitl.json](https://github.com/PX4/PX4-Autop
test/mavsdk_tests/mavsdk_test_runner.py test/mavsdk_tests/configs/sitl.json --speed-factor 10 test/mavsdk_tests/mavsdk_test_runner.py test/mavsdk_tests/configs/sitl.json --speed-factor 10
``` ```
Буде перелічено всі тести, а потім запущено їх послідовно. This will list all the tests and then run them sequentially.
To see all possible command line arguments use the `-h` argument: To see all possible command line arguments use the `-h` argument:
```sh ```sh
test/mavsdk_tests/mavsdk_test_runner.py -h test/mavsdk_tests/mavsdk_test_runner.py -h
usage: mavsdk_test_runner.py [-h] [--log-dir LOG_DIR] [--speed-factor SPEED_FACTOR] [--iterations ITERATIONS] [--abort-early] [--gui] [--model MODEL] usage: mavsdk_test_runner.py [-h] [--log-dir LOG_DIR] [--speed-factor SPEED_FACTOR] [--iterations ITERATIONS] [--abort-early]
[--case CASE] [--debugger DEBUGGER] [--verbose] [--gui] [--model MODEL] [--case CASE] [--debugger DEBUGGER] [--upload] [--force-color]
config_file [--verbose] [--build-dir BUILD_DIR]
positional arguments: positional arguments:
config_file JSON config file to use config_file JSON config file to use
optional arguments: options:
-h, --help show this help message and exit -h, --help show this help message and exit
--log-dir LOG_DIR Directory for log files --log-dir LOG_DIR Directory for log files
--speed-factor SPEED_FACTOR --speed-factor SPEED_FACTOR
@@ -71,9 +75,13 @@ optional arguments:
--abort-early abort on first unsuccessful test --abort-early abort on first unsuccessful test
--gui display the visualization for a simulation --gui display the visualization for a simulation
--model MODEL only run tests for one model --model MODEL only run tests for one model
--case CASE only run tests for one case --case CASE only run tests for one case (or multiple cases with wildcard '*')
--debugger DEBUGGER choice from valgrind, callgrind, gdb, lldb --debugger DEBUGGER choice from valgrind, callgrind, gdb, lldb
--upload Upload logs to logs.px4.io
--force-color Force colorized output
--verbose enable more verbose output --verbose enable more verbose output
--build-dir BUILD_DIR
relative path where the built files are stored
``` ```
## Запуск одного тесту ## Запуск одного тесту
@@ -0,0 +1,29 @@
# Integration Testing for the PX4 ROS 2 Interface Library
This topic outlines the integration tests for the [PX4 ROS 2 Interface Library](../ros2/px4_ros2_interface_lib.md).
## CI Testing
При відкритті запиту на PX4, CI запускає тест з інтеграції до бібліотеки.
## Running Tests Locally
Тести можуть також бути виконані локально з PX4:
```sh
./test/ros_test_runner.py
```
І щоб керувати лише одним випадком:
```sh
./test/ros_test_runner.py --verbose --case <case>
```
Ви можете скласти список доступних тестових кейсів з:
```sh
./test/ros_test_runner.py --list-cases
```
@@ -0,0 +1,155 @@
# Integration Testing using ROS 1
This topic explains how to run (and extend) PX4's ROS (1) and MAVROS -based integration tests.
:::warning
This test framework is deprecated.
It should be used only for new test cases that _require_ ROS 1.
[MAVSDK Integration Testing](../test_and_ci/integration_testing_mavsdk.md) is preferred when writing new tests.
:::
:::note
All PX4 integration tests are executed automatically by our [Continuous Integration](../test_and_ci/continous_integration.md) system.
:::
## Вимоги
- [Gazebo Classic Simulator](../sim_gazebo_classic/index.md)
- [ROS and MAVROS](../simulation/ros_interface.md)
## Execute Tests
To run the MAVROS tests:
```sh
source <catkin_ws>/devel/setup.bash
cd <PX4-Autopilot_clone>
make px4_sitl_default sitl_gazebo
make <test_target>
```
`test_target` is a makefile targets from the set: _tests_mission_, _tests_mission_coverage_, _tests_offboard_ and _tests_avoidance_.
Test can also be executed directly by running the test scripts, located under `test/`:
```sh
source <catkin_ws>/devel/setup.bash
cd <PX4-Autopilot_clone>
make px4_sitl_default sitl_gazebo
./test/<test_bash_script> <test_launch_file>
```
Наприклад:
```sh
./test/rostest_px4_run.sh mavros_posix_tests_offboard_posctl.test
```
Tests can also be run with a GUI to see what's happening (by default the tests run "headless"):
```sh
./test/rostest_px4_run.sh mavros_posix_tests_offboard_posctl.test gui:=true headless:=false
```
The **.test** files launch the corresponding Python tests defined in `integrationtests/python_src/px4_it/mavros/`
## Write a New MAVROS Test (Python)
This section explains how to write a new python test using ROS 1/MAVROS, test it, and add it to the PX4 test suite.
We recommend you review the existing tests as examples/inspiration ([integrationtests/python_src/px4_it/mavros/](https://github.com/PX4/PX4-Autopilot/tree/main/integrationtests/python_src/px4_it/mavros)).
The official ROS documentation also contains information on how to use [unittest](http://wiki.ros.org/unittest) (on which this test suite is based).
To write a new test:
1. Create a new test script by copying the empty test skeleton below:
```python
#!/usr/bin/env python
# [... LICENSE ...]
#
# @author Example Author <author@example.com>
#
PKG = 'px4'
import unittest
import rospy
import rosbag
from sensor_msgs.msg import NavSatFix
class MavrosNewTest(unittest.TestCase):
"""
Test description
"""
def setUp(self):
rospy.init_node('test_node', anonymous=True)
rospy.wait_for_service('mavros/cmd/arming', 30)
rospy.Subscriber("mavros/global_position/global", NavSatFix, self.global_position_callback)
self.rate = rospy.Rate(10) # 10hz
self.has_global_pos = False
def tearDown(self):
pass
#
# General callback functions used in tests
#
def global_position_callback(self, data):
self.has_global_pos = True
def test_method(self):
"""Test method description"""
# FIXME: hack to wait for simulation to be ready
while not self.has_global_pos:
self.rate.sleep()
# TODO: execute test
if __name__ == '__main__':
import rostest
rostest.rosrun(PKG, 'mavros_new_test', MavrosNewTest)
```
2. Run the new test only
- Start the simulator:
```sh
cd <PX4-Autopilot_clone>
source Tools/simulation/gazebo/setup_gazebo.bash
roslaunch launch/mavros_posix_sitl.launch
```
- Run test (in a new shell):
```sh
cd <PX4-Autopilot_clone>
source Tools/simulation/gazebo/setup_gazebo.bash
rosrun px4 mavros_new_test.py
```
3. Add new test node to a launch file
- In `test/` create a new `<test_name>.test` ROS launch file.
- Call the test file using one of the base scripts _rostest_px4_run.sh_ or _rostest_avoidance_run.sh_
4. (Optional) Create a new target in the Makefile
- Open the Makefile
- Search the _Testing_ section
- Add a new target name and call the test
Наприклад:
```sh
tests_<new_test_target_name>: rostest
@"$(SRC_DIR)"/test/rostest_px4_run.sh mavros_posix_tests_<new_test>.test
```
Run the tests as described above.