Files
PX4-Autopilot/docs/zh/concept/control_allocation.md
Crowdin Bot 588fd9d684
Some checks failed
Build all targets / Scan for Board Targets (push) Has been cancelled
Build all targets / Build Group [${{ matrix.group }}][${{ matrix.arch == 'nuttx' && 'x86' || 'arm64' }}] (push) Has been cancelled
Build all targets / Upload Artifacts to S3 (push) Has been cancelled
Build all targets / Create Release and Upload Artifacts (push) Has been cancelled
Checks / build (NO_NINJA_BUILD=1 px4_fmu-v5_default) (push) Has been cancelled
Checks / build (NO_NINJA_BUILD=1 px4_sitl_default) (push) Has been cancelled
Checks / build (check_format) (push) Has been cancelled
Checks / build (check_newlines) (push) Has been cancelled
Checks / build (module_documentation) (push) Has been cancelled
Checks / build (px4_fmu-v2_default stack_check) (push) Has been cancelled
Checks / build (px4_sitl_allyes) (push) Has been cancelled
Checks / build (shellcheck_all) (push) Has been cancelled
Checks / build (tests) (push) Has been cancelled
Checks / build (tests_coverage) (push) Has been cancelled
Checks / build (validate_module_configs) (push) Has been cancelled
Clang Tidy / build (push) Has been cancelled
MacOS build / build (px4_fmu-v5_default) (push) Has been cancelled
MacOS build / build (px4_sitl) (push) Has been cancelled
Ubuntu environment build / Build and Test (ubuntu:22.04) (push) Has been cancelled
Ubuntu environment build / Build and Test (ubuntu:24.04) (push) Has been cancelled
Container build / Set Tags and Variables (push) Has been cancelled
Container build / Build Container (amd64) (push) Has been cancelled
Container build / Build Container (arm64) (push) Has been cancelled
Container build / Deploy To Registry (push) Has been cancelled
EKF Update Change Indicator / unit_tests (push) Has been cancelled
Failsafe Simulator Build / build (failsafe_web) (push) Has been cancelled
FLASH usage analysis / Analyzing px4_fmu-v5x (push) Has been cancelled
FLASH usage analysis / Analyzing px4_fmu-v6x (push) Has been cancelled
FLASH usage analysis / Publish Results (push) Has been cancelled
ITCM check / Checking nxp_tropic-community (push) Has been cancelled
ITCM check / Checking px4_fmu-v5x (push) Has been cancelled
ITCM check / Checking px4_fmu-v6xrt (push) Has been cancelled
MAVROS Mission Tests / build (map[mission:MC_mission_box vehicle:iris]) (push) Has been cancelled
MAVROS Mission Tests / build (map[mission:rover_mission_1 vehicle:rover]) (push) Has been cancelled
MAVROS Offboard Tests / build (map[test_file:mavros_posix_tests_offboard_posctl.test vehicle:iris]) (push) Has been cancelled
Nuttx Target with extra env config / build (px4_fmu-v5_default) (push) Has been cancelled
Python CI Checks / build (push) Has been cancelled
ROS Integration Tests / build (push) Has been cancelled
ROS Translation Node Tests / Build and test (map[ros_version:humble ubuntu:jammy]) (push) Has been cancelled
ROS Translation Node Tests / Build and test (map[ros_version:jazzy ubuntu:noble]) (push) Has been cancelled
SITL Tests / Testing PX4 tailsitter (push) Has been cancelled
SITL Tests / Testing PX4 iris (push) Has been cancelled
SITL Tests / Testing PX4 standard_vtol (push) Has been cancelled
ClusterFuzzLite batch fuzzing / BatchFuzzing (address) (push) Has been cancelled
ClusterFuzzLite batch fuzzing / BatchFuzzing (memory) (push) Has been cancelled
ClusterFuzzLite batch fuzzing / BatchFuzzing (undefined) (push) Has been cancelled
New Crowdin translations - zh-CN
2025-07-07 09:04:54 +10:00

4.9 KiB
Raw Blame History

控制分配 (混控)

:::info Control allocation replaces the legacy mixing approach used in PX4 v1.13 and earlier. For PX4 v1.13 documentation see: Mixing & Actuators, Geometry Files and Adding a New Airframe Configuration. :::

PX4从核心控制器获取所需的扭矩和推力指令并将它们转换为控制电机或作动器的驱动指令。

指令间的转换取决于飞行器的物理构型。 例如,给“向右转”需要给出一个扭矩指令:

  • 对于每个副翼都有一个舵机的飞机来说,该指令将会控制一个舵机向高处偏转,另一个向低处偏转。
  • 多旋翼将会通过改变所有电机的转速来向右偏航。

PX4将这个转换逻辑区分开这个逻辑被称为从姿态/角速率控制器输出的“混控”。 这样可以确保核心控制器不需要对每个机型构型进行特殊处理,可以大大提高复用性。

此外PX4还将输出函数映射至指定的硬件输出。 这也意味着任何电机或舵机可以分配给几乎任何物理输出。

Mixing Overview

作动器控制流程

模块和uORB话题混控流程概览点击全屏查看

Pipeline Overview

备注:

  • 角速率控制器输出力矩和推力设定值
  • the control_allocator module:
    • 根据配置参数处理不同飞行器构型
    • 进行混控计算
    • 处理电机失效
    • 发布电机和作动器控制信号
    • publishes the servo trims separately so they can be added as an offset when testing actuators (using the test sliders).
  • 输出驱动:
    • 处理硬件初始化和更新
    • use a shared library src/libs/mixer_module. The driver defines a parameter prefix, e.g. PWM_MAIN that the library then uses for configuration. Its main task is to select from the input topics and assign the right data to the outputs based on the user set <param_prefix>_FUNCx parameter values. For example if PWM_MAIN_FUNC3 is set to Motor 2, the 3rd output is set to the 2nd motor from actuator_motors.
    • output functions are defined under src/lib/mixer_module/output_functions.yaml.
  • if you want to control an output from MAVLink, set the relevant output function to Offboard Actuator Set x, and then send the MAV_CMD_DO_SET_ACTUATOR MAVLink command.

添加新构型或输出函数

See this commit for how to add a new geometry. The QGC UI will then automatically show the right configuration UI when CA_AIRFRAME is set to the new geometry.

This commit shows how to add a new output function. Any uORB topic can be subscribed and assigned to a function.

Note that parameters for control allocation are defined in src/modules/control_allocator/module.yaml The schema for this file is here (in particular, search for the key mixer:

设置默认机型构型

When adding a new frame configuration, set the appropriate CA_AIRFRAME and other default mixer values for the geometry.

You can see this, for example, in the airframe configuration file 13200_generic_vtol_tailsitter

...
param set-default CA_AIRFRAME 4
param set-default CA_ROTOR_COUNT 2
param set-default CA_ROTOR0_KM -0.05
param set-default CA_ROTOR0_PY 0.2
...

设置构型和输出

The broad geometry and default parameters for a vehicle are set (from the frame configuration file) when selecting the airframe in QGroundControl: Basic Configuration > Airframe.

The geometry parameters and output mapping for the specific frame and flight controller hardware are then configured using the QGroundControl Actuators setup screen: Basic Configuration > Actuator Configuration and Testing.