New Crowdin translations - zh-CN (#25559)

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
This commit is contained in:
PX4 Build Bot
2025-09-16 08:56:46 +10:00
committed by GitHub
co-authored by Crowdin Bot
parent 5d0bbaabb2
commit 0068fea2f5
35 changed files with 665 additions and 228 deletions
+21 -21
View File
@@ -1,45 +1,45 @@
# ROS 2
[ROS 2](https://docs.ros.org/en/humble/#) is a powerful general purpose robotics library that can be used with the PX4 Autopilot to create powerful drone applications.
ROS 2 是ROS (机器人操作系统)最新版本 , 一个通用的机器人库,可以与 PX4 自驾仪一起创建强大的无人机应用。
:::warning
Tip
The PX4 development team highly recommend that you use/migrate to this version of ROS!
小提示
PX4开发团队强烈建议您使用/迁移到此版本的 ROS!
This is the newest version of [ROS](https://www.ros.org/) (Robot Operating System).
It significantly improves on ROS "1", and in particular allows a much deeper and lower-latency integration with PX4.
这是最新版本的 [ROS](https://www.ros.org/) (机器人操作系统)。
它大大改进了外空军备竞赛“1”,尤其是允许与PX4更深、更低的延迟结合。
:::
ROS得益于一个活跃的生态系统,在这个生态系统里,开发者会解决常见的机器人问题,他们也有权使用为Linux编写的其他软件库。
It can be used, for example, for [computer vision](../computer_vision/index.md) solutions.
例如,它可以用于[计算机视图](../computer_vision/index.md)解决方案。
ROS 2 enables a very deep integration with PX4, to the extent that you can create flight modes in ROS 2 that are indistinguisable from internal PX4 modes, and directly read from and write to internal uORB topics at high rate.
It is recommended (in particular) for control and communication from a companion computer where low latency is important, when leveraging existing libraries from Linux, or when writing new high level flight modes.
ROS 2能够非常深入地与 PX4 集成 只要你可以在交战规则2中创建无法与内部的 PX4 模式区分的飞行模式, 并以高费率直接读取内部uORB主题。
建议(尤其是)从同伴计算机进行控制和通信,因为这种计算机的延迟率很低。 当利用来自Linux的现有库时,或在编写新的高层飞行模式时。
Communication between ROS 2 and PX4 uses middleware that implements the [XRCE-DDS protocol](../middleware/uxrce_dds.md).
This middleware exposes PX4 [uORB messages](../msg_docs/index.md) as ROS 2 messages and types, effectively allowing direct access to PX4 from ROS 2 workflows and nodes.
ROS 2 和 PX4 之间的通信使用中间件实现[XRCE-DDS] (../middleware/uxrce_dds.md)。
这个中间件将以 ROS 2 消息和类型显示 PX4 [uORB 消息](../msg_docs/index.md), 有效地允许从 ROS 2 工作流和节点直接访问 PX4。
中间件使用 uORB 消息定义生成代码来序列化和反序列化来处理PX4 的收发消息。
These same message definitions are used in ROS 2 applications to allow the messages to be interpreted.
在ROS 2 应用中使用相同的消息定义可直接进行解析。
:::info
ROS 2 can also connect with PX4 using [MAVROS](https://github.com/mavlink/mavros/tree/ros2/mavros) instead of XRCE-DDS.
This option is supported by the MAVROS project (it is not documented here).
ROS 2 也可以使用 [MAVROS](https://github.com/mavlink/mavros/tree/ros2/mavros而不是 XRCE-DDS连接到 PX4。
这一备选办法得到了MAVROS项目的支持(此处没有记录)。
:::
To use the [ROS 2](../ros2/user_guide.md) over XRCE-DDS effectively, you must (at time of writing) have a reasonable understanding of the PX4 internal architecture and conventions, which differ from those used by ROS.
在XRCE-DDS上有效使用[ROS2](../ros2/user_guide.md)。 (撰写本文时)你必须对PX4内部结构和公约有合理的理解,这些结构和公约不同于交战规则所用的内部结构和公约。
我们计划近期提供ROS 2 API 以对 PX4 的特性进行封装,并举例说明它们的用途。
## Topics
本节的主要主题是:
- [ROS 2 User Guide](../ros2/user_guide.md): A PX4-centric overview of ROS 2, covering installation, setup, and how to build ROS 2 applications that communicate with PX4.
- [ROS 2 Offboard Control Example](../ros2/offboard_control.md): A C++ tutorial examples showing how to do position control in [offboard mode](../flight_modes/offboard.md) from a ROS 2 node.
- [ROS 2 Multi Vehicle Simulation](../ros2/multi_vehicle.md): Instructions for connecting to multipole PX4 simulations via single ROS 2 agent.
- [PX4 ROS 2 Interface Library](../ros2/px4_ros2_interface_lib.md): A C++ library that simplies interacting with PX4 from ROS 2.
Can be used to create and register flight modes wrtten using ROS2 and send position estimates from ROS2 applications such as a VIO system.
- [ROS 2 Message Translation Node](../ros2/px4_ros2_msg_translation_node.md): A ROS 2 message translation node that enables communcation between PX4 and ROS 2 applications that were compiled with different sets of messages versions.
- ROS 2 用户指南: PX4 视角下的 ROS 2,包括安装、设置和如何构建与 PX4 通信的 ROS 2 应用。
- [ROS 2 离板控制示例](../ros2/offboard_control.md):一个 C++ 教程示例显示如何在 [离板模式] (../flight_modes/offboard.md) 中使用 ROS 2 节点进行位置控制。
- [ROS 2 多车辆模拟](../ros2/multi_vehicle.md):通过单独的ROS2 代理商连接到多极PX4 模拟的说明。
- [PX4 ROS2 接口库](../ros2/px4_ros2_interface_lib.md):一个C++ 库,它与ROS2的 PX4 交互。
可以使用 ROS 2 创建和注册飞行模式,并从 ROS2 应用程序如VIO 系统发送位置估计数。
- [ROS 2 消息翻译节点](../ros2/px4_ros2_msg_translation_node.md):一个 ROS 2 消息翻译节点,它允许在 PX4 和 ROS 2 应用程序之间共享,这些应用程序被编译成不同的消息版本。
## 更多信息
- [XRCE-DDS (PX4-ROS 2/DDS Bridge)](../middleware/uxrce_dds.md): PX4 middleware for connecting to ROS 2.
- [XRCE-DDS (PX4-ROS 2/DDS Bridge)](../middleware/uxrce_dds.md): PX4 使用中间件链接到 ROS 2。
+26 -26
View File
@@ -1,54 +1,54 @@
# Multi-Vehicle Simulation with ROS 2
# 使用 ROS 2 进行多车辆仿真
[XRCE-DDS](../middleware/uxrce_dds.md) allows for multiple clients to be connected to the same agent over UDP.
This is particular useful in simulation as only one agent needs to be started.
[XRCE-DDS](../middleware/uxrce_dds.md) 支持多个客户端通过 UDP 协议连接到同一个代理。
这在模拟中特别有用,因为只有一个代理需要启动。
## Setup and Requirements
## 设置和要求
The only requirements are
唯一的要求是
- To be able to run [multi-vehicle simulation](../simulation/multi-vehicle-simulation.md) without ROS 2 with the desired simulator ([Gazebo](../sim_gazebo_gz/multi_vehicle_simulation.md), [Gazebo Classic](../sim_gazebo_classic/multi_vehicle_simulation.md#multiple-vehicle-with-gazebo-classic), [FlightGear](../sim_flightgear/multi_vehicle.md) and [JMAVSim](../sim_jmavsim/multi_vehicle.md)).
- To be able to use [ROS 2](../ros2/user_guide.md) in a single vehicle simulation.
- 能够在不依赖 ROS 2 的情况下,使用所需的仿真器([Gazebo](../sim_gazebo_gz/multi_vehicle_simulation.md), [Gazebo Classic](../sim_gazebo_classic/multi_vehicle_simulation.md#multiple-vehicle-with-gazebo-classic), [FlightGear](../sim_flightgear/multi_vehicle.md) 和 [JMAVSim](../sim_jmavsim/multi_vehicle.md))运行多车辆仿真[multi-vehicle simulation](../simulation/multi-vehicle-simulation.md)。
- 能够在单车辆仿真中使用ROS 2(机器人操作系统 2)
## Principle of Operation
## 工作原理
In simulation each PX4 instance receives a unique `px4_instance` number starting from `0`.
This value is used to assign a unique value to [UXRCE_DDS_KEY](../advanced_config/parameter_reference.md#UXRCE_DDS_KEY):
在仿真中,每个 PX4 实例都会获得一个唯一的px4_instance编号,编号从0开始。
该值用于为 [UXRCE_DDS_KEY](../advanced_config/parameter_reference.md#UXRCE_DDS_KEY)分配一个唯一值:
```sh
param set UXRCE_DDS_KEY $((px4_instance+1))
参数设置 UXRCE_DDS_KEY $(px4_instance+1))
```
:::info
By doing so, `UXRCE_DDS_KEY` will always coincide with [MAV_SYS_ID](../advanced_config/parameter_reference.md#MAV_SYS_ID).
通过这种方式,UXRCE_DDS_KEY 将始终与 [MAV_SYS_ID] 保持一致(../advanced_config/parameter_reference.md#MAV_SYS_ID)
:::
Moreover, when `px4_instance` is greater than zero, a unique ROS 2 [namespace prefix](../middleware/uxrce_dds.md#customizing-the-namespace) in the form `px4_$px4_instance` is added:
此外,当 px4_instance 大于 0 时,会添加一个格式为 px4_$px4_instance 的唯一 ROS 2 命名空间前缀:
```sh
uxrce_dds_ns="-n px4_$px4_instance"
```
:::info
The environment variable `PX4_UXRCE_DDS_NS`, if set, will override the namespace behavior described above.
环境变量 PX4_UXRCE_DDS_NS 若已设置,将覆盖上文所述的命名空间行为。
:::
The first instance (`px4_instance=0`) does not have an additional namespace in order to be consistent with the default behavior of the `xrce-dds` client on a real vehicle.
This mismatch can be fixed by manually using `PX4_UXRCE_DDS_NS` on the first instance or by starting adding vehicles from index `1` instead of `0` (this is the default behavior adopted by [sitl_multiple_run.sh](https://github.com/PX4/PX4-Autopilot/blob/main/Tools/simulation/gazebo-classic/sitl_multiple_run.sh) for Gazebo Classic).
第一个实例(px4_instance=0)没有额外的命名空间,此举是为了与真实载具上 xrce-dds 客户端的默认行为保持一致。
这种不匹配可以通过手动使用 `PX4_UXRCE_DDS_NS` 来修复,或者通过从索引 `1` 中添加车辆而不是 `0` (这是Gazebo Classic的 [sitl_multiple_run.sh](https://github.com/PX4/PX4-Autopilot/blob/main/Tools/simulation/gazebo-classic/sitl_multiple_run.sh) 的默认行为)。
The default client configuration in simulation is summarized as follows:
模拟中的默认客户端配置概述如下:
| `PX4_UXRCE_DDS_NS` | `px4_instance` | `UXRCE_DDS_KEY` | client namespace |
| `PX4_UXRCE_DDS_NS` | `px4_instance` | `UXRCE_DDS_KEY` | 客户端命名空间 |
| ------------------ | -------------- | ---------------- | --------------------- |
| not provided | 0 | `px4_instance+1` | 无 |
| provided | 0 | `px4_instance+1` | `PX4_UXRCE_DDS_NS` |
| not provided | > 0 | `px4_instance+1` | `px4_${px4_instance}` |
| provided | > 0 | `px4_instance+1` | `PX4_UXRCE_DDS_NS` |
| 未提供 | 0 | `px4_instance+1` | 无 |
| 已提供 | 0 | `px4_instance+1` | `PX4_UXRCE_DDS_NS` |
| 未提供 | > 0 | `px4_instance+1` | `px4_${px4_instance}` |
| 已提供 | > 0 | `px4_instance+1` | `PX4_UXRCE_DDS_NS` |
## Adjusting the `target_system` value
## 调整 `target_system` 值
PX4 accepts [VehicleCommand](../msg_docs/VehicleCommand.md) messages only if their `target_system` field is zero (broadcast communication) or coincides with `MAV_SYS_ID`.
In all other situations, the messages are ignored.
Therefore, when ROS 2 nodes want to send `VehicleCommand` to PX4, they must ensure that the messages are filled with the appropriate `target_system` value.
PX4 只在他们的 `target_system` 字段为 0 (路由通信) 或与 `MAV_SYS_ID` 一致时,才接受 [VehicleCommand](../msg_docs/VehicleCommand.md)。
在所有其他情况下,信息都被忽视。
因此,当 ROS 2 节点需向 PX4 发送 VehicleCommand(载具指令)消息时,必须确保消息中填写了合适的 target_system(目标系统)字段值。
For example, if you want to send a command to your third vehicle, which has `px4_instance=2`, you need to set `target_system=3` in all your `VehicleCommand` messages.
+1 -1
View File
@@ -1,6 +1,6 @@
# ROS 2 Offboard 控制示例
The following C++ example shows how to do position control in [offboard mode](../flight_modes/offboard.md) from a ROS 2 node.
以下的 C++ 示例展示了如何在 [离板模式] (../flight_modes/offboard.md) 中从 ROS 2 节点进行位置控制。
示例将首先发送设置点、进入offboard模式、解锁、起飞至5米,并悬停等待。
虽然简单,但它显示了如何使用offboard控制以及如何向无人机发送指令。
+8 -8
View File
@@ -1,6 +1,6 @@
# PX4 ROS 2 Control Interface
<Badge type="tip" text="PX4 v1.15" /> <Badge type="warning" text="Experimental" />
<0/> <1/>
:::warning
Experimental
@@ -104,26 +104,26 @@ The above concepts provide a number of advantages over traditional [offboard con
The following steps are required to get started:
1. Make sure you have a working [ROS 2 setup](../ros2/user_guide.md), with [`px4_msgs`](https://github.com/PX4/px4_msgs) in the ROS 2 workspace.
1. 请确保您在 ROS 2 工作区中有 [ROS 2 设置](../ros2/user_guide.md) 与 [`px4_msgs`](https://github.com/PX4/px4_msgs]。
2. Clone the repository into the workspace:
2. 将代码仓库克隆到工作空间中
```sh
cd $ros_workspace/src
git clone --recursive https://github.com/Auterion/px4-ros2-interface-lib
```
::: info
To ensure compatibility, use the latest _main_ branches for PX4, _px4_msgs_ and the library.
See also [here](https://github.com/Auterion/px4-ros2-interface-lib#compatibility-with-px4).
提示信息
为确保兼容性,请使用 PX4、px4_msgs(PX4 消息包)及该库的最新 main 分支。
另请参阅 [here](https://github.com/Auterion/px4-ros2-interface-lib#compatibility-with-px4)
:::
3. Build the workspace:
3. 构建工作空间:
```sh
cd ..
colcon build
colcon building
source install/setup.bash
```
+21 -21
View File
@@ -1,48 +1,48 @@
# PX4 ROS 2 Interface Library
# PX4 ROS 2 接口库
<Badge type="tip" text="PX4 v1.15" /> <Badge type="warning" text="Experimental" />
<0/> <1/>
:::warning
Experimental
At the time of writing, parts of the PX4 ROS 2 Interface Library are experimental, and hence subject to change.
在撰写本文时,PX4 ROS 2 接口库的部分内容仍处于试验阶段,因此可能会发生变动。
:::
The [PX4 ROS 2 Interface Library](https://github.com/Auterion/px4-ros2-interface-lib) is a C++ library that simplifies controlling and interacting with PX4 from ROS 2.
[PX4 ROS 2 接口库 ](https://github.com/Auterion/px4-ros2-interface-lib)是一个 C++ 库,可简化从 ROS 2 对 PX4 进行控制和交互的操作。
The library provides two high-level interfaces for developers:
该库为开发者提供了两个高级接口。
1. The [Control Interface](./px4_ros2_control_interface.md) allows developers to create and dynamically register modes written using ROS 2.
It provides classes for sending different types of setpoints, ranging from high-level navigation tasks all the way down to direct actuator controls.
2. The [Navigation Interface](./px4_ros2_navigation_interface.md) enables sending vehicle position estimates to PX4 from ROS 2 applications, such as a VIO system.
1. [Control Interface](./px4_ros2_control_interface.md) 允许开发者创建并动态注册使用 ROS2 编写的模式。
它为发送不同类型的设置点提供了课程,涵盖范围从高级导航任务一直到直接执行器控制。
2. [导航界面](./px4_ros2_navigation_interface.md) 允许从ROS 2应用程序(如VIO系统)向PX4发送车辆位置估计数。
<!--
## Overview
-->
## Installation in a ROS 2 Workspace
## 在 ROS 2 工作区中安装
To get started using the library within an existing ROS 2 workspace:
要开始使用现有ROS2工作空间内的库:
1. Make sure you have a working [ROS 2 setup](../ros2/user_guide.md), with [`px4_msgs`](https://github.com/PX4/px4_msgs) in the ROS 2 workspace.
1. 请确保您在 ROS 2 工作区中有 [ROS 2 设置](../ros2/user_guide.md) 与 [`px4_msgs`](https://github.com/PX4/px4_msgs]。
2. Clone the repository into the workspace:
2. 将代码仓库克隆到工作空间中
```sh
cd $ros_workspace/src
git clone --recursive https://github.com/Auterion/px4-ros2-interface-lib
```
::: info
To ensure compatibility, use the latest _main_ branches for PX4, _px4_msgs_ and the library.
See also [here](https://github.com/Auterion/px4-ros2-interface-lib#compatibility-with-px4).
提示信息
为确保兼容性,请使用 PX4、px4_msgs(PX4 消息包)及该库的最新 main 分支。
另请参阅 [here](https://github.com/Auterion/px4-ros2-interface-lib#compatibility-with-px4)
:::
3. Build the workspace:
3. 构建工作空间:
```sh
cd ..
colcon build
colcon building
source install/setup.bash
```
@@ -50,9 +50,9 @@ To get started using the library within an existing ROS 2 workspace:
## How to Use the Library
-->
## CI: Integration Tests
## ROS集成测试
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.
向 PX4 提交拉取请求(pull request)时,持续集成(CI)会运行该库的集成测试
这些测试用于验证模式注册、故障保护(failsafes)和模式替换功能是否按预期工作。
For more information see [PX4 ROS2 Interface Library Integration Testing](../test_and_ci/integration_testing_px4_ros2_interface.md).
欲了解更多信息,请访问[PX4 ROS2 接口库集成测试](../test_and_ci/integration_testing_px4_ros2_interface.md)。
@@ -65,7 +65,7 @@ The translation node will print a warning if it encounters an unknown topic vers
After making a modification in PX4 to the message definitions and/or translation node code, you will need to rerun the steps above from point 2 to update your ROS workspace accordingly.
:::
### In ROS Applications
### 在ROS 应用中
While developing a ROS 2 application that communicates with PX4, it is not necessary to know the specific version of a message being used.
The message version can be added generically to a topic name like this:
@@ -183,7 +183,7 @@ class MinimalPubSub(Node):
On the PX4 side, the DDS client automatically adds the version suffix if a message definition contains the field `uint32 MESSAGE_VERSION = x`.
:::info
Version 0 of a topic means that no `_v<version>` suffix should be added.
主题版本0意味着不应添加`_v<version>`后缀。
:::
## Development
@@ -1,10 +1,10 @@
# PX4 ROS 2 Navigation Interface
# PX4 ROS2 导航接口
<Badge type="tip" text="PX4 v1.15" /> <Badge type="warning" text="Experimental" />
<0/> <1/>
:::warning
Experimental
At the time of writing, parts of the PX4 ROS 2 Interface Library are experimental, and hence subject to change.
在撰写本文时,PX4 ROS 2 接口库的部分内容仍处于试验阶段,因此可能会发生变动。
:::
The [PX4 ROS 2 Interface Library](../ros2/px4_ros2_interface_lib.md) navigation interface enables developers to send their position measurements to PX4 directly from ROS 2 applications, such as a VIO system or a map matching system.
@@ -18,22 +18,22 @@ The `update` method expects a position measurement `struct` ([`LocalPositionMeas
The following steps are required to get started:
1. Make sure you have a working [ROS 2 setup](../ros2/user_guide.md), with [`px4_msgs`](https://github.com/PX4/px4_msgs) in the ROS 2 workspace.
1. 请确保您在 ROS 2 工作区中有 [ROS 2 设置](../ros2/user_guide.md) 与 [`px4_msgs`](https://github.com/PX4/px4_msgs]。
2. Clone the repository into the workspace:
2. 将代码仓库克隆到工作空间中
```sh
cd $ros_workspace/src
git clone --recursive https://github.com/Auterion/px4-ros2-interface-lib
```
::: info
To ensure compatibility, use the latest _main_ branches for PX4, _px4_msgs_ and the library.
See also [here](https://github.com/Auterion/px4-ros2-interface-lib#compatibility-with-px4).
提示信息
为确保兼容性,请使用 PX4、px4_msgs(PX4 消息包)及该库的最新 main 分支。
另请参阅 [here](https://github.com/Auterion/px4-ros2-interface-lib#compatibility-with-px4)
:::
3. Build the workspace:
3. 构建工作空间:
```sh
cd ..