# 离板控制

离板控制背后的想法是能够使用在自动驾驶仪外运行的软件来控制 PX4 飞控。 这是通过 Mavlink 协议完成的, 特别是 SET_POSITION_TARGET_LOCAL_NED (opens new window)SET_ATTITUDE_TARGET (opens new window) 消息。 :::

The idea behind off-board control is to be able to control the PX4 flight stack using software running outside of the autopilot. This is done through the MAVLink protocol, specifically the SET_POSITION_TARGET_LOCAL_NED (opens new window) and the SET_ATTITUDE_TARGET (opens new window) messages.

# 离板控制固件设置

There are two things you want to setup on the firmware side before starting offboard development.

# 1. 将遥控开关映射到离板模式激活

虽然此步骤不是强制性的,因为您可以使用 Mavlink 消息激活非板载模式。 我们认为这种方法安全多了。

Although this step isn't mandatory since you can activate offboard mode using a MAVLink message. We consider this method much safer.

# 2. 启用配套的计算机接口

通常,有三种方式设置离板模式的通信。

# 硬件安装

参考电台包括:

# 1. 串口电台

  1. 一端连接飞控的 UART
  2. 一端连接地面站电脑

Example radios include:

Mermaid graph: mavlink channel (opens new window)

# 2. 板载处理器

A small computer mounted onto the vehicle connected to the autopilot through a UART to USB adapter. There are many possibilities here and it will depend on what kind of additional on-board processing you want to do in addition to sending commands to the autopilot.

{% mermaid %} graph TD; comp[Companion Computer] --MAVLink--> uart[UART Adapter]; uart --MAVLink--> Autopilot; {% endmermaid %}

Larger high power examples:

Mermaid diagram: Companion mavlink (opens new window)

# 3. 板载处理器和 WIFI 链接到 ROS(推荐

A small computer mounted onto the vehicle connected to the autopilot through a UART to USB adapter while also having a WiFi link to a ground station running ROS. This can be any of the computers from the above section coupled with a WiFi adapter. For example, the Intel NUC D34010WYB has a PCI Express Half-Mini connector which can accommodate an Intel Wifi Link 5000 (opens new window) adapter.

Mermaid graph: ROS (opens new window)