# 飞行控制器移植指南

本主题主要针对希望将 PX4 移植到 飞控硬件平台上的开发人员。

# PX4 架构

PX4 consists of two main layers: The board support and middleware layer on top of the host OS (NuttX, Linux or any other POSIX platform like Mac OS), and the applications (Flight Stack in src/modules (opens new window)). 更多有关详细信息请参阅: PX4 系统架构概述

本指南仅关注主机操作系统和中间件,因为 应用层/飞行控制栈 可以在任何目标平台上运行。

# 飞行控制器配置文件分布位置

Board startup and configuration files are located under /boards (opens new window) in each board's vendor-specific directory (i.e. boards/VENDOR/MODEL/)).

例如,对于 FMUv5 飞控硬件平台:

  • (All) Board-specific files: /boards/px4/fmu-v5 (opens new window).
  • Build configuration: /boards/px4/fmu-v5/default.px4board (opens new window).
  • Board-specific initialisation file: /boards/px4/fmu-v5/init/rc.board_defaults (opens new window)
    • 如果在飞控板平台目录下可以找到 init/rc.board 文件,则针对该飞控板平台的初始化文件将会自动包含在启动脚本中。
    • 该文件用于启动仅存在于特定主板上的传感器 (和其他东西)。 The file is used to start sensors (and other things) that only exist on a particular board. It may also be used to set a board's default parameters, UART mappings, and any other special cases.
    • For FMUv5 you can see all the Pixhawk 4 sensors being started, and it also sets a larger LOGGER_BUF, and in AUTOCNF section (fresh setups) it sets the SYS_FMU_TASK parameter.

# 主机操作系统配置

本节介绍了移植每个受支持的主机操作系统到新的飞控板硬件平台上需要用到的配置文件的用途和所处位置。

# NuttX

See NuttX Board Porting Guide.

# Linux

基于 Linux 的飞控板不包含任何 操作系统和内核的配置。 Linux boards do not include the OS and kernel configuration. These are already provided by the Linux image available for the board (which needs to support the inertial sensors out of the box).

# 中间件组件和配置

本节介绍各类中间件组件,以及将它们移植到新的飞行控制器硬件所需更新的配置文件。

# QuRT / Hexagon

# RC UART 接线建议

It is generally recommended to connect RC via separate RX and TX pins to the microcontroller. If however RX and TX are connected together, the UART has to be put into singlewire mode to prevent any contention. This is done via board config and manifest files. One example is px4fmu-v5 (opens new window). 如果 RX 和 TX 连在了一起,那么 UART 需要设置为单线模式以防止出现争用。 这可以用过对飞控板的配置文件和 manifest 文件进行更改来实现。 One example is px4fmu-v5 (opens new window).

# 官方支持的硬件

PX4 项目支持并维护着 FMU 标准参考硬件 及任何与标准相兼容的飞控板平台。 This includes the Pixhawk-series (see the user guide for a full list of officially supported hardware).

每个受官方支持的飞控板平台都将受益于:

  • PX4 项目仓库中可用的 PX4 移植
  • 可从 QGroundControl 中直接访问的自动固件编译
  • 与生态系统其余部分的兼容性
  • 可通过 CI 进行自动检查 — 安全仍是这个社区的重中之重
  • 飞行测试

我们鼓励飞控板制造商以与 FMU 规格 (opens new window) 完全兼容为目标进行生产。 We encourage board manufacturers to aim for full compatibility with the FMU spec (opens new window). With full compatibility you benefit from the ongoing day-to-day development of PX4, but have none of the maintenance costs that come from supporting deviations from the specification.

提示

Manufacturers should carefully consider the cost of maintenance before deviating from the specification (the cost to the manufacturer is proportional to the level of divergence).

We welcome any individual or company to submit their port for inclusion in our supported hardware, provided they are willing to follow our Code of Conduct (opens new window) and work with the Dev Team to provide a safe and fulfilling PX4 experience to their customers.

如果你想让你的飞控板被 PX4 项目正式支持:

If you want to have your board officially supported in PX4:

  • 你的硬件必须在市场上可用(例如它可以被任何开发人员不受限制地购买到) 。
  • Hardware must be made available to the PX4 Dev Team so that they can validate the port (contact lorenz@px4.io for guidance on where to ship hardware for testing).
  • 飞控板必须通过完整的 测试套件(test suite)飞行测试

The PX4 project reserves the right to refuse acceptance of new ports (or remove current ports) for failure to meet the requirements set by the project.

You can reach out to the core developer team and community on the official support channels.

# 相关信息