mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-27 18:27:05 +08:00
New Crowdin translations - zh-CN (#24829)
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
This commit is contained in:
+5
-2
@@ -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)
|
||||||
- [Docker 容器](test_and_ci/docker.md)
|
- [Docker 容器](test_and_ci/docker.md)
|
||||||
- [维护](test_and_ci/maintenance.md)
|
- [维护](test_and_ci/maintenance.md)
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
- [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。
|
- [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.
|
- [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 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)
|
||||||
|
|
||||||
|
## Connectors and Pins
|
||||||
|
|
||||||
|
| 针脚 | 功能 | 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 | Console |
|
||||||
|
| Buz-, Buz+ | Piezo buzzer | |
|
||||||
|
| M1 to M14 | Motor signal outputs | |
|
||||||
|
|
||||||
|
<a id="bootloader"></a>
|
||||||
|
|
||||||
|
## PX4 Bootloader Update
|
||||||
|
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
## Installing PX4 Firmware
|
||||||
|
|
||||||
|
:::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_.
|
||||||
|
You can use either pre-built firmware or your own custom firmware.
|
||||||
|
|
||||||
|
## 串口映射
|
||||||
|
|
||||||
|
| UART | 设备 | Port | 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) | 遥控输入 |
|
||||||
|
| 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).
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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.
|
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.
|
These test that mode registration, failsafes, and mode replacement, work as expected.
|
||||||
|
|
||||||
The tests can also be run locally from 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
|
|
||||||
```
|
|
||||||
|
|
||||||
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
|
|
||||||
```
|
|
||||||
@@ -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
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 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
|
### Specify World
|
||||||
|
|
||||||
The simulation can be run inside a particular world by concatenating the desired world to the name of the desired vehicle.
|
The simulation can be run inside a particular world by concatenating the desired world to the name of the desired vehicle.
|
||||||
|
|||||||
@@ -35,23 +35,31 @@ This allows for greater flexibility and customization.
|
|||||||
[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).
|
||||||
|
|
||||||
- In different terminals manually start a multi vehicle simulation.
|
- 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
|
:::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
|
||||||
|
```
|
||||||
|
|
||||||
- Start the agent:
|
- Start the agent:
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ These ports are:
|
|||||||
- PX4's remote UDP Port **14550** is used for communication with ground control stations.
|
- PX4's remote UDP Port **14550** is used for communication with ground control stations.
|
||||||
期望 GCS 侦听此端口上的连接。
|
期望 GCS 侦听此端口上的连接。
|
||||||
_QGroundControl_ 默认侦听此端口。
|
_QGroundControl_ 默认侦听此端口。
|
||||||
- PX4's remote UDP Port **14540** is used for communication with offboard APIs.
|
- PX4的远程UDP端口 **14540** 用于与 offboard API 通信。
|
||||||
期望 Offboard APIs 侦听此端口上的连接。
|
期望 Offboard APIs 侦听此端口上的连接。
|
||||||
::: info
|
::: info
|
||||||
Multi-vehicle simulations use a separate remote port for each instance, allocated sequentially from `14540` to `14549`
|
Multi-vehicle simulations use a separate remote port for each instance, allocated sequentially from `14540` to `14549`
|
||||||
@@ -157,9 +157,8 @@ make px4_sitl none_iris
|
|||||||
|
|
||||||
The simulation can be further configured via environment variables:
|
The simulation can be further configured via environment variables:
|
||||||
|
|
||||||
- `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).
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -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))
|
- [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)
|
||||||
|
|||||||
@@ -1,160 +1,13 @@
|
|||||||
# 集成测试
|
# Integration Testing
|
||||||
|
|
||||||
This topic explains how to run (and extend) PX4's ROS-based integration tests.
|
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 / MAVROS 测试
|
- [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)
|
|
||||||
|
|
||||||
## 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
|
|
||||||
```
|
|
||||||
|
|
||||||
如上所述运行完整的测试套件。
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# 开始仿真
|
|
||||||
cd <Firmware_clone>
|
|
||||||
source integrationtests/setup_gazebo_ros.bash $(pwd)
|
|
||||||
roslaunch px4 mavros_posix_sitl.launch
|
|
||||||
|
|
||||||
# 运行测试(在新的 shell 中):
|
|
||||||
cd <Firmware_clone>
|
|
||||||
source integrationtests/setup_gazebo_ros.bash $(pwd)
|
|
||||||
rosrun px4 mavros_new_test.py
|
|
||||||
```
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ PX4 can be tested end to end to using integration tests based on [MAVSDK](https:
|
|||||||
|
|
||||||
测试需要将MAVSAK C++库安装到系统目录(如: <code>/usr/lib</code> or <code>/usr/local/lib</code>)
|
测试需要将MAVSAK C++库安装到系统目录(如: <code>/usr/lib</code> or <code>/usr/local/lib</code>)
|
||||||
|
|
||||||
|
:::note
|
||||||
|
This is the recommended integration test framework for PX4.
|
||||||
|
:::
|
||||||
|
|
||||||
## 系统必备组件
|
## 系统必备组件
|
||||||
|
|
||||||
### 运行所有PX4测试
|
### 运行所有PX4测试
|
||||||
@@ -47,33 +51,37 @@ 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 of the tests and then run them sequentially.
|
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
|
||||||
|
|
||||||
用法:mavsdk_test_runner。 y [-h] [--log-dir LOG_DIR] [--speed-factor SPEED_FACTOR] [--trerations ITERATION] [--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 DEBUGER] [--verbose]
|
[--gui] [--model MODEL] [--case CASE] [--debugger DEBUGGER] [--upload] [--force-color]
|
||||||
config_file
|
[--verbose] [--build-dir BUILD_DIR]
|
||||||
|
|
||||||
posital 参数:
|
positional arguments:
|
||||||
config_file JSON 使用的JSON配置文件
|
config_file JSON config file to use
|
||||||
|
|
||||||
optional 参数:
|
options:
|
||||||
-h, --help 显示此帮助信息并退出
|
-h, --help show this help message and exit
|
||||||
--log-dir LOG_DIR 日志文件目录
|
--log-dir LOG_DIR Directory for log files
|
||||||
--speed-factor SPEED_FACTOR
|
--speed-factor SPEED_FACTOR
|
||||||
模拟运行的速度因子
|
how fast to run the simulation
|
||||||
--迭代ITERATION
|
--iterations ITERATIONS
|
||||||
在首次失败的测试中运行所有测试的频率
|
how often to run all tests
|
||||||
--abort-early 中止
|
--abort-early abort on first unsuccessful test
|
||||||
--guide 显示模拟的可视化化
|
--gui display the visualization for a simulation
|
||||||
MODEL 只为一个模型运行测试
|
--model MODEL only run tests for one model
|
||||||
--case CASE 只运行测试一个案例
|
--case CASE only run tests for one case (or multiple cases with wildcard '*')
|
||||||
--debugger DEBUGER 调试器:callgrind, gdb, lldb
|
--debugger DEBUGGER choice from valgrind, callgrind, gdb, lldb
|
||||||
--verbose 启用更详细的输出
|
--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
|
||||||
```
|
```
|
||||||
|
|
||||||
## 关于实现的说明
|
## 关于实现的说明
|
||||||
|
|||||||
@@ -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
|
||||||
|
```
|
||||||
@@ -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.
|
||||||
Reference in New Issue
Block a user