New Crowdin translations - ko (#24827)

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
This commit is contained in:
PX4 Build Bot 2025-05-14 09:22:19 +10:00 committed by GitHub
parent 7ac85d8f99
commit 2b7710122e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 376 additions and 209 deletions

View File

@ -181,6 +181,7 @@
- [Holybro Kakute H7v2](flight_controller/kakuteh7v2.md)
- [Holybro Kakute H7mini](flight_controller/kakuteh7mini.md)
- [Holybro Kakute H7](flight_controller/kakuteh7.md)
- [Holybro Kakute H7 Wing](flight_controller/kakuteh7-wing.md)
- [Holybro Durandal](flight_controller/durandal.md)
- [Wiring Quickstart](assembly/quick_start_durandal.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)
- [단위 테스트](test_and_ci/unit_tests.md)
- [지속 통합](test_and_ci/continous_integration.md)
- [MAVSDK 통합 테스트](test_and_ci/integration_testing_mavsdk.md)
- [ROS 통합 테스트](test_and_ci/integration_testing.md)
- [Integration Testing](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/maintenance.md)

View File

@ -499,8 +499,8 @@ Since the Definitions and Data Sections use the same message header format, they
- [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. 버전 2.1.3부터 ULog를 지원합니다.
- [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
(Typescript ULog parser: https://github.com/foxglove/ulog).
- [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 reader that outputs JS objects.
## 파일 형식 버전 이력

View File

@ -0,0 +1,84 @@
# Holybro Kakute H7 V2
:::warning
PX4 does not manufacture this (or any) autopilot.
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).
:::
## 구매처
The board can be bought from one of the following shops (for example):
- [Holybro](https://holybro.com/products/kakute-h743-wing)
## 커넥터 및 핀
| 핀 | 기능 | 기본값 |
| ---------------- | --------------------------------- | ------------------------------------------------------------- |
| 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 | Console |
| Buz-, Buz+ | Piezo buzzer | |
| M1 to M14 | Motor signal outputs | |
<a id="bootloader"></a>
## 부트로더 업데이트
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
```
## 펌웨어 설치
:::info
KakuteH7-wing is supported with PX4 master & PX4 v1.16 or newer..
Prior to that release you will need to manually build and install the firmware.
:::
Firmware can be manually installed in any of the normal ways:
- Build and upload the source:
```
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 | Console |
## 디버그 포트
### 시스템 콘솔
UART8 RX and TX are configured for use as the [System Console](../debug/system_console.md).

View File

@ -153,31 +153,39 @@ Most streaming classes are very similar (see examples in [/src/modules/mavlink/s
We iterate the array and use `update()` on each subscription to check if the associated battery instance has changed (and update a structure with the current data).
This allows us to send the MAVLink message _only_ if the associated battery uORB topic has changed:
// Struct to hold current topic data.
battery_status_s battery_status;
// update() populates battery_status and returns true if the status has changed
if (battery_sub.update(&battery_status)) {
// Use battery_status to populate message and send
}
```cpp
// Struct to hold current topic data.
battery_status_s battery_status;
// update() populates battery_status and returns true if the status has changed
if (battery_sub.update(&battery_status)) {
// Use battery_status to populate message and send
}
```
If wanted to send a MAVLink message whether or not the data changed, we could instead use `copy()` as shown:
battery_status_s battery_status;
battery_sub.copy(&battery_status);
```cpp
battery_status_s battery_status;
battery_sub.copy(&battery_status);
```
::: info
For a single-instance topic like [VehicleStatus](../msg_docs/VehicleStatus.md) we would subscribe like this:
// Create subscription _vehicle_status_sub
uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)};
```cpp
// Create subscription _vehicle_status_sub
uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)};
```
And we could use the resulting subscription in the same way with update or copy.
vehicle_status_s vehicle_status{}; // vehicle_status_s is the definition of the uORB topic
if (_vehicle_status_sub.update(&vehicle_status)) {
// Use the vehicle_status as it has been updated.
}
```cpp
vehicle_status_s vehicle_status{}; // vehicle_status_s is the definition of the uORB topic
if (_vehicle_status_sub.update(&vehicle_status)) {
// Use the vehicle_status as it has been updated.
}
```
:::

View File

@ -2,6 +2,17 @@
<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)).
:::warning

View File

@ -55,20 +55,4 @@ To get started using the library within an existing ROS 2 workspace:
When opening a pull request to PX4, CI runs the library integration tests.
These test that mode registration, failsafes, and mode replacement, work as expected.
The tests can also be run locally from PX4:
```sh
./test/ros_test_runner.py
```
And to run only a single case:
```sh
./test/ros_test_runner.py --verbose --case <case>
```
You can list the available test cases with:
```sh
./test/ros_test_runner.py --list-cases
```
For more information see [PX4 ROS2 Interface Library Integration Testing](../test_and_ci/integration_testing_px4_ros2_interface.md).

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
```
### Set Custom Takeoff Location
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
```
### Specify World
The simulation can be run inside a particular world by concatenating the desired world to the name of the desired vehicle.

View File

@ -35,23 +35,31 @@ This allows for greater flexibility and customization.
[Multiple vehicles with ROS 2](../ros2/multi_vehicle.md) are possible.
- 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).
- In different terminals manually start a multi vehicle simulation.
This example spawns 2 X500 Quadrotors and aFPX fixed-wing:
This example spawns 2 X500 Quadrotors and aFPX fixed-wing.
```sh
PX4_SYS_AUTOSTART=4001 PX4_SIM_MODEL=gz_x500 ./build/px4_sitl_default/bin/px4 -i 1
```
:::info
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
PX4_SYS_AUTOSTART=4001 PX4_GZ_MODEL_POSE="0,1" PX4_SIM_MODEL=gz_x500 ./build/px4_sitl_default/bin/px4 -i 2
```
```sh
PX4_SYS_AUTOSTART=4001 PX4_SIM_MODEL=gz_x500 ./build/px4_sitl_default/bin/px4 -i 1
```
```sh
PX4_SYS_AUTOSTART=4003 PX4_GZ_MODEL_POSE="0,2" PX4_SIM_MODEL=gz_rc_cessna ./build/px4_sitl_default/bin/px4 -i 3
```
**Terminal 2**
```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
```
- Start the agent:

View File

@ -157,9 +157,8 @@ make px4_sitl none_iris
시뮬레이션은 환경 변수를 통하여 추가로 설정이 가능합니다.
- `PX4_ESTIMATOR`: This variable configures which estimator to use.
Possible options are: `ekf2` (default), `lpe` (deprecated).
It can be set via `export PX4_ESTIMATOR=lpe` before running the simulation.
- Any of the [PX4 parameters](../advanced_config/parameter_reference.md) can be overridden via `export PX4_PARAM_{name}={value}`.
For example changing the estimator: `export PX4_PARAM_EKF2_EN=0; export PX4_PARAM_ATT_EN=1`.
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).

View File

@ -21,7 +21,7 @@ Operating in the 2.4GHz frequency band, it allows unrestricted global use withou
- **Frequency Band:** 2.4GHz
- **Speed:** Up to 11 Mbps (adjustable)
- **Range:** Up to 500 meters (varies upon environments)
- **Payload Capacity:** Up to 1400 bytes
- **Payload Capacity:** Up to 1024 bytes
### 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)
- **Browser:** Go to `192.168.4.1` to open the **configuration page**.
- **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)

View File

@ -8,7 +8,9 @@ Test topics include:
- [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)
- [Continuous Integration (CI)](../test_and_ci/continous_integration.md)
- [ROS Integration Testing](../test_and_ci/integration_testing.md)
- [MAVSDK Integration Testing](../test_and_ci/integration_testing_mavsdk.md)
- [Integration Testing](../test_and_ci/integration_testing.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)
- [Maintenance](../test_and_ci/maintenance.md)

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) is preferred when writing new tests.
Use the ROS-based integration test framework for use cases that _require_ ROS (e.g. object avoidance).
- [MAVSDK Integration Testing](../test_and_ci/integration_testing_mavsdk.md) - MAVSDK-based test framework for PX4.
_This is the recommended framework for writing new Integration tests_
- [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:
## 전제 조건
- [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
```
테스트를 GUI로 실행하여 진행 상황을 쉽게 확인할 수도 있습니다(기본적으로 테스트는 "헤드리스"로 실행됨).
```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)
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).
새 테스트를 작성하려면:
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. 새 테스트만 실행합니다.
- 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. 시작 파일에 새 테스트 노드 추가
- 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
```
위에서 설명한 대로 테스트를 실행합니다.
- [ROS 1 Integration Testing](../test_and_ci/integration_testing_ros1_mavros.md) (Deprecated)

View File

@ -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
```
그러면, 모든 테스트가 나열되고 순차적으로 실행됩니다.
This will list all the tests and then run them sequentially.
To see all possible command line arguments use the `-h` argument:
```sh
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]
[--case CASE] [--debugger DEBUGGER] [--verbose]
config_file
usage: mavsdk_test_runner.py [-h] [--log-dir LOG_DIR] [--speed-factor SPEED_FACTOR] [--iterations ITERATIONS] [--abort-early]
[--gui] [--model MODEL] [--case CASE] [--debugger DEBUGGER] [--upload] [--force-color]
[--verbose] [--build-dir BUILD_DIR]
positional arguments:
config_file JSON config file to use
optional arguments:
options:
-h, --help show this help message and exit
--log-dir LOG_DIR Directory for log files
--speed-factor SPEED_FACTOR
@ -71,9 +75,13 @@ optional arguments:
--abort-early abort on first unsuccessful test
--gui display the visualization for a simulation
--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
--upload Upload logs to logs.px4.io
--force-color Force colorized output
--verbose enable more verbose output
--build-dir BUILD_DIR
relative path where the built files are stored
```
## 단일 테스트 실행

View File

@ -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).
These test that mode registration, failsafes, and mode replacement, work as expected.
## CI Testing
When opening a pull request to PX4, CI runs the library integration tests.
## Running Tests Locally
The tests can also be run locally from PX4:
```sh
./test/ros_test_runner.py
```
And to run only a single case:
```sh
./test/ros_test_runner.py --verbose --case <case>
```
You can list the available test cases with:
```sh
./test/ros_test_runner.py --list-cases
```

View File

@ -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.