mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 02:13:33 +08:00
Move PX4 Guide source into /docs (#24490)
* Add vitepress tree * Update existing workflows so they dont trigger on changes in the docs path * Add nojekyll, package.json, LICENCE etc * Add crowdin docs upload/download scripts * Add docs flaw checker workflows * Used docs prefix for docs workflows * Crowdin obvious fixes * ci: docs move to self hosted runner runs on a beefy server for faster builds Signed-off-by: Ramon Roche <mrpollo@gmail.com> * ci: don't run build action for docs or ci changes Signed-off-by: Ramon Roche <mrpollo@gmail.com> * ci: update runners Signed-off-by: Ramon Roche <mrpollo@gmail.com> * Add docs/en * Add docs assets and scripts * Fix up editlinks to point to PX4 sources * Download just the translations that are supported * Add translation sources for zh, uk, ko * Update latest tranlsation and uorb graphs * update vitepress to latest --------- Signed-off-by: Ramon Roche <mrpollo@gmail.com> Co-authored-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
co-authored by
Ramon Roche
parent
8e6d2ebe4a
commit
88d623bedb
@@ -0,0 +1,23 @@
|
||||
# 社区支持的开发者工具
|
||||
|
||||
本节包含 _社区支持的_ 开发搭建、集成开发环境、模拟器和其他工具的信息。
|
||||
|
||||
:::warning
|
||||
这些设置没有核心开发团队的维护、测试或支持
|
||||
他们可能与当前版本的 PX4 工作, 也可能不工作。
|
||||
|
||||
关于核心开发团队支持的环境和工具的信息,请参阅 [工具链安装](../dev_setup/dev_env.md)
|
||||
:::
|
||||
|
||||
这些工具有来自其社区的不同程度的支持 (有些得到很好的支持,有些则没有) 。
|
||||
关于这些工具的问题应该在 [讨论论坛](../contribute/support.md#forums-and-chat)提出
|
||||
|
||||
- 开发平台/设置
|
||||
- [CentOS Linux](../dev_setup/dev_env_linux_centos.md)
|
||||
- [Arch Linux](../dev_setup/dev_env_linux_arch.md)
|
||||
- [Windows VM Toolchain](../dev_setup/dev_env_windows_vm.md) — 在 Windows 虚拟机中运行的 Ubuntu 。
|
||||
- [Windows Cygwin Toolchain](../dev_setup/dev_env_windows_cygwin.md) — 仅适用于 PX4 v1.12 的 Windows 设置
|
||||
- [Windows Cygwin 工具链维护](../dev_setup/dev_env_windows_cygwin_packager_setup.md)
|
||||
- 集成开发环境
|
||||
- [Qt Creator IDE](../dev_setup/qtcreator.md)
|
||||
- [仿真模拟器](../simulation/community_supported_simulators.md) — [Simulation-In-Hardware](../sim_sih/index.md), [FlightGear](../sim_flightgear/index.md), [JSBSim](../sim_jsbsim/index.md), [AirSim](../sim_airsim/index.md), [HITL](../simulation/hitl.md)
|
||||
@@ -0,0 +1,92 @@
|
||||
# 计算机视觉 (光流,MoCap, VIO,避障)
|
||||
|
||||
[Computer vision](https://en.wikipedia.org/wiki/Computer_vision) techniques enable computers to use visual data to make sense of their environment.
|
||||
|
||||
PX4 uses computer vision systems (primarily running on [Companion Computers](../companion_computer/index.md)) in order to support the following features:
|
||||
|
||||
- [Optical Flow](#optical-flow) provides 2D velocity estimation (using a downward facing camera and a downward facing distance sensor).
|
||||
- [Motion Capture](#motion-capture) provides 3D pose estimation using a vision system that is _external_ to the vehicle.
|
||||
它主要用于室内导航。
|
||||
- [Visual Inertial Odometry](#visual-inertial-odometry-vio) provides 3D pose and velocity estimation using an onboard vision system and IMU.
|
||||
用于在 GNSS 位置信息不存在或不可靠时的导航。
|
||||
- [Collision Prevention](../computer_vision/collision_prevention.md) is used to stop vehicles before they can crash into an obstacle (primarily when flying in manual modes).
|
||||
|
||||
:::tip
|
||||
The [PX4 Vision Autonomy Development Kit](../complete_vehicles_mc/px4_vision_kit.md) (Holybro) is a robust and inexpensive kit for developers working with computer vision on PX4.
|
||||
:::
|
||||
|
||||
## 运动捕捉
|
||||
|
||||
Motion Capture (MoCap) is a technique for estimating the 3D _pose_ (position and orientation) of a vehicle using a positioning mechanism that is _external_ to the vehicle.
|
||||
MoCap 系统最常使用红外相机检测运动,但也可以使用其他类型的相机,激光雷达或者超宽带 (UWB)。
|
||||
|
||||
:::info
|
||||
MoCap is commonly used to navigate a vehicle in situations where GPS is absent (e.g. indoors), and provides position relative to a _local_ coordinate system.
|
||||
:::
|
||||
|
||||
有关 MoCap 的信息,请参阅:
|
||||
|
||||
- [External Position Estimation](../ros/external_position_estimation.md)
|
||||
- [Flying with Motion Capture (VICON, NOKOV, Optitrack)](../tutorials/motion-capture.md)
|
||||
- [Using PX4's Navigation Filter (EKF2) > External Vision System](../advanced_config/tuning_the_ecl_ekf.md#external-vision-system)
|
||||
|
||||
## Visual Inertial Odometry (VIO)
|
||||
|
||||
Visual Inertial Odometry (VIO) is used for estimating the 3D _pose_ (position and orientation) and _velocity_ of a moving vehicle relative to a _local_ starting position.
|
||||
它通常用于在 GPS 不存在(例如室内)或不可靠的情况下(例如在桥下飞行时)给载具导航。
|
||||
|
||||
VIO uses [Visual Odometry](https://en.wikipedia.org/wiki/Visual_odometry) to estimate vehicle _pose_ from visual information, combined with inertial measurements from an IMU (to correct for errors associated with rapid vehicle movement resulting in poor image capture).
|
||||
|
||||
:::info
|
||||
One difference between VIO and [MoCap](#motion-capture) is that VIO cameras/IMU are vehicle-based, and additionally provide velocity information.
|
||||
:::
|
||||
|
||||
关于在 PX4 上配置 VIO 的信息,请参阅:
|
||||
|
||||
- [Using PX4's Navigation Filter (EKF2) > External Vision System](../advanced_config/tuning_the_ecl_ekf.md#external-vision-system)
|
||||
- [T265 Setup guide](../peripherals/camera_t265_vio.md)
|
||||
|
||||
## 光流
|
||||
|
||||
[Optical Flow](../sensor/optical_flow.md) provides 2D velocity estimation (using a downward facing camera and a downward facing distance sensor).
|
||||
|
||||
有关光流的信息,请参阅:
|
||||
|
||||
- [Optical Flow](../sensor/optical_flow.md)
|
||||
- [Using PX4's Navigation Filter (EKF2) > Optical Flow](../advanced_config/tuning_the_ecl_ekf.md#optical-flow)
|
||||
|
||||
## 比较
|
||||
|
||||
### 本地位置估计 光学流 对 VIO
|
||||
|
||||
这两种技术都使用照相机并测量帧之间的差异。
|
||||
光学流使用向下照相机,而VIO则使用立体照相机或45度跟踪照相机。
|
||||
假定两者的校准都很好,哪个对本地地位置估计更好?
|
||||
|
||||
The consensus [appears to be](https://discuss.px4.io/t/vio-vs-optical-flow/34680):
|
||||
|
||||
Optical flow:
|
||||
|
||||
- 向下光学流使得你能够通过陀螺仪的角速度来校正角平面速度。
|
||||
- 需要准确的地面距离并假定地面为平面。
|
||||
在这种情况下,它可能与VIO一样准确可靠(例如室内飞行)
|
||||
- 它比VIO更健壮,因为它的状态较少。
|
||||
- 更便宜和更容易设置,因为它只需要一个流传感器,一个范围探测器。 并设置几个参数(可以连接到飞行控制器)。
|
||||
|
||||
VIO
|
||||
|
||||
- 购买更加昂贵,设置更加困难。
|
||||
它需要一台单独的配套计算机、校准、软件、配置等等。
|
||||
- 如果没有可跟踪的点特征(实际上现实世界一般有点特征),效果将会减弱。
|
||||
- 较为灵活,可以增加诸如避免障碍和制图等其他功能。
|
||||
|
||||
组合(两者兼用)可能是最可靠的,但在大多数现实世界的情景中并不必要。
|
||||
通常您将选择适合您的运行环境、所需功能和成本限制的系统:
|
||||
|
||||
- 如果您打算在没有GPS的情况下在室外飞行(或室外和室内飞行),请使用 VIO 或者如果您需要支持避障碍和其他计算机视觉特性。
|
||||
- 如果您只计划在室内飞行(不使用 GPS),且成本是一个重要的考虑因素,使用Optical Flow。
|
||||
|
||||
## 外部资源
|
||||
|
||||
- [XTDrone](https://github.com/robin-shaun/XTDrone/blob/master/README.en.md) - ROS + PX4 simulation environment for computer vision.
|
||||
The [XTDrone Manual](https://www.yuque.com/xtdrone/manual_en) has everything you need to get started!
|
||||
@@ -0,0 +1,187 @@
|
||||
# 云台配置
|
||||
|
||||
本页面介绍了如何配置及控制一个安装了相机(或其他任务载荷)的云台。
|
||||
|
||||
## 综述
|
||||
|
||||
PX4 包含了一个通用的挂载设备/云台的控制驱动,它含有多种输入输出方式。
|
||||
|
||||
- 输入方式定义控制云台挂在的协议,该协议由 PX4 管理。
|
||||
该输入方式可能是一个遥控器,一个可以发送 MAVLink 的地面站,或者两者 — 两种可以自动切换。
|
||||
- 输出方式定义了 PX4 如何与连接的云台通信。
|
||||
推荐的协议是 MAVLink v2, 但您也可以直接连接到飞控的 PWM 输出端口。
|
||||
|
||||
PX4 接收输入信号,并且将其路由/翻译后发送到输出。
|
||||
任何输入方式都可以被选择来驱动任何输出。
|
||||
|
||||
输入和输出都使用参数进行配置。
|
||||
The input is set using the parameter [MNT_MODE_IN](../advanced_config/parameter_reference.md#MNT_MODE_IN).
|
||||
By default this is set to `Disabled (-1)` and the driver does not run.
|
||||
在选择输入模式后,请重新启动飞行器以启动挂载驱动程序。
|
||||
|
||||
You should set `MNT_MODE_IN` to one of: `RC (1)`, `MAVlink gimbal protocol v2 (4)` or `Auto (0)` (the other options are deprecated).
|
||||
If you select `Auto (0)`, the gimbal will automatically select either RC or or MAVLink input based on the latest input.
|
||||
请注意,从 MAVLink 到 RC 的自动切换需要一个大幅度地杆量操作!
|
||||
|
||||
The output is set using the [MNT_MODE_OUT](../advanced_config/parameter_reference.md#MNT_MODE_OUT) parameter.
|
||||
By default the output is set to a PXM port (`AUX (0)`).
|
||||
If the [MAVLink Gimbal Protocol v2](https://mavlink.io/en/services/gimbal_v2.html) is supported by your gimbal, you should instead select `MAVLink gimbal protocol v2 (2)`.
|
||||
|
||||
The full list of parameters for setting up the mount driver can be found in [Parameter Reference > Mount](../advanced_config/parameter_reference.md#mount).
|
||||
下面介绍了一些通用的云台相关设置。
|
||||
|
||||
## MAVLink 云台 (MNT_MODE_OUT=MAVLINK)
|
||||
|
||||
系统上的每个物理云台装置必须有自己的高级云台管理器, 地面站通过使用MAVLink云台协议发现它。
|
||||
The ground station sends high level [MAVLink Gimbal Manager](https://mavlink.io/en/services/gimbal_v2.html#gimbal-manager-messages) commands to the manager of the gimbal it wants to control, and the manager will in turn send appropriate lower level "gimbal device" commands to control the gimbal.
|
||||
|
||||
PX4 can be configured as the gimbal manager to control a single gimbal device (which can either be physically connected or be a MAVLink gimbal that implements the [gimbal device interface](https://mavlink.io/en/services/gimbal_v2.html#gimbal-device-messages)).
|
||||
|
||||
To enable a MAVLink gimbal, first set parameter [MNT_MODE_IN](../advanced_config/parameter_reference.md#MNT_MODE_IN) to `MAVlink gimbal protocol v2` and [MNT_MODE_OUT](../advanced_config/parameter_reference.md#MNT_MODE_OUT) to `MAVLink gimbal protocol v2`.
|
||||
|
||||
The gimbal can be connected to _any free serial port_ using the instructions in [MAVLink Peripherals (GCS/OSD/Companion)](../peripherals/mavlink_peripherals.md) (also see [Serial Port Configuration](../peripherals/serial_configuration.md#serial-port-configuration)).
|
||||
For example, if the `TELEM2` port on the flight controller is unused you can connect it to the gimbal and set the following PX4 parameters:
|
||||
|
||||
- [MAV_1_CONFIG](../advanced_config/parameter_reference.md#MAV_1_CONFIG) to **TELEM2** (if `MAV_1_CONFIG` is already used for a companion computer (say), use `MAV_2_CONFIG`).
|
||||
- [MAV_1_MODE](../advanced_config/parameter_reference.md#MAV_1_MODE) to **NORMAL**
|
||||
- [SER_TEL2_BAUD](../advanced_config/parameter_reference.md#SER_TEL2_BAUD) to manufacturer recommended baud rate.
|
||||
|
||||
### 多云台支持
|
||||
|
||||
PX4 可以自动为已连接的 PWM 云台或第一个在任何接口上检测到相同的系统 id 的 MAVLink 云台设备创建一个云台管理器。
|
||||
它不会自动为它检测到的其他MAVLink云台设备创建云台管理器。
|
||||
|
||||
You can support additional MAVLink gimbals provided that they:
|
||||
|
||||
- Implement the gimbal _manager_ protocol.
|
||||
- 在 MAVLink 网络上对地面站和 PX4 可见。
|
||||
这可能需要在PX4、GCS和云台之间配置流量转接。
|
||||
- Have a unique component id, and this component id must be in the range 7 - 255.
|
||||
|
||||
## 飞控 PWM 输出上的云台 (MNT_MODE_OUT=AUX)
|
||||
|
||||
The gimbal can also be controlled by connecting it to up to three flight controller PWM ports and setting the output mode to `MNT_MODE_OUT=AUX`.
|
||||
|
||||
The output pins that are used to control the gimbal are set in the [Acuator Configuration > Outputs](../config/actuators.md#actuator-outputs) by selecting any three unused Actuator Outputs and assigning them the following output functions:
|
||||
|
||||
- `Gimbal Roll`: Output controls gimbal roll.
|
||||
- `Gimbal Pitch`: Output controls Gimbal pitch.
|
||||
- `Gimbal Yaw`: Output controls Gimbal yaw.
|
||||
|
||||
例如,您可能有以下设置可将云台滚动、俯仰和偏航分配给 AUX1-3 输出。
|
||||
|
||||

|
||||
|
||||
The PWM values to use for the disarmed, maximum and minimum values can be determined in the same way as other servo, using the [Actuator Test sliders](../config/actuators.md#actuator-testing) to confirm that each slider moves the appropriate axis, and changing the values so that the gimbal is in the appropriate position at the disarmed, low and high position in the slider.
|
||||
这些数值也可以在云台文档中提供。
|
||||
|
||||
## Gimbal Control in Missions
|
||||
|
||||
[Gimbal Manager commands](https://mavlink.io/en/services/gimbal_v2.html#gimbal-manager-messages) may be used in missions if supported by the vehicle type.
|
||||
For example [MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW) is supported in [multicopter mission mode](../flight_modes_mc/mission.md).
|
||||
|
||||
In theory you can address commands to a particular gimbal, specifying its component id using the "Gimbal device id" parameter.
|
||||
However at time of writing (December 2024) this is [not supported](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/gimbal/input_mavlink.cpp#L889): all mission commands are sent to the (only) gimbal managed by the PX4 gimbal manager (if this is a MAVLink gimbal, it will be the gimbal with component id defined in the parameter [MNT_MAV_COMPID](../advanced_config/parameter_reference.md#MNT_MAV_COMPID), which is set by default to [MAV_COMP_ID_GIMBAL (154)](https://mavlink.io/en/messages/common.html#MAV_COMP_ID_GIMBAL)).
|
||||
|
||||
Gimbal movement is not immediate.
|
||||
To ensure that the gimbal has time to move into position before the mission progresses to the next item (if gimbal feedback is not provided or lost), you should set [MIS_COMMAND_TOUT](../advanced_config/parameter_reference.md#MIS_COMMAND_TOUT) to be greater than the time taken for the gimbal to traverse its full range.
|
||||
After this timeout the mission will proceed to the next item.
|
||||
|
||||
## Simulation / SITL
|
||||
|
||||
The following simulation environments come with a preconfigured simulated gimbal.
|
||||
You can test the gimbal using the [QGroundControl UI](#qgc-testing) or by sending [driver commands](#driver-testing)
|
||||
|
||||
:::tip
|
||||
If you only need to test the [gimbal driver](../modules/modules_driver.md#gimbal), then you can do this on any model or simulators.
|
||||
Just make sure that the driver runs, using `gimbal start` in the MAVLink console, then configure the driver parameters.
|
||||
:::
|
||||
|
||||
### Gazebo
|
||||
|
||||
To run the [Gazebo](../sim_gazebo_gz/index.md) simulation [Quadrotor(x500) with gimbal (Front-facing) in Gazebo](../sim_gazebo_gz/vehicles.md#x500-quadrotor-with-gimbal-front-facing), use:
|
||||
|
||||
```sh
|
||||
make px4_sitl gz_x500_gimbal
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Gazebo Classic
|
||||
|
||||
To run the [Gazebo Classic](../sim_gazebo_classic/index.md) simulation [Typhoon H480 model](../sim_gazebo_classic/vehicles.md#typhoon-h480-hexrotor), use:
|
||||
|
||||
```sh
|
||||
make px4_sitl gazebo-classic_typhoon_h480
|
||||
```
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## 测试
|
||||
|
||||
### QGC Testing
|
||||
|
||||
The on-screen gimbal control can be used to move/test a connected MAVLink camera:
|
||||
|
||||
1. Start your preferred [simulator](#simulation-sitl) or connect to a real device.
|
||||
|
||||
2. Open QGroundControl and enable the on-screen camera control (Application settings).
|
||||
|
||||

|
||||
|
||||
3. Make sure the vehicle is armed and flying, e.g. by entering with `commander takeoff`.
|
||||
|
||||
4. To change gimbal target position, click in the QGC GUI up, down, left, right, or use the buttons on the gimbal control (**Center**, **Tilt 90**, **Yaw lock**).
|
||||
|
||||
### Driver Testing
|
||||
|
||||
You can test a gimbal by sending `gimbal` driver commands in the [QGroundControl MAVLink Console](https://docs.qgroundcontrol.com/master/en/qgc-user-guide/analyze_view/mavlink_console.html):
|
||||
|
||||
1. Start your preferred [simulator](#simulation-sitl) or connect to a real device.
|
||||
2. Open QGroundControl and connect to your vehicle.
|
||||
3. Open the MAVLink Console using the menu: **Analyze > Mavlink Console**.
|
||||
4. Make sure the vehicle is armed and flying, e.g. by entering the command: `commander takeoff`.
|
||||
|
||||
To check gimbal status enter:
|
||||
|
||||
```sh
|
||||
gimbal status
|
||||
```
|
||||
|
||||
To set the gimbal yaw to 30 degrees, use the command:
|
||||
|
||||
```sh
|
||||
gimbal test yaw 30
|
||||
```
|
||||
|
||||
More generally, you can set the angle or angular rate command using a command with this format:
|
||||
|
||||
```sh
|
||||
gimbal test <axis> <value>
|
||||
```
|
||||
|
||||
- `axis`:
|
||||
- `<roll|pitch|yaw>` for angles
|
||||
- `<rollrate|pitchrate|yawrate>` for angular rates
|
||||
- `value`:
|
||||
- `<degrees>` for angles
|
||||
- `<degrees / second>` for angular rates
|
||||
|
||||
To set the MAVLink component that is in primary control of the gimbal:
|
||||
|
||||
```sh
|
||||
gimbal primary-control <sys_id> <comp_id>
|
||||
```
|
||||
|
||||
- `sys_id`: MAVLink system ID
|
||||
- `comp_id`: MAVLink component ID
|
||||
|
||||
For other commands, see the [`gimbal`](../modules/modules_driver.md#gimbal) driver module document.
|
||||
|
||||
### MAVLink Testing
|
||||
|
||||
The gimbal can be tested by sending MAVLink gimbal manager commands using [MAVSDK](../robotics/mavsdk.md) or some other MAVLink library.
|
||||
|
||||
Note that the simulated gimbal stabilizes itself, so if you send MAVLink commands, set the `stabilize` flags to `false`.
|
||||
@@ -0,0 +1 @@
|
||||
# 高级主题
|
||||
@@ -0,0 +1,87 @@
|
||||
# 外部模块(Out-of-Tree)
|
||||
|
||||
外部模块为开发人员提供了一种便捷的机制,可以管理/分组他们想要添加(或更新)PX4 固件的专有模块。
|
||||
外部模块可以使用与内部模块相同的includes,并可以通过uORB与内部模块交互。
|
||||
|
||||
本主题说明如何将外部(“out of tree”)模块添加到 PX4 编译中。
|
||||
|
||||
:::tip
|
||||
We encourage you to contribute your changes into PX4, where possible!
|
||||
:::
|
||||
|
||||
## 用法
|
||||
|
||||
要创建外部模块:
|
||||
|
||||
- Create an _external directory_ folder for grouping the external modules:
|
||||
- This can be located anywhere outside of the **PX4-Autopilot** tree.
|
||||
- It must have the same structure as **PX4-Autopilot** (i.e. it must contain a directory called **src**).
|
||||
- Later we refer to this directory using `EXTERNAL_MODULES_LOCATION`.
|
||||
|
||||
- Copy an existing module (e.g. **examples/px4_simple_app**) to the external directory, or directly create a new module.
|
||||
|
||||
- Rename the module (including `MODULE` in **CMakeLists.txt**) or remove it from the existing PX4-Autopilot _cmake_ build config.
|
||||
这是为了避免与内部模块发生冲突。
|
||||
|
||||
- Add a file **CMakeLists.txt** in the external directory with content:
|
||||
|
||||
```cmake
|
||||
set(config_module_list_external
|
||||
modules/<new_module>
|
||||
PARENT_SCOPE
|
||||
)
|
||||
```
|
||||
|
||||
- Add a line `EXTERNAL` to the `modules/<new_module>/CMakeLists.txt` within
|
||||
`px4_add_module()`, for example like this:
|
||||
|
||||
```cmake
|
||||
px4_add_module(
|
||||
MODULE modules__test_app
|
||||
MAIN test_app
|
||||
STACK_MAIN 2000
|
||||
SRCS
|
||||
px4_simple_app.c
|
||||
DEPENDS
|
||||
platforms__common
|
||||
EXTERNAL
|
||||
)
|
||||
```
|
||||
|
||||
## Out-of-Tree uORB 消息定义
|
||||
|
||||
树外uORB消息将在与正常uORB消息相同的位置生成。 For this, the `$EXTERNAL_MODULES_LOCATION/msg` folder must exist.
|
||||
|
||||
- Place all new message definitions within the `$EXTERNAL_MODULES_LOCATION/msg` directory.
|
||||
The format of these new out-of-tree message definitions are the same as for any other [uORB message definition](../middleware/uorb.md#adding-a-new-topic).
|
||||
- Add a file `$EXTERNAL_MODULES_LOCATION/msg/CMakeLists.txt` with content:
|
||||
|
||||
```cmake
|
||||
set(config_msg_list_external
|
||||
<message1>.msg
|
||||
<message2>.msg
|
||||
<message3>.msg
|
||||
PARENT_SCOPE
|
||||
)
|
||||
```
|
||||
|
||||
where `<message#>.msg` is the name of the uORB message definition file to be processed and used for uORB message generation.
|
||||
|
||||
树外 uORB 消息将在与正常 uORB 消息相同的位置生成。
|
||||
The uORB topic headers are generated in `<build_dir>/uORB/topics/`, and the message source files are
|
||||
generated in `<build_dir>/msg/topics_sources/`.
|
||||
|
||||
The new uORB messages can be used like any other uORB message as described [here](../middleware/uorb.md#adding-a-new-topic).
|
||||
|
||||
:::warning
|
||||
The out-of-tree uORB message definitions cannot have the same name as any of the normal uORB messages.
|
||||
:::
|
||||
|
||||
## 构建外部模块和 uORB 消息
|
||||
|
||||
Execute `make px4_sitl EXTERNAL_MODULES_LOCATION=<path>`.
|
||||
|
||||
任何其他构建目标都可以使用,但构建目录尚不存在。
|
||||
If it already exists, you can also just set the _cmake_ variable in the build folder.
|
||||
|
||||
For subsequent incremental builds `EXTERNAL_MODULES_LOCATION` does not need to be specified.
|
||||
@@ -0,0 +1,67 @@
|
||||
# 包裹投递任务
|
||||
|
||||
<Badge type="tip" text="PX4 v1.14" />
|
||||
|
||||
包裹投递任务是航点任务的拓展,用户可以计划将包裹作为航点进行投递。
|
||||
|
||||
本节解释了包裹投递功能的架构。
|
||||
它的目的是为从事扩展架构的开发者提供支持,例如支持新的有效载荷投递机制。
|
||||
|
||||
:::info
|
||||
Currently only [Grippers](../peripherals/gripper.md) can be used for package delivery.
|
||||
绞盘尚未支持。
|
||||
:::
|
||||
|
||||
:::info
|
||||
The detailed documentation on how to setup a package delivery mission plan can be found [here](../flying/package_delivery_mission.md).
|
||||
Setup for the `payload_deliverer` module is covered in the documentation for the delivery mechanism, such as [Gripper](../peripherals/gripper.md#px4-configuration).
|
||||
:::
|
||||
|
||||
## 包裹投递架构图
|
||||
|
||||

|
||||
|
||||
Package Delivery feature is centered around the [VehicleCommand](../msg_docs/VehicleCommand.md) & [VehicleCommandAck](../msg_docs/VehicleCommandAck.md) messages.
|
||||
|
||||
The central idea lies in having an entity that handles the `DO_GRIPPER` or `DO_WINCH` vehicle command, executes it and sends back an acknowledgement when the successful delivery is confirmed.
|
||||
|
||||
Because PX4 automatically broadcasts the `VehicleCommand` uORB message to a UART port configured to communicate in MAVLink as a [`COMMAND_LONG`](https://mavlink.io/en/messages/common.html#COMMAND_LONG) message, an external payload can receive the command and execute it.
|
||||
|
||||
Likewise, since PX4 automatically translates the [`COMMAND_ACK`](https://mavlink.io/en/messages/common.html#COMMAND_ACK) message coming in from an external source through a UART port configured for MAVLink into a `vehicle_command_ack` uORB message, an external payload's acknowledgement for a successful package deployment can be received by PX4's `navigator` module.
|
||||
|
||||
下面解释了包裹投递架构中涉及的每个实体。
|
||||
|
||||
## 导航器
|
||||
|
||||
导航器处理接收车辆命令 ACK (下文所述)。
|
||||
在收到成功部署确认消息后,它会设置任务块级别中的标志,以表示有效载荷部署已成功。
|
||||
|
||||
这允许任务安全地继续到下一个项目(例如路径点),因为我们确信部署已成功得到确认。
|
||||
|
||||
## 车辆命令 ACK
|
||||
|
||||
We are waiting for the ACK coming from either internally (via `payload_deliverer` module), or externally (external entity sending the MAVLink message `COMMAND_ACK`) to determine if the package delivery action has been successful (either `DO_GRIPPER` or `DO_WINCH`).
|
||||
|
||||
## Mission
|
||||
|
||||
The Gripper / Winch command is placed as a `Mission Item`.
|
||||
This is possible since all the Mission item has the `MAV_CMD` to execute (e.g. Land, Takeoff, Waypoint, etc) which can get set to either `DO_GRIPPER` or `DO_WINCH`.
|
||||
|
||||
In the Mission logic (green box above) if either Gripper/Winch mission item is reached, it implements brake_for_hold functionality (which sets the `valid` flag of the next mission item waypoint to `false`) for rotary wings (e.g. Multicopter) so that the vehicle would hold it's position while the deployment is getting executed.
|
||||
|
||||
固定翼飞机和其他车辆不考虑特殊制动条件。
|
||||
所以如果你有一个固定翼的悬停任务,飞机在悬停的同时投递包裹,飞机不会停止 (因为这是不可能的)。
|
||||
|
||||
## 任务块
|
||||
|
||||
`MissionBlock` is the parent class of `Mission` that handles the part "Is Mission completed?".
|
||||
|
||||
This all performed in the `is_mission_item_reached_or_completed` function, to handle the time delay / mission item advancement.
|
||||
|
||||
Also it implements the actual issue_command function, which will issue a vehicle command corresponding to the mission item's `MAV_CMD`, which will then be received by an external payload or the `payload_deliverer` module internally.
|
||||
|
||||
## Payload Deliverer
|
||||
|
||||
This is a dedicated module that handles gripper / winch support, which is used for the standard [package delivery mission plan](../flying/package_delivery_mission.md).
|
||||
|
||||
Setup for the `payload_deliverer` module is covered within setting up an actual package release mechanism setup documentation like [Gripper](../peripherals/gripper.md#px4-configuration).
|
||||
@@ -0,0 +1,365 @@
|
||||
# Parameters & Configurations
|
||||
|
||||
PX4 uses the _param subsystem_ (a flat table of `float` and `int32_t` values) and text files (for startup scripts) to store its configuration.
|
||||
|
||||
This section discusses the _param_ subsystem in detail.
|
||||
它涵盖如何列出、保存和加载参数,以及如何定义这些参数并使这些参数在地面站上显示。
|
||||
|
||||
:::tip
|
||||
[System startup](../concept/system_startup.md) and the way that [frame configuration](../dev_airframes/adding_a_new_frame.md) startup scripts work are detailed on other pages.
|
||||
:::
|
||||
|
||||
## 命令行使用方法
|
||||
|
||||
The PX4 [system console](../debug/system_console.md) offers the [param](../modules/modules_command.md#param) tool, which can be used to set parameters, read their value, save them, and export and restore to/from files.
|
||||
|
||||
### 获取和设置参数
|
||||
|
||||
The `param show` command lists all system parameters:
|
||||
|
||||
```sh
|
||||
param show
|
||||
```
|
||||
|
||||
为了更有选择性,部分参数名称可以使用通配符 "\*" :
|
||||
|
||||
```sh
|
||||
nsh> param show RC_MAP_A*
|
||||
Symbols: x = used, + = saved, * = unsaved
|
||||
x RC_MAP_AUX1 [359,498] : 0
|
||||
x RC_MAP_AUX2 [360,499] : 0
|
||||
x RC_MAP_AUX3 [361,500] : 0
|
||||
x RC_MAP_ACRO_SW [375,514] : 0
|
||||
|
||||
723 parameters total, 532 used.
|
||||
```
|
||||
|
||||
You can use the `-c` flag to show all parameters that have changed (from their defaults):
|
||||
|
||||
```sh
|
||||
param show -c
|
||||
```
|
||||
|
||||
You can use `param show-for-airframe` to show all parameters that have changed from their defaults for just the current airframe's definition file (and defaults it imports).
|
||||
|
||||
### 导出和加载参数
|
||||
|
||||
You can save any parameters that have been _changed_ (that are different from airframe defaults).
|
||||
|
||||
The standard `param save` command will store the parameters in the current default file:
|
||||
|
||||
```sh
|
||||
param save
|
||||
```
|
||||
|
||||
如果提供了参数,它会将参数存储到这个新位置:
|
||||
|
||||
```sh
|
||||
param save /fs/microsd/vtol_param_backup
|
||||
```
|
||||
|
||||
There are two different commands to _load_ parameters:
|
||||
|
||||
- `param load` first does a full reset of all parameters to their defaults, and then overwrites parameter values with any values stored in the file.
|
||||
- `param import` just overwrites parameter values with the values from the file and then saves the result (i.e. effectively calls `param save`).
|
||||
|
||||
The `load` effectively resets the parameters to the state when the parameters were saved (we say "effectively" because any parameters saved in the file will be updated, but other parameters may have different firmware-defined default values than when the parameters file was created).
|
||||
|
||||
By contrast, `import` merges the parameters in the file with the current state of the vehicle.
|
||||
例如,这可以用来只导入包含校准数据的参数文件,而不覆盖系统配置的其余部分。
|
||||
|
||||
这两种情况的示例如下所示:
|
||||
|
||||
```sh
|
||||
# 文件保存时重置参数
|
||||
param load /fs/microsd/vtol_param_backup
|
||||
# 选择性的保存参数 (不自动加载)
|
||||
param save
|
||||
```
|
||||
|
||||
```sh
|
||||
# 将保存的参数与当前参数合并
|
||||
param import /fs/microsd/vtol_param_backup
|
||||
```
|
||||
|
||||
## 参数创建/定义
|
||||
|
||||
参数定义有两部分:
|
||||
|
||||
- [Parameter metadata](#parameter-metadata) specifies the default value for each parameter in firmware along with other metadata for presentation (and editing) of parameters in ground control stations and documentation.
|
||||
- [C/C++ Code](#c-c-api) that provides access to get and/or subscribe to parameter values from within PX4 modules and drivers.
|
||||
|
||||
以下描述了编写元数据和代码的几种方法。
|
||||
Where possible code should use newer [YAML metadata](#yaml-metadata) and [C++ API](#c-api) over the older C parameter/code definitions, as these are more flexible and robust.
|
||||
|
||||
Parameter metadata is [compiled into the firmware](#publishing-parameter-metadata-to-a-gcs),
|
||||
and made available to ground stations via the [MAVLink Component Information service](https://mavlink.io/en/services/component_information.html).
|
||||
|
||||
### 参数名称
|
||||
|
||||
参数名称不得超过 16 个 ASCII 字符。
|
||||
|
||||
By convention, every parameter in a group should share the same (meaningful) string prefix followed by an underscore, and `MC_` and `FW_` are used for parameters related specifically to Multicopter or Fixed-wing systems.
|
||||
此惯例不强制执行。
|
||||
|
||||
The name must match in both code and [parameter metadata](#parameter-metadata) to correctly associate the parameter with its metadata (including default value in Firmware).
|
||||
|
||||
### C / C++ API
|
||||
|
||||
有单独的 C 和 C++ 的 API 可用于从 PX4 模块和驱动程序中访问参数值。
|
||||
|
||||
API 之间的一个重要区别是,C++ 版本具有更有效的标准化机制,可与参数值的更改(即来自 GCS 的更改)同步。
|
||||
|
||||
同步很重要,因为参数可能随时被更改为另一个值。
|
||||
Your code should _always_ use the current value from the parameter store.
|
||||
If getting the latest version is not possible, then a reboot will be required after the parameter is changed (set this requirement using the `@reboot_required` metadata).
|
||||
|
||||
此外,C++ 版本有更好的类型安全和更小的 RAM 开销。
|
||||
缺点是参数名称必须在编译时知道,而 C 语言 API 可以将动态创建的名称作为字符串。
|
||||
|
||||
#### C++ API
|
||||
|
||||
The C++ API provides macros to declare parameters as _class attributes_.
|
||||
You add some "boilerplate" code to regularly listen for changes in the [uORB Topic](../middleware/uorb.md) associated with _any_ parameter update.
|
||||
框架代码然后 (在不可见的情况下) 处理追踪影响 uORB 消息,并保持参数属性和 uORB 消息同步。
|
||||
在代码的其余部分中,您只能使用定义的参数属性,它们将始终是最新的!
|
||||
|
||||
首先在您的模块或驱动程序的类头文件中包含所需的头文件:
|
||||
|
||||
- **px4_platform_common/module_params.h** to get the `DEFINE_PARAMETERS` macro:
|
||||
|
||||
```cpp
|
||||
#include <px4_platform_common/module_params.h>
|
||||
```
|
||||
|
||||
- **parameter_update.h** to access the uORB `parameter_update` message:
|
||||
|
||||
```cpp
|
||||
#include <uORB/topics/parameter_update.h>
|
||||
```
|
||||
|
||||
- **Subscription.hpp** for the uORB C++ subscription API:
|
||||
|
||||
```cpp
|
||||
#include <uORB/Subscription.hpp>
|
||||
```
|
||||
|
||||
Derive your class from `ModuleParams`, and use `DEFINE_PARAMETERS` to specify a list of parameters and their associated parameter attributes.
|
||||
参数的名称必须与其参数元数据定义相同。
|
||||
|
||||
```cpp
|
||||
class MyModule : ..., public ModuleParams
|
||||
{
|
||||
public:
|
||||
...
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Check for parameter changes and update them if needed.
|
||||
*/
|
||||
void parameters_update();
|
||||
|
||||
DEFINE_PARAMETERS(
|
||||
(ParamInt<px4::params::SYS_AUTOSTART>) _sys_autostart, /**< example parameter */
|
||||
(ParamFloat<px4::params::ATT_BIAS_MAX>) _att_bias_max /**< another parameter */
|
||||
)
|
||||
|
||||
// Subscriptions
|
||||
uORB::SubscriptionInterval _parameter_update_sub{ORB_ID(parameter_update), 1_s};
|
||||
|
||||
};
|
||||
```
|
||||
|
||||
使用模板更新 CPP 文件,以检查与参数更新相关的 uORB 消息。
|
||||
|
||||
Call `parameters_update();` periodically in code to check if there has been an update:
|
||||
|
||||
```cpp
|
||||
void Module::parameters_update()
|
||||
{
|
||||
if (_parameter_update_sub.updated()) {
|
||||
parameter_update_s param_update;
|
||||
_parameter_update_sub.copy(¶m_update);
|
||||
|
||||
// If any parameter updated, call updateParams() to check if
|
||||
// this class attributes need updating (and do so).
|
||||
updateParams();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
在上述方法中:
|
||||
|
||||
- `_parameter_update_sub.updated()` tells us if there is _any_ update to the `param_update` uORB message (but not what parameter is affected).
|
||||
- If there has been "some" parameter updated, we copy the update into a `parameter_update_s` (`param_update`), to clear the pending update.
|
||||
- Then we call `ModuleParams::updateParams()`.
|
||||
This "under the hood" updates all parameter attributes listed in our `DEFINE_PARAMETERS` list.
|
||||
|
||||
The parameter attributes (`_sys_autostart` and `_att_bias_max` in this case) can then be used to represent the parameters, and will be updated whenever the parameter value changes.
|
||||
|
||||
:::tip
|
||||
The [Application/Module Template](../modules/module_template.md) uses the new-style C++ API but does not include [parameter metadata](#parameter-metadata).
|
||||
:::
|
||||
|
||||
#### C API
|
||||
|
||||
C API 可以在模块和驱动程序中使用。
|
||||
|
||||
首先包括参数 API 头文件:
|
||||
|
||||
```C
|
||||
#include <parameters/param.h>
|
||||
```
|
||||
|
||||
Then retrieve the parameter and assign it to a variable (here `my_param`), as shown below for `PARAM_NAME`.
|
||||
The variable `my_param` can then be used in your module code.
|
||||
|
||||
```C
|
||||
int32_t my_param = 0;
|
||||
param_get(param_find("PARAM_NAME"), &my_param);
|
||||
```
|
||||
|
||||
:::info
|
||||
If `PARAM_NAME` was declared in parameter metadata then its default value will be set, and the above call to find the parameter should always succeed.
|
||||
:::
|
||||
|
||||
`param_find()` is an "expensive" operation, which returns a handle that can be used by `param_get()`.
|
||||
If you're going to read the parameter multiple times, you may cache the handle and use it in `param_get()` when needed
|
||||
|
||||
```cpp
|
||||
# Get the handle to the parameter
|
||||
param_t my_param_handle = PARAM_INVALID;
|
||||
my_param_handle = param_find("PARAM_NAME");
|
||||
|
||||
# Query the value of the parameter when needed
|
||||
int32_t my_param = 0;
|
||||
param_get(my_param_handle, &my_param);
|
||||
```
|
||||
|
||||
### 参数元数据
|
||||
|
||||
PX4 使用广泛的参数元数据系统来驱动面向用户的参数表示,并在固件中设置的每个参数的默认值。
|
||||
|
||||
:::tip
|
||||
Correct metadata is critical for good user experience in a ground station.
|
||||
:::
|
||||
|
||||
Parameter metadata can be stored anywhere in the source tree as either **.c** or **.yaml** parameter definitions (the YAML definition is newer, and more flexible).
|
||||
通常,它与关联的模块一起存储。
|
||||
|
||||
The build system extracts the metadata (using `make parameters_metadata`) to build the [parameter reference](../advanced_config/parameter_reference.md) and the parameter information [used by ground stations](#publishing-parameter-metadata-to-a-gcs).
|
||||
|
||||
:::warning
|
||||
After adding a _new_ parameter file you should call `make clean` before building to generate the new parameters (parameter files are added as part of the _cmake_ configure step, which happens for clean builds and if a cmake file is modified).
|
||||
:::
|
||||
|
||||
#### YAML 元数据
|
||||
|
||||
:::info
|
||||
At time of writing YAML parameter definitions cannot be used in _libraries_.
|
||||
:::
|
||||
|
||||
YAML meta data is intended as a full replacement for the **.c** definitions.
|
||||
它支持所有相同的元数据,以及多实例定义等新功能。
|
||||
|
||||
- The YAML parameter metadata schema is here: [validation/module_schema.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/validation/module_schema.yaml).
|
||||
- An example of YAML definitions being used can be found in the MAVLink parameter definitions: [/src/modules/mavlink/module.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/mavlink/module.yaml).
|
||||
- 通过添加到 cmake 构建系统中注册一个 YAML 文件
|
||||
|
||||
```cmake
|
||||
MODULE_CONFIG
|
||||
module.yaml
|
||||
```
|
||||
|
||||
to the `px4_add_module` section of the `CMakeLists.txt` file of that module.
|
||||
|
||||
#### 多实例(模块化)YAML 元数据
|
||||
|
||||
Templated parameter definitions are supported in [YAML parameter definitions](https://github.com/PX4/PX4-Autopilot/blob/main/validation/module_schema.yaml) (templated parameter code is not supported).
|
||||
|
||||
The YAML allows you to define instance numbers in parameter names, descriptions, etc. using `${i}`.
|
||||
例如,下面将生成 MY_PARAM_1_RATE、MY_PARAM_2_RATE 等。
|
||||
|
||||
```yaml
|
||||
MY_PARAM_${i}_RATE:
|
||||
description:
|
||||
short: Maximum rate for instance ${i}
|
||||
```
|
||||
|
||||
以下 YAML 定义提供起始和结束索引。
|
||||
|
||||
- `num_instances` (default 1): Number of instances to generate (>=1)
|
||||
- `instance_start` (default 0): First instance number. If 0, `${i}` expands to [0, N-1]\`.
|
||||
|
||||
For a full example see the MAVLink parameter definitions: [/src/modules/mavlink/module.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/mavlink/module.yaml)
|
||||
|
||||
#### c 参数元数据
|
||||
|
||||
The legacy approach for defining parameter metadata is in a file with extension **.c** (at time of writing this is the approach most commonly used in the source tree).
|
||||
|
||||
参数的元数据部分看起来像下面的例子:
|
||||
|
||||
```cpp
|
||||
/**
|
||||
* Pitch P gain
|
||||
*
|
||||
* Pitch proportional gain, i.e. desired angular speed in rad/s for error 1 rad.
|
||||
*
|
||||
* @unit 1/s
|
||||
* @min 0.0
|
||||
* @max 10
|
||||
* @decimal 2
|
||||
* @increment 0.0005
|
||||
* @reboot_required true
|
||||
* @group Multicopter Attitude Control
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(MC_PITCH_P, 6.5f);
|
||||
```
|
||||
|
||||
```cpp
|
||||
/**
|
||||
* Acceleration compensation based on GPS
|
||||
* velocity.
|
||||
*
|
||||
* @group Attitude Q estimator
|
||||
* @boolean
|
||||
*/
|
||||
PARAM_DEFINE_INT32(ATT_ACC_COMP, 1);
|
||||
```
|
||||
|
||||
The `PARAM_DEFINE_*` macro at the end specifies the type of parameter (`PARAM_DEFINE_FLOAT` or `PARAM_DEFINE_INT32`), the name of the parameter (which must match the name used in code), and the default value in firmware.
|
||||
|
||||
注释块中的行都是可选的,主要用于控制地面站内的显示和编辑选项。
|
||||
The purpose of each line is given below (for more detail see [module_schema.yaml](https://github.com/PX4/PX4-Autopilot/blob/main/validation/module_schema.yaml)).
|
||||
|
||||
```cpp
|
||||
/**
|
||||
* <title>
|
||||
*
|
||||
* <longer description, can be multi-line>
|
||||
*
|
||||
* @unit <the unit, e.g. m for meters>
|
||||
* @min <the minimum sane value. Can be overridden by the user>
|
||||
* @max <the maximum sane value. Can be overridden by the user>
|
||||
* @decimal <the minimum sane value. Can be overridden by the user>
|
||||
* @increment <the "ticks" in which this value will increment in the UI>
|
||||
* @reboot_required true <add this if changing the param requires a system restart.>
|
||||
* @boolean <add this for integer parameters that represent a boolean value>
|
||||
* @group <a title for parameters that form a group>
|
||||
*/
|
||||
```
|
||||
|
||||
## 发布参数的元数据到地面站
|
||||
|
||||
The parameter metadata JSON file is compiled into firmware (or hosted on the Internet), and made available to ground stations via the [MAVLink Component Metadata service](https://mavlink.io/en/services/component_information.html).
|
||||
这确保了元数据始终与载具上运行的代码保持最新。
|
||||
|
||||
This process is the same as for [events metadata](../concept/events_interface.md#publishing-event-metadata-to-a-gcs).
|
||||
For more information see [PX4 Metadata (Translation & Publication)](../advanced/px4_metadata.md)
|
||||
|
||||
## 更多信息
|
||||
|
||||
- [Finding/Updating Parameters](../advanced_config/parameters.md)
|
||||
- [Parameter Reference](../advanced_config/parameter_reference.md)
|
||||
- [Param implementation](https://github.com/PX4/PX4-Autopilot/blob/main/platforms/common/include/px4_platform_common/param.h#L129) (information on `.get()`, `.commit()`, and other methods)
|
||||
@@ -0,0 +1,89 @@
|
||||
# PX4 Metadata
|
||||
|
||||
PX4 使用并生成人类和机器可读的元数据:
|
||||
|
||||
- [参数](../advanced_config/parameters.md) 配置 PX4 的行为。
|
||||
- 一个参数由一个 ID 字符串表示,并映射到 PX4 中存储的一个值。
|
||||
- 相关的元数据包含对设置的描述,可能的取值,有关值如何呈现的信息 (比如位掩码)。
|
||||
- [Events](../concept/events_interface.md) 提供事件通知,例如失效保护的原因,电池低电量告警,校准结束等等。
|
||||
- 事件是由一个 id 表示,并且发送带有日志级别和一些参数。
|
||||
- 相关的元数据包括每个事件的消息、描述和参数列表 (包括它们的类型)。
|
||||
- [Actuators](../config/actuators.md) 配置自定义飞行器的特定几何形状,将执行器和电机绑定到飞控的输出,并测试执行器和电机响应。
|
||||
- 元数据包含所支持的飞行器几何形状信息,驱动输出列表,以及如何配置它们。
|
||||
- _QGroundControl_ 地面站使用该信息动态构建配置界面。
|
||||
|
||||
元数据和元数据翻译与外部系统共享,例如 QGroundControl 地面站,使其能够显示有关参数和事件的信息,并配置飞行器几何形状和执行器输出映射。
|
||||
|
||||
本节解释了您如何定义元数据并翻译成字符串 (以及"仅供您参考",它是如何工作的)。
|
||||
|
||||
## 元数据翻译
|
||||
|
||||
在 Crowdin 项目 [PX4-Metadata-Translations](https://crowdin.com/project/px4-metadata-translations) 中翻译 PX4 元数据。
|
||||
更多关于 PX4 和 Crowdin 信息请参阅[Translation](../contribute/translation.md)。
|
||||
|
||||
## 元数据定义
|
||||
|
||||
PX4 元数据是在 PX4 源代码及其相关数据中定义的。
|
||||
这可以通过在 C/C++ 注释中使用特殊标记来指示元数据字段及其值,或者使用 YAML 文件来完成。
|
||||
|
||||
更多信息请参阅每种数据类型的章节:
|
||||
|
||||
- [参数与配置> 创建/定义参数](../advanced/parameters_and_configurations.md#creating-defining-parameters)
|
||||
- [事件接口](../concept/events_interface.md)
|
||||
- [执行器元数据](#actuator-metadata)(下文)
|
||||
|
||||
## 元数据工具链
|
||||
|
||||
处理元数据的过程对所有元数据类型都是相同的。
|
||||
|
||||
每次构建 PX4 时,元数据都会被收集到 JSON 文件中。
|
||||
|
||||
对于大多数飞控(因为大多数都有足够的可用 FLASH 存储空间),JSON文件经过 xz 压缩并存储在生成的二进制文件中。
|
||||
然后使用 MAVLink [Component Metadata Protocol](https://mavlink.io/en/services/component_information.html)共享该文件。
|
||||
使用组件元数据协议确保接收者总是能够为运行在载具的代码获取最新元数据。
|
||||
事件元数据也会被添加到日志文件中,允许日志分析工具 (如飞行回放) 使用正确的元数据来显示事件。
|
||||
|
||||
内存受限的飞控二进制文件不会在二进制文件中存储参数元数据,而是引用存储在`px4-travis.s3.amazonaws.com`上的相同数据。
|
||||
例如,这适用于[Umnibus F4 SD](../flight_controller/omnibus_f4_sd.md)。
|
||||
元数据是通过 [github CI](https://github.com/PX4/PX4-Autopilot/blob/main/.github/workflows/metadata.yml) 上传的,用于所有构建目标(因此只有在参数被合并到主体后才能使用)。
|
||||
|
||||
:::info
|
||||
You can identify memory constrained boards because they specify `CONFIG_BOARD_CONSTRAINED_FLASH=y` in their [px4board definition file](https://github.com/PX4/PX4-Autopilot/blob/main/boards/omnibus/f4sd/default.px4board).
|
||||
|
||||
如果在 FLASH 受限板上进行自定义开发,您可以调整此处的 URL 以指向另一台服务器[here](https://github.com/PX4/PX4-Autopilot/blob/main/src/lib/component_information/CMakeLists.txt#L41)。
|
||||
:::
|
||||
|
||||
如果载具上没有显示参数元数据,则使用 `px4-travis.s3.amazonaws.com` 上的元数据。
|
||||
它也可以用作后退,以避免对低速遥测链接进行非常缓慢的下载。
|
||||
|
||||
用于 CI 构建 `main` 分支的元数据 JSON 文件也拷贝到了 github 仓库:[PX4/PX4-Metadata-Translations](https://github.com/PX4/PX4-Metadata-Translations/)。
|
||||
这与Crowdin集成,用于获取翻译,这些翻译存储在 [translated](https://github.com/PX4/PX4-Metadata-Translations/tree/main/translated) 文件夹中,每种语言都有 xz 压缩的翻译文件。
|
||||
这些是由载具的组件元数据引用的,并在需要时下载。
|
||||
有关更多信息,请参阅 [PX4-Metadata-Translations](https://github.com/PX4/PX4-Metadata-Translations/) 和 [Component Metadata Protocol > Translation](https://mavlink.io/en/services/component_information.html#translation)。
|
||||
|
||||
:::info
|
||||
主分支的参数 XML 文件通过 CI 复制到 QGC 源代码树中,并在没有通过组件元数据协议获取到元数据的情况下用作后备方案 (该方法早于组件元数据协议)。
|
||||
:::
|
||||
|
||||
### 元数据执行器
|
||||
|
||||
下面的图表显示了执行器元数据是如何从源代码中集成和如何被 QGroundControl 使用的:
|
||||
|
||||

|
||||
|
||||
<!-- Source: https://docs.google.com/drawings/d/1hMQmIijdFjr21rREcXj50qz0C1b47JW0OEa6p5P231k/edit -->
|
||||
|
||||
- **Left**: 元数据在不同模快的 `module.yml` 文件中定义。
|
||||
`control_allocator` 模块定义几何形状,而每个输出驱动程序则定义其通道集和配置参数。
|
||||
[schema file](https://github.com/PX4/PX4-Autopilot/blob/main/validation/module_schema.yaml) 描写了这些 yaml 文件的结构。
|
||||
- **Middle**: 在构建时间, 当前构建目标的所有已启用模块的 `module.yml` 文件都会被解析并变成一个驱动程序。 使用 [Tools/module_config/generate_actuators_metadata.py](https://github.com/PX4/PX4-Autopilot/blob/main/Tools/module_config/generate_actuators_metadata.py)脚本的文件。
|
||||
这里还有[schema file](https://github.com/mavlink/mavlink/blob/master/component_metadata/actuators.schema.json)。
|
||||
- **Right**: 运行时,QGroundControl 通过 MAVLink 组件元数据 API 请求 JSON 文件(上文已经描述)。
|
||||
|
||||
## 更多信息
|
||||
|
||||
- [参数和配置](../advanced/parameters_and_configurations.md)
|
||||
- [事件接口](../concept/events_interface.md)
|
||||
- [翻译](../contribute/translation.md)
|
||||
- [组件元数据协议](https://mavlink.io/en/services/component_information.html) (mavlink.io)
|
||||
- [PX4 元数据翻译](https://github.com/PX4/PX4-Metadata-Translations/) (Github)
|
||||
@@ -0,0 +1,105 @@
|
||||
# 在 Ubuntu 上安装英特尔 RealSense R200 的驱动程序
|
||||
|
||||
本教程旨在提供有关如何在 linux 环境中安装英特尔 RealSense R200 相机头的相机驱动程序的说明,以便可以通过机器人操作系统 ( ROS ) 访问收集到的图像。
|
||||
RealSense R200 相机头如下图所示:
|
||||
|
||||

|
||||
|
||||
驱动程序包的安装是在 Virtual Box 中作为虚拟机运行的 Ubuntu 操作系统 (OS) 上执行的。
|
||||
运行 Virtual Box 的宿主机、虚拟机的规格如下:
|
||||
|
||||
- 主机操作系统:Windows 8
|
||||
- 处理器:Intel(R) Core(TM) i7-4702MQ CPU @ 2.20GHz
|
||||
- Virtual Box:Oracle VM。 版本 5.0.14 r105127
|
||||
- 扩展:安装了 Virtual Box 的扩展包(用于 USB3.0 支持)
|
||||
- 客户机操作系统:Linux - Ubuntu 14.04.3 LTS
|
||||
|
||||
本教程按以下方式排序: 在第一部分中, 演示如何在 Virtual Box 中安装 Ubuntu 14.04 作为客户机系统。 第二部分会演示如何安装 ROS Indigo 和相机驱动程序。 常用短语解释如下:
|
||||
|
||||
- Virtual Box(VB):运行不同虚拟机的程序。 此处使用 Oracle 虚拟机。
|
||||
- Virtual Machine(VM):作为访客系统在虚拟框中运行的操作系统。 此处使用 Ubuntu。
|
||||
|
||||
## 在 Virtual Box 中安装 Ubuntu 14.04.3 LTS
|
||||
|
||||
- 创建一个新的虚拟机 (VM): Linux 64-Bit.
|
||||
- Download the iso file of Ubuntu 14.04.3 LTS: ([ubuntu-14.04.3-desktop-amd64.iso](https://ubuntu.com/download/desktop)).
|
||||
- Ubuntu 的安装:
|
||||
- 在安装过程中,保留以下两项:
|
||||
- 安装时下载更新
|
||||
- 安装此第三方软件
|
||||
- 安装完成后,您可能需要启用 Virtual Box 在整个桌面上显示 Ubuntu:
|
||||
- Start VM Ubuntu and login, Click on **Devices->Insert Guest Additions CD image** in the menu bar of the Virtual Box.
|
||||
- Click on **Run** and enter password on the windows that pop up in Ubuntu.
|
||||
- 等待安装完成,然后重新启动。
|
||||
现在,应该可以在整个桌面上显示 VM。
|
||||
- 如果 ubuntu 中弹出一个窗口, 询问是否更新, 请在此时拒绝更新。
|
||||
- 在 Virtual Box 中启用 USB 3 控制器:
|
||||
- 关闭虚拟机。
|
||||
- 转到 "虚拟机" 的设置到菜单选择 USB,然后选择: "USB 3.0(xHCI)"。
|
||||
只有在安装了虚拟框的扩展包时, 才有可能执行此操作。
|
||||
- 再次启动虚拟机。
|
||||
|
||||
## 安装 ROS Indigo
|
||||
|
||||
- Follow instructions given at [ROS indigo installation guide](http://wiki.ros.org/indigo/Installation/Ubuntu):
|
||||
- 安装桌面完整版。
|
||||
- 执行 "初始化 rosdep" 和 "环境设置" 部分中描述的步骤。
|
||||
|
||||
## 安装摄像头驱动
|
||||
|
||||
- 安装 Git
|
||||
|
||||
```sh
|
||||
sudo apt-get install git
|
||||
```
|
||||
|
||||
- 下载并安装驱动:
|
||||
|
||||
- Clone [RealSense_ROS repository](https://github.com/bestmodule/RealSense_ROS):
|
||||
|
||||
```sh
|
||||
git clone https://github.com/bestmodule/RealSense_ROS.git
|
||||
```
|
||||
|
||||
- Follow instructions given in [here](https://github.com/bestmodule/RealSense_ROS/tree/master/r200_install).
|
||||
|
||||
- 无论要不要安装如下包都敲击回车:
|
||||
|
||||
```sh
|
||||
Intel Low Power Subsystem support in ACPI mode (MFD_INTEL_LPSS_ACPI) [N/m/y/?] (NEW)
|
||||
```
|
||||
|
||||
```sh
|
||||
Intel Low Power Subsystem support in PCI mode (MFD_INTEL_LPSS_PCI) [N/m/y/?] (NEW)
|
||||
```
|
||||
|
||||
```sh
|
||||
Dell Airplane Mode Switch driver (DELL_RBTN) [N/m/y/?] (NEW)
|
||||
```
|
||||
|
||||
- 进程安装结束时如下错误信息会出现,但不应该导致驱动故障:
|
||||
|
||||
```sh
|
||||
rmmod: ERROR: Module uvcvideo is not currently loaded
|
||||
```
|
||||
|
||||
- 安装结束后,重启虚拟机。
|
||||
|
||||
- 测试摄像头驱动:
|
||||
|
||||
- 使用 USB 线缆,一头连接电脑的 USB3 接口,另一端连接 Intel RealSense 相机。
|
||||
- Click on Devices->USB-> Intel Corp Intel RealSense 3D Camera R200 in the menu bar of the Virtual Box, in order to forward the camera USB connection to the Virtual Machine.
|
||||
- 执行文件 [unpacked folder]/bin/dsreadcamerainfo:
|
||||
|
||||
- 如果出现以下错误消息,请拔下相机 (从计算机物理上拔下 usb 电缆)。 Plug it in again + Click on Devices->USB-> Intel Corp Intel RealSense 3D Camera R200 in the menu bar of the Virtual Box again and execute again the file [unpacked folder]/Bin/DSReadCameraInfo.
|
||||
|
||||
```sh
|
||||
DSAPI call failed at ReadCameraInfo.cpp:134!
|
||||
```
|
||||
|
||||
- 如果相机驱动程序工作正常并识别 Intel RealSense R200,您应该看到有关 Intel RealSense R200 相机头的特定信息。
|
||||
|
||||
- ROS 节点的安装和测试:
|
||||
- Follow the installation instructions in the "Installation" section given [here](https://github.com/bestmodule/RealSense_ROS/blob/master/realsense_dist/2.3/doc/RealSense-ROS-R200-nodelet.md), to install the ROS nodlet.
|
||||
- Follow the instructions in the "Running the R200 nodelet" section given [here](https://github.com/bestmodule/RealSense_ROS/blob/master/realsense_dist/2.3/doc/RealSense-ROS-R200-nodelet.md), to test the ROS nodlet together with the Intel RealSense R200 camera head.
|
||||
- 如果一切正常,Intel RealSense R200 相机中的不同数据流将作为 ROS 主题发布。
|
||||
@@ -0,0 +1,101 @@
|
||||
# RTK GPS (PX4 集成)
|
||||
|
||||
[Real Time Kinematic](https://en.wikipedia.org/wiki/Real_Time_Kinematic) (RTK) provides centimeter-level GPS accuracy.
|
||||
这一章节将介绍 RTK 是如何集成到 PX4 中的。
|
||||
|
||||
:::tip
|
||||
Instructions for _using_ RTK GNSS are provided in [Hardware > RTK GPS](../gps_compass/rtk_gps.md).
|
||||
:::
|
||||
|
||||
## 综述
|
||||
|
||||
RTK是使用导航信号的载波相位来进行测距的,而不是使用导航信号所搭载的信息。
|
||||
它依靠一个单一的参考基站站实时校正,这种校正可以与多个流动站一起工作。
|
||||
|
||||
PX4 配置 RTK 需要两个 RTK GPS 模块和一个数传。
|
||||
The fixed-position ground-based GPS unit is called the _Base_ and the in-air unit is called the _Rover_.
|
||||
The Base unit connects to _QGroundControl_ (via USB) and uses the datalink to stream RTCM corrections to the vehicle (using the MAVLink [GPS_RTCM_DATA](https://mavlink.io/en/messages/common.html#GPS_RTCM_DATA) message).
|
||||
在自驾仪上,MAVLink消息包被解包得到RTCM的修正信息,并把这些信息发送给移动站,移动站结合修正信息最终解算得到 RTK 解。
|
||||
|
||||
The datalink should typically be able to handle an uplink rate of 300 bytes per second (see the [Uplink Datarate](#uplink-datarate) section below for more information).
|
||||
|
||||
## 支持的 RTK GPS 模块
|
||||
|
||||
The list of devices that we have tested can be found [in the user guide](../gps_compass/rtk_gps.md#supported-devices).
|
||||
|
||||
:::info
|
||||
Most devices come with two variants, a base and a rover.
|
||||
确保选择正确的变体。
|
||||
:::
|
||||
|
||||
## 自动配置
|
||||
|
||||
The PX4 GPS stack automatically sets up the GPS modules to send and receive the correct messages over the UART or USB, depending on where the module is connected (to _QGroundControl_ or the autopilot).
|
||||
|
||||
As soon as the autopilot receives `GPS_RTCM_DATA` MAVLink messages, it automatically forwards the RTCM data to the attached GPS module over existing data channels (a dedicated channel for correction data is not required).
|
||||
|
||||
:::info
|
||||
The u-blox U-Center RTK module configuration tool is not needed/used!
|
||||
:::
|
||||
|
||||
:::info
|
||||
Both _QGroundControl_ and the autopilot firmware share the same [PX4 GPS driver stack](https://github.com/PX4/GpsDrivers).
|
||||
实际上,这意味着只需要将新协议和/或消息添加到一个地方。
|
||||
:::
|
||||
|
||||
### RTCM 报文
|
||||
|
||||
QGroundControl 配置RTK 基地站输出以下 RTCM3.2 帧, 每个帧均为 1 Hz, 除非另有说明:
|
||||
|
||||
- **1005** - Station coordinates XYZ for antenna reference point (Base position), 0.2 Hz.
|
||||
- **1077** - Full GPS pseudo-ranges, carrier phases, Doppler and signal strength (high resolution).
|
||||
- **1087** - Full GLONASS pseudo-ranges, carrier phases, Doppler and signal strength (high resolution).
|
||||
- **1230** - GLONASS code-phase biases.
|
||||
- **1097** - Full Galileo pseudo-ranges, carrier phases, Doppler and signal strength (high resolution)
|
||||
- **1127** - Full BeiDou pseudo-ranges, carrier phases, Doppler and signal strength (high resolution)
|
||||
|
||||
## 上行数据速率
|
||||
|
||||
The raw RTCM messages from the base are packed into a MAVLink `GPS_RTCM_DATA` message and sent over the datalink.
|
||||
MAVLink 消息的最大长度是182字节。 根据RTCM的信息类型,MAVLink信息是不会填满的。
|
||||
|
||||
RTCM 基础位置消息(1005)长度为 22 字节, 而其他卫星的长度则因可见卫星的数量和卫星信号的数量而异(M8P等L1单元只有一个)。
|
||||
Since at a given time, the _maximum_ number of satellites visible from any single constellation is 12, under real-world conditions, theoretically an uplink rate of 300 B/s is sufficient.
|
||||
|
||||
If _MAVLink 1_ is used, a 182-byte `GPS_RTCM_DATA` message is sent for every RTCM message, irrespective of its length.
|
||||
因此,大约每秒上行需求是700多个字节。
|
||||
这可能导致低带宽半双轨遥测模块 (如3DR Telemetry Radios) 连接的饱和。
|
||||
|
||||
If _MAVLink 2_ is used then any empty space in the `GPS_RTCM_DATA message` is removed.
|
||||
由此产生的上行链路需求与理论值 (约 300 字节/秒) 大致相同。
|
||||
|
||||
:::tip
|
||||
PX4 automatically switches to MAVLink 2 if the GCS and telemetry modules support it.
|
||||
:::
|
||||
|
||||
MAVLink 2 必须用于低带宽链接以保证 RTK 性能。 必须注意确保数传链在整个过程中使用 MAVLink 2。
|
||||
You can verify the protocol version by using the `mavlink status` command on the system console:
|
||||
|
||||
```sh
|
||||
nsh> mavlink status
|
||||
instance #0:
|
||||
GCS heartbeat: 593486 us ago
|
||||
mavlink chan: #0
|
||||
type: 3DR RADIO
|
||||
rssi: 219
|
||||
remote rssi: 219
|
||||
txbuf: 94
|
||||
noise: 61
|
||||
remote noise: 58
|
||||
rx errors: 0
|
||||
fixed: 0
|
||||
flow control: ON
|
||||
rates:
|
||||
tx: 1.285 kB/s
|
||||
txerr: 0.000 kB/s
|
||||
rx: 0.021 kB/s
|
||||
rate mult: 0.366
|
||||
accepting commands: YES
|
||||
MAVLink version: 2
|
||||
transport protocol: serial (/dev/ttyS1 @57600)
|
||||
```
|
||||
@@ -0,0 +1,48 @@
|
||||
# 切换状态估计器
|
||||
|
||||
此页显示了可用的状态估计器以及如何在它们之间切换。
|
||||
|
||||
:::tip
|
||||
EKF2 is the default and should be used unless you have a reason not to (in particular on vehicles with a GNSS/GPS).
|
||||
The Q-Estimator can be used if you don't have GPS, and is commonly used in [multicopter racers](../config_mc/racer_setup.md).
|
||||
:::
|
||||
|
||||
## 可用的估计器
|
||||
|
||||
可用的估计器如下:
|
||||
|
||||
- **EKF2 attitude, position and wind states estimator** (_recommended_) - An extended Kalman filter estimating attitude, 3D position / velocity and wind states.
|
||||
|
||||
- **LPE position estimator** (_deprecated_) - An extended Kalman filter for 3D position and velocity states.
|
||||
|
||||
:::warning
|
||||
LPE is deprecated.
|
||||
(在开发 PX4 v1.14时)它是工作的,但是不再支持或维护。
|
||||
|
||||
:::
|
||||
|
||||
- **Q attitude estimator** - A very simple, quaternion based complementary filter for attitude.
|
||||
它不需要 GPS、磁力计或气压计。
|
||||
<!-- Q estimator is supported (at time of writing in PX4 v1.14). Test added in PX4-Autopilot/pull/21922 -->
|
||||
|
||||
## 如何启用不同的估计器
|
||||
|
||||
<!-- Changed in https://github.com/PX4/PX4-Autopilot/pull/22567 after v1.14 -->
|
||||
|
||||
要启用特定的估算器,请启用其参数并禁用其他参数:
|
||||
|
||||
- [EKF2_EN](../advanced_config/parameter_reference.md#EKF2_EN) - EKF2 (default/recommended)
|
||||
- [ATT_EN](../advanced_config/parameter_reference.md#ATT_EN) - Q Estimator (quaternion based attitude estimator)
|
||||
- [LPE_EN](../advanced_config/parameter_reference.md#LPE_EN) - LPE (not supported for Fixed-wing)
|
||||
|
||||
:::warning
|
||||
It is important to enable one, and only one, estimator.
|
||||
If more than one is enabled, the first to publish the UOrb topics [vehicle_attitude](../msg_docs/VehicleAttitude.md) or [vehicle_local_position](../msg_docs/VehicleLocalPosition.md) is used.
|
||||
如果没有启用,主题将不发布。
|
||||
:::
|
||||
|
||||
:::info
|
||||
For FMU-v2 (only) you will also need to build PX4 to specifically include required estimator (e.g. EKF2: `make px4_fmu-v2`, LPE: `make px4_fmu-v2_lpe`).
|
||||
这是因为 FMU-v2 不具有足够的资源同时包含这两个估计器。
|
||||
其他的 Pixhawk FMU 版本同时拥有两个估计器。
|
||||
:::
|
||||
@@ -0,0 +1,92 @@
|
||||
# 系统通知提示音
|
||||
|
||||
PX4 defines a number of [standard tones/tunes](../getting_started/tunes.md) that are used to provide audio notification for important system states and problems (e.g. system startup, arming success, battery warnings, etc.)
|
||||
|
||||
Tunes are specified using strings (in [ANSI Music notation](http://artscene.textfiles.com/ansimusic/information/ansimtech.txt)) and played by code using the [tunes](https://github.com/PX4/PX4-Autopilot/tree/main/src/lib/tunes) library.
|
||||
The tunes library also contains the list of default system tunes - see [lib/tunes/tune_definition.desc](https://github.com/PX4/PX4-Autopilot/blob/main/src/lib/tunes/tune_definition.desc).
|
||||
|
||||
PX4 还有一个模块可以用于播放(测试)默认或用户自定义音乐。
|
||||
|
||||
本主题提供了如何创建您自己的声音并添加/替换系统通知音调/乐曲的通用指导。
|
||||
|
||||
## 创建乐曲
|
||||
|
||||
Tune strings are defined using [ANSI Music notation](http://artscene.textfiles.com/ansimusic/information/ansimtech.txt).
|
||||
|
||||
:::tip
|
||||
More information about the format can be found in [QBasic PLAY statement](https://en.wikibooks.org/wiki/QBasic/Appendix#PLAY) (Wikibooks) and has been reproduced in [tune_definition.desc](https://github.com/PX4/PX4-Autopilot/blob/main/src/lib/tunes/tune_definition.desc).
|
||||
:::
|
||||
|
||||
创建新调节的最简单方式是使用音乐编辑器。
|
||||
这允许您编辑音乐并在您的电脑上播放, 然后导出为 PX4 可以播放的格式。
|
||||
|
||||
ANSI 音乐在 ANSI BBS 系统中很受欢迎,因此最好的编辑工具是 DOS 实用程序。
|
||||
On Windows, one option is to use _Melody Master_ within _Dosbox_.
|
||||
|
||||
使用软件的步骤是:
|
||||
|
||||
1. Download [DosBox](http://www.dosbox.com/) and install the app
|
||||
|
||||
2. Download [Melody Master](ftp://archives.thebbs.org/ansi_utilities/melody21.zip) and unzip into a new directory
|
||||
|
||||
3. Open the _Dosbox_ console
|
||||
|
||||
4. 将 Melody 主目录挂载到 DosBox,如下:
|
||||
|
||||
```sh
|
||||
mount c C:\<path_to_directory\Melody21
|
||||
```
|
||||
|
||||
5. Start _Melody Master_ with the following commands
|
||||
|
||||
```sh
|
||||
c:
|
||||
start
|
||||
```
|
||||
|
||||
6. You will then have the option to click through a few screens, then press **1** to display _Melody Master_:
|
||||

|
||||
|
||||
屏幕的下半部分提供了关于键盘快捷键的实用工具(箭头用于移动, 和选择笔记长度的数字等)。
|
||||
|
||||
7. 当您准备好时保存音乐:
|
||||
- Press **F2** to give the tune a name and save it in the _/Music_ sub folder of your Melody Master installation.
|
||||
- Press **F7**, the scroll down the list of output formats on the right to get to ANSI.
|
||||
The file will be exported to the _root_ of the Melody Master directory (with the same name and a file-type specific extension).
|
||||
|
||||
8. 打开文件。
|
||||
输出可能看起来像这样:
|
||||
|
||||

|
||||
|
||||
9. The string that can be played in PX4 is the bit between `MNT` and `P64`: `150L1O3DL16CL32<B>C<AEL16A`
|
||||
|
||||
## 测试乐曲
|
||||
|
||||
When you're ready to try it out a new tune on PX4, use the [tune_control](../modules/modules_system.md#tune-control) library.
|
||||
For example, to test the tune we "created" above you would enter the following command on a console or shell (e.g. the [MAVLink Shell](../debug/mavlink_shell.md)):
|
||||
|
||||
```sh
|
||||
tune_control play -m "150L1O3DL16CL32<B>C<AEL16A"
|
||||
```
|
||||
|
||||
:::info
|
||||
Out of the box, the `tune_control` is only present on real hardware (not the simulator).
|
||||
:::
|
||||
|
||||
## 正在替换已存在的乐曲
|
||||
|
||||
Tunes are defined within [tune_definition.desc](https://github.com/PX4/PX4-Autopilot/blob/main/src/lib/tunes/tune_definition.desc).
|
||||
|
||||
If you just need to replace an existing tune, then you can replace the file in your own fork, and update the tune strings defined in `PX4_DEFINE_TUNE`.
|
||||
|
||||
## 添加新乐曲
|
||||
|
||||
待开发
|
||||
|
||||
<!--
|
||||
|
||||
1. Assumption is that you need to define a new `PX4_DEFINE_TUNE` with its own number in the file.
|
||||
2. Need to look at how tunes are played. Problem for another day.
|
||||
|
||||
-->
|
||||
Reference in New Issue
Block a user