mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 12:48:53 +08:00
docs(updates): Link fixes and orphan image removals (#26925)
* docs(updates): Link fixes and orphan image removals * docs(delete): Remove orphaned translations
This commit is contained in:
@@ -1,86 +0,0 @@
|
||||
# Neural Network Module: System Integration
|
||||
|
||||
The neural control module ([mc_nn_control](../modules/modules_controller.md#mc-nn-control)) implements an end-to-end controller utilizing neural networks.
|
||||
|
||||
The parts of the module directly concerned with generating the code for the trained neural network and integrating it into the module are covered in [TensorFlow Lite Micro (TFLM)](../advanced/tflm.md).
|
||||
This page covers the changes that were made to integrate the module into PX4, both within the module, and in larger system configuration.
|
||||
|
||||
:::tip
|
||||
This topic should help you to shape the module to your own needs.
|
||||
|
||||
You will need some familiarity with PX4 development.
|
||||
For more information see the developer [Getting Started](../dev_setup/getting_started.md).
|
||||
:::
|
||||
|
||||
## Autostart
|
||||
|
||||
A line to autostart the [mc_nn_control](../modules/modules_controller.md#mc-nn-control) module has been added in the [`ROMFS/px4fmu_common/init.d/rc.mc_apps`](https://github.com/PX4/PX4-Autopilot/blob/main/ROMFS/px4fmu_common/init.d/rc.mc_apps) startup script.
|
||||
|
||||
It checks whether the module is included by looking for the parameter [MC_NN_EN](../advanced_config/parameter_reference.md#MC_NN_EN).
|
||||
If this is set to `1` (the default value), the module will be started when booting PX4.
|
||||
Similarly you could create other parameters in the [`mc_nn_control_params.c`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/mc_nn_control/mc_nn_control_params.c) file for other startup script checks.
|
||||
|
||||
## Custom Flight Mode
|
||||
|
||||
The module creates its own flight mode "Neural Control" which lets you choose it from the flight mode menu in QGC and bind it to a switch on you RC controller.
|
||||
This is done by using the [ROS 2 Interface Library](../ros2/px4_ros2_interface_lib.md) internally.
|
||||
This involves several steps and is visualized here:
|
||||
|
||||
:::info
|
||||
The module does not actually use ROS 2, it just uses the API exposed through uORB topics.
|
||||
:::
|
||||
|
||||
:::info
|
||||
In some QGC versions the flight mode does not show up, so make sure to update to the newest version.
|
||||
This only works for some flight controllers, so you might have to use an RC controller to switch to the correct external flight mode.
|
||||
:::
|
||||
|
||||

|
||||
|
||||
1. Publish a [RegisterExtComponentRequest](../msg_docs/RegisterExtComponentRequest.md).
|
||||
This specifies what you want to create, you can read more about this in the [Control Interface](../ros2/px4_ros2_control_interface.md).
|
||||
In this case we register an arming check and a mode.
|
||||
2. Wait for a [RegisterExtComponentReply](../msg_docs/RegisterExtComponentReply.md).
|
||||
This will give feedback on wether the mode registration was successful, and what the mode and arming check id is for the new mode.
|
||||
3. [Optional] With the mode id, publish a [VehicleControlMode](../msg_docs/VehicleControlMode.md) message on the `config_control_setpoints` topic.
|
||||
Here you can configure what other modules run in parallel.
|
||||
The example controller replaces everything, so it turns off allocation.
|
||||
If you want to replace other parts you can enable or disable the modules accordingly.
|
||||
4. [Optional] With the mode id, publish a [ConfigOverrides](../msg_docs/ConfigOverrides.md) on the `config_overrides_request` topic.
|
||||
(This is not done in the example module) This will let you defer failsafes or stop it from automatically disarming.
|
||||
5. When the mode has been registered a [ArmingCheckRequest](../msg_docs/ArmingCheckRequest.md) will be sent, asking if your mode has everything it needs to run.
|
||||
This message must be answered with a [ArmingCheckReply](../msg_docs/ArmingCheckReply.md) so the mode is not flagged as unresponsive.
|
||||
In this response it is possible to set what requirements the mode needs to run, like local position.
|
||||
If any of these requirements are set the commander will stop you from switching to the mode if they are not fulfilled.
|
||||
It is also important to set health_component_index and num_events to 0 to not get a segmentation fault.
|
||||
Unless you have a health component or events.
|
||||
6. Listen to the [VehicleStatus](../msg_docs/VehicleStatus.md) topic.
|
||||
If the nav_state equals the assigned `mode_id`, then the Neural Controller is activated.
|
||||
7. When active the module will run the controller and publish to [ActuatorMotors](../msg_docs/ActuatorMotors.md).
|
||||
If you want to replace a different part of the controller, you should find the appropriate topic to publish to.
|
||||
|
||||
To see how the requests are handled you can check out [src/modules/commander/ModeManagement.cpp](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/commander/ModeManagement.cpp).
|
||||
|
||||
## 日志
|
||||
|
||||
To add module-specific logging a new topic has been added to [uORB](../middleware/uorb.md) called [NeuralControl](../msg_docs/NeuralControl.md).
|
||||
The message definition is also added in `msg/CMakeLists.txt`, and to [`src/modules/logger/logged_topics.cpp`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/logger/logged_topics.cpp) under the debug category.
|
||||
For these messages to be saved in your logs you need to include `debug` in the [SDLOG_PROFILE](../advanced_config/parameter_reference.md#SDLOG_PROFILE) parameter.
|
||||
|
||||
## Timing
|
||||
|
||||
The module has two includes for measuring the inference times.
|
||||
The first one is a driver that works on the actual flight controller units, but a second one, `chrono`, is loaded for SITL testing.
|
||||
Which timing library is included and used is based on wether PX4 is built with NUTTX or not.
|
||||
|
||||
## Changing the setpoint
|
||||
|
||||
The module uses the [TrajectorySetpoint](../msg_docs/TrajectorySetpoint.md) message’s position fields to define its target.
|
||||
To follow a trajectory, you can send updated setpoints.
|
||||
For an example of how to do this in a PX4 module, see the [mc_nn_testing](https://github.com/SindreMHegre/PX4-Autopilot-public/tree/main/src/modules/mc_nn_testing) module in this fork.
|
||||
Note that this is not included in upstream PX4.
|
||||
To use it, copy the module folder from the linked repository into your workspace, and enable it by adding the following line to your `.px4board` file:
|
||||
|
||||
```sh
|
||||
CONFIG_MODULES_MC_NN_TESTING=y
|
||||
```
|
||||
@@ -1,77 +0,0 @@
|
||||
# TensorFlow Lite Micro (TFLM)
|
||||
|
||||
The PX4 [Multicopter Neural Network](../advanced/neural_networks.md) module ([mc_nn_control](../modules/modules_controller.md#mc-nn-control)) integrates a neural network that uses the [TensorFlow Lite Micro (TFLM)](https://github.com/tensorflow/tflite-micro) inference library.
|
||||
|
||||
This is a mature inference library intended for use on embedded devices, and is hence a suitable choice for PX4.
|
||||
|
||||
This guide explains how the TFLM library is integrated into the [mc_nn_control](../modules/modules_controller.md#mc-nn-control) module, and the changes you would have to make to use it for your own neural network.
|
||||
|
||||
:::tip
|
||||
For more information, see the [TFLM guide](https://ai.google.dev/edge/litert/microcontrollers/get_started).
|
||||
:::
|
||||
|
||||
## TLMF NN Formats
|
||||
|
||||
TFLM uses networks in its own [tflite format](https://ai.google.dev/edge/litert/models/convert).
|
||||
However, since many microcontrollers do not have native filesystem support, a tflite file can be converted to a C++ source and header file.
|
||||
|
||||
This is what is done in `mc_nn_control`.
|
||||
The tflight neural network is represented in code by the files [`control_net.cpp`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/mc_nn_control/control_net.cpp) and [`control_net.hpp`](https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/mc_nn_control/control_net.hpp).
|
||||
|
||||
### Getting a Network in tflite Format
|
||||
|
||||
There are many online resource for generating networks in the `.tflite` format.
|
||||
|
||||
For this example we trained the network in the open source [Aerial Gym Simulator](https://ntnu-arl.github.io/aerial_gym_simulator/).
|
||||
Aerial Gym includes a guide, and supports RL both for control and vision-based navigation tasks.
|
||||
|
||||
The project includes conversion code for `PyTorch -> TFLM` in the [resources/conversion](https://github.com/ntnu-arl/aerial_gym_simulator/tree/main/resources/conversion) folder.
|
||||
|
||||
### Updating `mc_nn_control` with your own NN
|
||||
|
||||
You can convert a `.tflite` network into a `.cc` file in the ubuntu terminal with this command:
|
||||
|
||||
```sh
|
||||
xxd -i converted_model.tflite > model_data.cc
|
||||
```
|
||||
|
||||
You will then have to modify the `control_net.hpp` and `control_net.cpp` to include the data from `model_data.cc`:
|
||||
|
||||
- Take the size of the network in the bottom of the `.cc` file and replace the size in `control_net.hpp`.
|
||||
- Take the data in the model array in the `cc` file, and replace the ones in `control_net.cpp`.
|
||||
|
||||
You are now ready to run your own network.
|
||||
|
||||
## Code Explanation
|
||||
|
||||
This section explains the code used to integrate the NN in `control_net.cpp`.
|
||||
|
||||
### Operations and Resolver
|
||||
|
||||
Firstly we need to create the resolver and load the needed operators to run inference on the NN.
|
||||
This is done in the top of `mc_nn_control.cpp`.
|
||||
The number in `MicroMutableOpResolver<3>` represents how many operations you need to run the inference.
|
||||
|
||||
A full list of the operators can be found in the [micro_mutable_op_resolver.h](https://github.com/tensorflow/tflite-micro/blob/main/tensorflow/lite/micro/micro_mutable_op_resolver.h) file.
|
||||
There are quite a few supported operators, but you will not find the most advanced ones.
|
||||
In the control example the network is fully connected so we use `AddFullyConnected()`.
|
||||
Then the activation function is ReLU, and we `AddAdd()` for the bias on each neuron.
|
||||
|
||||
### Interpreter
|
||||
|
||||
In the `InitializeNetwork()` we start by setting up the model that we loaded from the source and header file.
|
||||
Next is to set up the interpreter, this code is taken from the TFLM documentation and is thoroughly explained there.
|
||||
The end state is that the `_control_interpreter` is set up to later run inference with the `Invoke()` member function.
|
||||
The `_input_tensor` is also defined, it is fetched from `_control_interpreter->input(0)`.
|
||||
|
||||
### 输入
|
||||
|
||||
The `_input_tensor` is filled in the `PopulateInputTensor()` function.
|
||||
`_input_tensor` works by accessing the `->data.f` member array and fill in the required inputs for your network.
|
||||
The inputs used in the control network is covered in [Neural Networks](../advanced/neural_networks.md).
|
||||
|
||||
### Outputs
|
||||
|
||||
For the outputs the approach is fairly similar to the inputs.
|
||||
After setting the correct inputs, calling the `Invoke()` function the outputs can be found by getting `_control_interpreter->output(0)`.
|
||||
And from the output tensor you get the `->data.f` array.
|
||||
@@ -1,161 +0,0 @@
|
||||
# _Pixhawk 4 Mini_ Wiring Quick Start
|
||||
|
||||
:::warning
|
||||
PX4 does not manufacture this (or any) autopilot.
|
||||
Contact the [manufacturer](https://holybro.com/) for hardware support or compliance issues.
|
||||
:::
|
||||
|
||||
This quick start guide shows how to power the [_Pixhawk<sup>®</sup> 4 Mini_](../flight_controller/pixhawk4_mini.md) flight controller and connect its most important peripherals.
|
||||
|
||||

|
||||
|
||||
## 接线图概述
|
||||
|
||||
The image below shows where to connect the most important sensors and peripherals (except for motors and servos).
|
||||
|
||||

|
||||
|
||||
:::tip
|
||||
More information about available ports can be found here: [_Pixhawk 4 Mini_ > Interfaces](../flight_controller/pixhawk4_mini.md#interfaces).
|
||||
:::
|
||||
|
||||
## 飞控的安装和方向
|
||||
|
||||
_Pixhawk 4 Mini_ should be mounted on your frame using vibration-damping foam pads (included in the kit).
|
||||
It should be positioned as close to your vehicle’s center of gravity as possible, oriented top-side up with the arrow pointing towards the front of the vehicle.
|
||||
|
||||

|
||||
|
||||
:::info
|
||||
If the controller cannot be mounted in the recommended/default orientation (e.g. due to space constraints) you will need to configure the autopilot software with the orientation that you actually used: [Flight Controller Orientation](../config/flight_controller_orientation.md).
|
||||
:::
|
||||
|
||||
## GPS + 指南针 + 蜂鸣器 + 安全开关 + LED
|
||||
|
||||
Attach the provided GPS with integrated compass, safety switch, buzzer, and LED to the **GPS MODULE** port. The GPS/Compass should be [mounted on the frame](../assembly/mount_gps_compass.md) as far away from other electronics as possible, with the direction marker towards the front of the vehicle (separating the compass from other electronics will reduce interference).
|
||||
|
||||

|
||||
|
||||
:::info
|
||||
The GPS module's integrated safety switch is enabled _by default_ (when enabled, PX4 will not let you arm the vehicle).
|
||||
To disable the safety press and hold the safety switch for 1 second.
|
||||
You can press the safety switch again to enable safety and disarm the vehicle (this can be useful if, for whatever reason, you are unable to disarm the vehicle from your remote control or ground station).
|
||||
:::
|
||||
|
||||
## 电源
|
||||
|
||||
The Power Management Board (PMB) serves the purpose of a power module as well as a power distribution board.
|
||||
In addition to providing regulated power to _Pixhawk 4 Mini_ and the ESCs, it sends information to the autopilot about the battery’s voltage and current draw.
|
||||
|
||||
Connect the output of the PMB that comes with the kit to the **POWER** port of the _Pixhawk 4 Mini_ using a 6-wire cable.
|
||||
The connections of the PMB, including power supply and signal connections to the ESCs and servos, are explained in the image below.
|
||||
|
||||

|
||||
|
||||
:::info
|
||||
The image above only shows the connection of a single ESC and a single servo.
|
||||
Connect the remaining ESCs and servos similarly.
|
||||
:::
|
||||
|
||||
| Pin(s) 或连接器 | 功能 |
|
||||
| ------------------------------ | -------------------------------------------------------------------------- |
|
||||
| B+ | 连接到 ESC电调B+以为 ESC电调供电 |
|
||||
| GND | 连接到 ESC电调负极 |
|
||||
| PWR | JST-GH 6-pin Connector, 5V 3A output<br> connect to _Pixhawk 4 Mini_ POWER |
|
||||
| BAT | 电源输入,连接到2~12S的LiPo电池 |
|
||||
|
||||
The pinout of the _Pixhawk 4 Mini_ **POWER** port is shown below.
|
||||
The `CURRENT` signal should carry an analog voltage from 0-3.3V for 0-120A as default.
|
||||
The `VOLTAGE` signal should carry an analog voltage from 0-3.3V for 0-60V as default.
|
||||
The VCC lines have to offer at least 3A continuous and should default to 5.1V. A lower voltage of 5V is still acceptable, but discouraged.
|
||||
|
||||
| 针脚 | 信号 | 电压 |
|
||||
| ---- | --- | --------------------- |
|
||||
| 1(红) | VCC | +5V |
|
||||
| 2(黑) | VCC | +5V |
|
||||
| 3(黑) | 电流 | +3.3V |
|
||||
| 4(黑) | 电压 | +3.3V |
|
||||
| 5(黑) | GND | GND |
|
||||
| 6(黑) | GND | GND |
|
||||
|
||||
:::info
|
||||
If using a plane or rover, the 8 pin power (+) rail of **MAIN OUT** will need to be separately powered in order to drive servos for rudders, elevons, etc.
|
||||
To do this, the power rail needs to be connected to a BEC equipped ESC, a standalone 5V BEC, or a 2S LiPo battery.
|
||||
Be careful with the voltage of servo you are going to use here.
|
||||
:::
|
||||
|
||||
<!--In the future, when Pixhawk 4 kit is available, add wiring images/videos for different airframes.-->
|
||||
|
||||
:::info
|
||||
Using the Power Module that comes with the kit you will need to configure the _Number of Cells_ in the [Power Settings](https://docs.qgroundcontrol.com/master/en/qgc-user-guide/setup_view/power.html) but you won't need to calibrate the _voltage divider_.
|
||||
You will have to update the _voltage divider_ if you are using any other power module (e.g. the one from the Pixracer).
|
||||
:::
|
||||
|
||||
## 遥控器
|
||||
|
||||
A remote control (RC) radio system is required if you want to _manually_ control your vehicle (PX4 does not require a radio system for autonomous flight modes).
|
||||
|
||||
You will need to [select a compatible transmitter/receiver](../getting_started/rc_transmitter_receiver.md) and then _bind_ them so that they communicate (read the instructions that come with your specific transmitter/receiver).
|
||||
|
||||
The instructions below show how to connect the different types of receivers to _Pixhawk 4 Mini_:
|
||||
|
||||
- Spektrum/DSM or S.BUS receivers connect to the **DSM/SBUS RC** input.
|
||||
|
||||

|
||||
|
||||
- PPM receivers connect to the **PPM RC** input port.
|
||||
|
||||

|
||||
|
||||
- PPM and PWM receivers that have an _individual wire for each channel_ must connect to the **PPM RC** port _via a PPM encoder_ [like this one](https://www.getfpv.com/radios/radio-accessories/holybro-ppm-encoder-module.html) (PPM-Sum receivers use a single signal wire for all channels).
|
||||
|
||||
For more information about selecting a radio system, receiver compatibility, and binding your transmitter/receiver pair, see: [Remote Control Transmitters & Receivers](../getting_started/rc_transmitter_receiver.md).
|
||||
|
||||
## Telemetry Radio (Optional)
|
||||
|
||||
Telemetry radios may be used to communicate and control a vehicle in flight from a ground station (for example, you can direct the UAV to a particular position, or upload a new mission).
|
||||
|
||||
The vehicle-based radio should be connected to the **TELEM1** port as shown below (if connected to this port, no further configuration is required).
|
||||
The other radio is connected to your ground station computer or mobile device (usually by USB).
|
||||
|
||||

|
||||
|
||||
## SD卡(可选)
|
||||
|
||||
SD cards are highly recommended as they are needed to [log and analyse flight details](../getting_started/flight_reporting.md), to run missions, and to use UAVCAN-bus hardware.
|
||||
Insert the card (included in the kit) into _Pixhawk 4 Mini_ as shown below.
|
||||
|
||||

|
||||
|
||||
:::tip
|
||||
For more information see [Basic Concepts > SD Cards (Removable Memory)](../getting_started/px4_basic_concepts.md#sd-cards-removable-memory).
|
||||
:::
|
||||
|
||||
## 电机
|
||||
|
||||
Motors/servos are connected to the **MAIN OUT** ports in the order specified for your vehicle in the [Airframe Reference](../airframes/airframe_reference.md). See [_Pixhawk 4 Mini_ > Supported Platforms](../flight_controller/pixhawk4_mini.md#supported-platforms) for more information.
|
||||
|
||||
:::info
|
||||
This reference lists the output port to motor/servo mapping for all supported air and ground frames (if your frame is not listed in the reference then use a "generic" airframe of the correct type).
|
||||
:::
|
||||
|
||||
:::warning
|
||||
The mapping is not consistent across frames (e.g. you can't rely on the throttle being on the same output for all plane frames).
|
||||
Make sure to use the correct mapping for your vehicle.
|
||||
:::
|
||||
|
||||
## 其它外设
|
||||
|
||||
The wiring and configuration of optional/less common components is covered within the topics for individual [peripherals](../peripherals/index.md).
|
||||
|
||||
## 配置
|
||||
|
||||
General configuration information is covered in: [Autopilot Configuration](../config/index.md).
|
||||
|
||||
QuadPlane specific configuration is covered here: [QuadPlane VTOL Configuration](../config_vtol/vtol_quad_configuration.md)
|
||||
|
||||
<!-- Nice to have detailed wiring infographic and instructions for different vehicle types. -->
|
||||
|
||||
## 更多信息
|
||||
|
||||
- [_Pixhawk 4 Mini_](../flight_controller/pixhawk4_mini.md)
|
||||
@@ -1,7 +0,0 @@
|
||||
# DroPix Flight Controller (Discontinued)
|
||||
|
||||
<Badge type="info" text="Discontinued" />
|
||||
|
||||
The Drotek<sup>®</sup> _DroPix autopilot_ is no longer available on the Drotek website, and is assumed to be discontinued.
|
||||
|
||||
See [PX4 v1.13 Documentation > DroPix Flight Controller](https://docs.px4.io/v1.13/en/flight_controller/dropix.html) for documentation.
|
||||
@@ -1,52 +0,0 @@
|
||||
# Test MC_07 - VIO (Visual-Inertial Odometry)
|
||||
|
||||
## Objective
|
||||
|
||||
To test that external vision (VIO) works as expected
|
||||
|
||||
## Preflight
|
||||
|
||||
Disconnect all GPS / compasses and ensure vehicle is using VIO for navigation
|
||||
|
||||
Ensure that the drone can go into Altitude / Position flight mode while still on the ground
|
||||
|
||||
Ensure there are no other sources of positioning besides VIO:
|
||||
|
||||
- [EKF2_OF_CTRL](../advanced_config/parameter_reference.md#EKF2_OF_CTRL): `0`
|
||||
- [EKF2_GPS_CTRL](../advanced_config/parameter_reference.md#EKF2_GPS_CTRL): `0`
|
||||
- [EKF2_EV_CTRL](../advanced_config/parameter_reference.md#EKF2_EV_CTRL): `15`
|
||||
- [SYS_HAS_MAG](../advanced_config/parameter_reference.md#SYS_HAS_MAG): `0`
|
||||
|
||||
## Flight Tests
|
||||
|
||||
❏ Altitude flight mode
|
||||
|
||||
❏ Vertical position should hold current value with stick centered
|
||||
|
||||
❏ Pitch/Roll/Yaw response 1:1
|
||||
|
||||
❏ Throttle response set to climb/descent rate
|
||||
|
||||
❏ Position flight mode
|
||||
|
||||
❏ Horizontal position should hold current value with stick centered
|
||||
|
||||
❏ Vertical position should hold current value with stick centered
|
||||
|
||||
❏ Throttle response set to climb/descent rate
|
||||
|
||||
❏ Pitch/Roll/Yaw response set to pitch/roll/yaw rates
|
||||
|
||||
## 降落
|
||||
|
||||
❏ Land in either Position or Altitude mode with the throttle below 40%
|
||||
|
||||
❏ Upon touching ground, copter should disarm automatically within 2 seconds (default: see [COM_DISARM_LAND](../advanced_config/parameter_reference.md#COM_DISARM_LAND))
|
||||
|
||||
## 预期成果
|
||||
|
||||
- 当油门升高时,起飞应该是平稳的
|
||||
- Drone should hold altitude in Altitude Flight mode without wandering
|
||||
- Drone should hold position within 1 meter in Position Flight mode without pilot moving sticks
|
||||
- 在上述任何飞行模式中都不应出现振荡
|
||||
- 着陆时,直升机不应在地面上反弹
|
||||
Reference in New Issue
Block a user