mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 19:32:36 +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:
@@ -0,0 +1,94 @@
|
||||
# ARK Jetson PAB 载板
|
||||
|
||||
The [ARK Jetson Pixhawk Autopilot Bus (PAB) Carrier](https://arkelectron.gitbook.io/ark-documentation/flight-controllers/ark-jetson-pab-carrier) serves as a carrier board for NVIDIA Jetson Orin NX/Nano and any [Pixhawk Autopilot Bus (PAB)](https://github.com/pixhawk/Pixhawk-Standards/blob/master/DS-010%20Pixhawk%20Autopilot%20Bus%20Standard.pdf)-compliant flight controller, such as the [ARKV6X](../flight_controller/ark_v6x.md).
|
||||
|
||||

|
||||
|
||||
## 购买渠道
|
||||
|
||||
- [ARK Jetson PAB Carrier](https://arkelectron.com/product/ark-jetson-pab-carrier/)
|
||||
- [ARK Jetson Orin NX NDAA Bundle](https://arkelectron.com/product/ark-jetson-orin-nx-ndaa-bundle/)
|
||||
|
||||
## 产品规格
|
||||
|
||||
- **Power Requirements**
|
||||
|
||||
- 5V
|
||||
- 4A minimum (dependent on usage and peripherals)
|
||||
|
||||
- **Additional Features**
|
||||
|
||||
- Pixhawk Autopilot Bus (PAB) Form Factor ([PAB Standard](https://github.com/pixhawk/Pixhawk-Standards/blob/master/DS-010%20Pixhawk%20Autopilot%20Bus%20Standard.pdf))
|
||||
- MicroSD Slot
|
||||
- USA-built, NDAA compliant
|
||||
- Integrated 1W heater for sensor stability in extreme conditions
|
||||
|
||||
- **Physical Details**
|
||||
|
||||
- Weight:
|
||||
- Without Jetson and Flight Controller – 80g
|
||||
- With Jetson, no heatsink or Flight Controller – 108g
|
||||
- With Jetson and heatsink, no Flight Controller – 160g
|
||||
- With Jetson, heatsink, Flight Controller, M.2 SSD, M.2 WiFi Module – 174g
|
||||
- Dimensions (without Jetson and Flight Controller): 116 mm x 72 mm x 23 mm
|
||||
|
||||
- **Pinout**
|
||||
- For detailed pin mapping, see the [ARK Jetson PAB Carrier Pinout documentation](https://arkelectron.gitbook.io/ark-documentation/flight-controllers/ark-jetson-pab-carrier/pinout).
|
||||

|
||||
|
||||
## Autopilot Connections
|
||||
|
||||
The Jetson and the flight controller communicate through serial and USB interfaces, both of which support direct board-to-board connections tested up to 3 Mbps.
|
||||
|
||||
| 类型 | Jetson Device Path | Flight Controller |
|
||||
| :----- | :----------------- | :---------------- |
|
||||
| USB | /dev/ttyACM0 | USB |
|
||||
| Serial | /dev/ttyTHS1 | TELEM2 |
|
||||
|
||||
The USB connection to the autopilot is multiplexed with the external Jetson micro USB port.
|
||||
When a micro USB cable is connected, the autopilot is disconnected from the Jetson, and the USB port on the Jetson switches from host to device mode.
|
||||
After the micro USB cable is disconnected, a reboot is required to switch the USB port back to a host and connect to the autopilot.
|
||||
|
||||
For the USB port to be enabled on the ARKV6X flight controller, the `VBUS_SENSE` pin must be driven high from the Jetson.
|
||||
It is connected to pin 206 GPIO07.
|
||||
For Jetpack 5, there is a helper Python script in ARK-OS to drive the pin high.
|
||||
For Jetpack 6, a script cannot toggle a GPIO and leave it set.
|
||||
As a workaround, the `VBUS_SENSE` pin is set high in the Jetson pinmux on boot.
|
||||
|
||||
- [Enable VBUS on ARK-OS](https://github.com/ARK-Electronics/ARK-OS/blob/main/platform/jetson/scripts/vbus_enable.py)
|
||||
|
||||
### UART
|
||||
|
||||
The UART connection between the Jetson and the autopilot is on Jetson UART1, which appears as `/dev/ttyTHS0` in Jetpack 5 and `/dev/ttyTHS1` in Jetpack 6.
|
||||
This is connected to `TELEM2` on the Pixhawk controller and has been tested up to 3 Mbps (higher baud rates may be possible).
|
||||
|
||||
### Flight Controller Reset
|
||||
|
||||
The flight controller can be hard reset using the reset signal connected to Jetson pin 228 GPIO13.
|
||||
The Jetson cannot reset the flight controller while it is armed.
|
||||
The reset signal is gated by the `nARMED` signal from the flight controller.
|
||||
|
||||
Two helper scripts are available for resetting the flight controller:
|
||||
|
||||
- **Reset and wait in the bootloader**: Drives the `VBUS_SENSE` pin high before the reset, holding it in the bootloader for 5 seconds.
|
||||
Useful for firmware updates when a hard reboot is needed.
|
||||
- [reset_fmu_wait_bl.py](https://github.com/ARK-Electronics/ARK-OS/blob/main/platform/jetson/scripts/reset_fmu_wait_bl.py)
|
||||
- **Quick reset, skip the bootloader**: Drives the `VBUS_SENSE` pin low before reset, avoiding the wait.
|
||||
- [reset_fmu_fast.py](https://github.com/ARK-Electronics/ARK-OS/blob/main/platform/jetson/scripts/reset_fmu_fast.py)
|
||||
|
||||
## Flashing Guide
|
||||
|
||||
If you've purchased the [ARK Jetson Orin NX NDAA Bundle](https://arkelectron.com/product/ark-jetson-orin-nx-ndaa-bundle/), Jetpack 6 (Ubuntu 22.04) and [ARK-OS](https://github.com/ARK-Electronics/ARK-OS) are pre-installed.
|
||||
|
||||
### ARK Jetson Kernel GitHub Repository
|
||||
|
||||
This [repository](https://github.com/ARK-Electronics/ark_jetson_kernel) includes helper scripts for kernel download and compilation.
|
||||
Please follow the README to update to the latest Jetpack or to perform an initial flash.
|
||||
|
||||
To flash the kernel, connect the Jetson to your Host PC via Micro USB, and boot the Jetson while holding the Force Recovery button.
|
||||
|
||||

|
||||
|
||||
## See Also
|
||||
|
||||
- [ARK Jetson PAB Documentation](https://arkelectron.gitbook.io/ark-documentation/flight-controllers/ark-jetson-pab-carrier) (ARK Docs)
|
||||
@@ -0,0 +1,89 @@
|
||||
# Auterion Skynode
|
||||
|
||||
[Skynode](https://auterion.com/product/skynode/) is a powerful flight computer that combines a mission computer, flight controller, video streaming, networking, and cellular connection, in a single tightly integrated device.
|
||||
|
||||

|
||||
|
||||
The onboard software is Auterion OS, consisting of an enterprise-hardened version of PX4 running on the flight controller, and an operating system with advanced management software running on the mission computer.
|
||||
The OS is managed by Auterion in production, with customer applications running as "add ons" in a safe sandbox within the mission computer.
|
||||
|
||||
Auterion OS and Skynode allow seamless integration with Auterion's other software and fleet management products.
|
||||
|
||||
For information about Auterion and Skynode:
|
||||
|
||||
- [auterion.com](https://auterion.com/)
|
||||
- [Skynode](https://auterion.com/product/skynode/) (auterion.com)
|
||||
- Skynode Guides:
|
||||
- [Manufacturer's Guide](https://docs.auterion.com/manufacturers/getting-started/readme)
|
||||
- [App Developer's Guide](https://docs.auterion.com/developers/getting-started/readme)
|
||||
|
||||
## Skynode with Vanilla PX4
|
||||
|
||||
Skynode comes with an Auterion-managed release of PX4.
|
||||
If you would like to try a more recent PX4 flight kernel, you can install the upstream "vanilla" PX4 from [PX4/PX4-Autopilot](https://github.com/PX4/PX4-Autopilot).
|
||||
|
||||
Upstream PX4 will generally work, with the following caveats:
|
||||
|
||||
- Configuration for your exact product may not be present.
|
||||
You may lose the configuration for ESCs, batteries, sensor configuration, and so on.
|
||||
- Some parameters might have different default values in the PX4 release shipped with Auterion OS.
|
||||
- Features accessed by vendor-specific customisations running on the companion computer may not be present in PX4.
|
||||
- Auterion supports Skynode running its own Auterion-managed version of PX4.
|
||||
|
||||
## Building/Uploading Firmware
|
||||
|
||||
PX4 `px4_fmu-v5x` binaries for Skynode are built from source using the normal [developer environment](../dev_setup/dev_env.md) and [build commands](../dev_setup/building_px4.md), and are uploaded using either `upload_skynode_usb` or `upload_skynode_wifi` upload targets.
|
||||
|
||||
`upload_skynode_usb` and `upload_skynode_wifi` connect to Skynode via SSH over a network interface using the default (fixed) IP addresses for [USB](https://docs.auterion.com/manufacturers/avionics/skynode/advanced-configuration/connecting-to-skynode) and [WiFi](https://docs.auterion.com/manufacturers/avionics/skynode/advanced-configuration/configuration), and upload a TAR compressed binary to the mission computer.
|
||||
The mission computer then decompresses the binary and installs it to the flight controller.
|
||||
|
||||
:::info
|
||||
SSH and TAR are needed to use these upload targets, but are expected to be present by default on Ubuntu and Ubuntu running on Windows in WSL2.
|
||||
On macOS you should first install [gnu-tar](https://formulae.brew.sh/formula/gnu-tar).
|
||||
:::
|
||||
|
||||
You will need to enter the password for the Skynode developer image password twice during the upload process.
|
||||
|
||||
:::: tabs
|
||||
|
||||
:::tab "Skynode connected via USB"
|
||||
|
||||
```
|
||||
make px4_fmu-v5x upload_skynode_usb
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
:::tab "Skynode connected via WiFi"
|
||||
|
||||
```
|
||||
make px4_fmu-v5x upload_skynode_wifi
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
::::
|
||||
|
||||
## Restoring the Default PX4 Firmware
|
||||
|
||||
To reinstall the original Skynode version of PX4 when connected via USB run the following command in the repository:
|
||||
|
||||
:::: tabs
|
||||
|
||||
:::tab "Skynode connected via USB"
|
||||
|
||||
```
|
||||
./Tools/auterion/upload_skynode.sh --revert
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
:::tab "Skynode connected via WiFi"
|
||||
|
||||
```
|
||||
./Tools/auterion/upload_skynode.sh --revert --wifi
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
::::
|
||||
@@ -0,0 +1,94 @@
|
||||
# 机载计算机外设
|
||||
|
||||
本节包含关于机载计算机外设的信息。
|
||||
其中既包括可能与机载计算机连接的组件(可能会与PX4交互/访问),也包括将机载计算机与飞行控制器连接起来。
|
||||
|
||||
## Companion/Pixhawk Communication
|
||||
|
||||
This section lists devices that may be used for the physical serial/data connection between a companion computer and a flight controller.
|
||||
|
||||
:::info
|
||||
PX4 configuration for communicating with a companion computer over MAVLink via TELEM2 is covered in [MAVLink (OSD / Telemetry)](../peripherals/mavlink_peripherals.md#telem2).
|
||||
Other relevant topics/sections include: [Companion Computers](../companion_computer/index.md), [Robotics](../robotics/index.md) and [uXRCE-DDS (PX4-ROS 2/DDS Bridge)](../middleware/uxrce_dds.md).
|
||||
:::
|
||||
|
||||
### FTDI Devices
|
||||
|
||||
The FTDI USB adapters are the most common way of communicating between companion computer and Pixhawk.
|
||||
They are usually plug and play as long as the IO of the adapter is set to 3.3V.
|
||||
In order to utilize the full capability/reliability of the serial link offered on the Pixhawk hardware, flow control is recommended.
|
||||
|
||||
A few "turnkey" options are listed below:
|
||||
|
||||
| 设备 | 3.3v IO (Default) | Flow Control | Tx/Rx LEDs | JST-GH |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------- | ------------ | ---------- | ------ |
|
||||
| [mRo USB FTDI Serial to JST-GH (Basic)][mro_usb_ftdi_serial_to_jst_gh] | Capable | Capable | No | Yes |
|
||||
| [SparkFun FTDI Basic Breakout][sparkfun_ftdi__breakout] | Yes | No | Yes | No |
|
||||
|
||||
<!-- Reference links for above table -->
|
||||
|
||||
[mro_usb_ftdi_serial_to_jst_gh]: https://store.mrobotics.io/USB-FTDI-Serial-to-JST-GH-p/mro-ftdi-jstgh01-mr.htm
|
||||
[sparkfun_ftdi basic_breakout]: https://www.sparkfun.com/products/9873
|
||||
|
||||
You can also use an off-the-shelf FTDI cable [like this one](https://www.sparkfun.com/products/9717) and connect it to flight controller using the appropriate header adaptor
|
||||
(JST-GH connectors are specified in the Pixhawk standard, but you should confirm the connectors for your flight controller).
|
||||
|
||||
### Logic Level Shifters
|
||||
|
||||
On occasion a companion computer may expose hardware level IO that is often run at 1.8v or 5v, while the Pixhawk hardware operates at 3.3v IO.
|
||||
In order to resolve this, a level shifter can be implemented to safely convert the transmitting/receiving signal voltage.
|
||||
|
||||
Options include:
|
||||
|
||||
- [SparkFun Logic Level Converter - Bi-Directional](https://www.sparkfun.com/products/12009)
|
||||
- [4-channel I2C-safe Bi-directional Logic Level Converter - BSS138](https://www.adafruit.com/product/757)
|
||||
|
||||
## Cameras
|
||||
|
||||
Cameras are used image and video capture, and more generally to provide data for [computer vision](../computer_vision/index.md) applications (in this case the "cameras" may only provide processed data, not raw images).
|
||||
|
||||
### Stereo Cameras
|
||||
|
||||
Stereo cameras are typically used for depth perception, path planning and SLAM.
|
||||
They are in no way guaranteed to be plug and play with your companion computer.
|
||||
|
||||
Popular stereo cameras include:
|
||||
|
||||
- [Intel® RealSense™ Depth Camera D435](https://www.intelrealsense.com/depth-camera-d435/)
|
||||
- [Intel® RealSense™ Depth Camera D415](https://www.intelrealsense.com/depth-camera-d415/)
|
||||
- [DUO MLX](https://duo3d.com/product/duo-minilx-lv1)
|
||||
|
||||
### VIO Cameras/Sensors
|
||||
|
||||
The following sensors can be used for [Visual Inertial Odometry (VIO)](../computer_vision/visual_inertial_odometry.md):
|
||||
|
||||
- [T265 Realsense Tracking Camera](../peripherals/camera_t265_vio.md)
|
||||
|
||||
## Data Telephony (LTE)
|
||||
|
||||
An LTE USB module can be attached to a companion computer and used to route MAVLink traffic between the flight controller and the Internet.
|
||||
|
||||
There is no "standard method" for a ground station and companion to connect over the Internet.
|
||||
Generally you can't connect them directly because neither of them will have a public/static IP on the Internet.
|
||||
|
||||
:::info
|
||||
Typically your router (or the mobile network) has a public IP address, and your GCS computer/vehicle are on a _local_ network.
|
||||
The router uses network address translation (NAT) to map _outgoing_ requests from your local network to the Internet, and can use the map to route the _responses_ back to requesting system.
|
||||
However NAT has no way to know where to direct the traffic from an arbitrary external system, so there is no way to _initiate_ a connection to a GCS or vehicle running in the local network.
|
||||
:::
|
||||
|
||||
A common approach is to set up a virtual private network between the companion and GCS computer (i.e. install a VPN system like [zerotier](https://www.zerotier.com/) on both computers).
|
||||
The companion then uses [mavlink-router](https://github.com/intel/mavlink-router) to route traffic between the serial interface (flight controller) and GCS computer on the VPN network.
|
||||
|
||||
This method has the benefit that the GCS computer address can be static within the VPN, so the configuration of the _mavlink router_ does not need to change over time.
|
||||
In addition, the communication link is secure because all VPN traffic is encrypted (MAVLink 2 itself does not support encryption).
|
||||
|
||||
:::info
|
||||
You can also choose to route to the VPN broadcast address (i.e. `x.x.x.255:14550`, where 'x' depends on the VPN system).
|
||||
This approach means that you do not need to know the IP address of the GCS computer, but may result in more traffic than desired (since packets are broadcast to every computer on the VPN network).
|
||||
:::
|
||||
|
||||
Some USB modules that are known to work include:
|
||||
|
||||
- [Huawei E8372](https://consumer.huawei.com/en/mobile-broadband/e8372/) and [Huawei E3372](https://consumer.huawei.com/en/mobile-broadband/e3372/)
|
||||
- The _E8372_ includes WiFi which you can use to configure the SIM while it is plugged into the companion (making the development workflow a little easier). The _E3372_ lacks WiFi, so you have to configure it by plugging the stick into a laptop.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,424 @@
|
||||
# Holybro Pixhawk RPi CM4 Baseboard
|
||||
|
||||
The [Holybro Pixhawk RPi CM4 Baseboard](https://holybro.com/products/pixhawk-rpi-cm4-baseboard) is a single-board solution that pre-integrates a (swappable) Pixhawk flight controller with the Raspberry Pi CM4 companion computer ("RPi").
|
||||
The baseboard has a compact form factor with all the connections needed for development.
|
||||
|
||||

|
||||
|
||||
The flight controller module is internally connected to RPi CM4 through `TELEM2`, but may alternatively be connected using Ethernet with the provided external cable.
|
||||
|
||||
This baseboard is plug-in compatible with [Holybro Pixhawk 5X](../flight_controller/pixhawk5x.md), [Holybro Pixhawk 6X](../flight_controller/pixhawk6x.md), and any other Pixhawk controller that follows the [Pixhawk Autopilot Bus Standard](https://github.com/pixhawk/Pixhawk-Standards/blob/master/DS-010%20Pixhawk%20Autopilot%20Bus%20Standard.pdf) guidelines for mechanical compatibility across vendors.
|
||||
|
||||
:::info
|
||||
The board follows the [Pixhawk Connector Standard](https://github.com/pixhawk/Pixhawk-Standards/blob/master/DS-009%20Pixhawk%20Connector%20Standard.pdf) and [Pixhawk Autopilot Bus Standard](https://github.com/pixhawk/Pixhawk-Standards/blob/master/DS-010%20Pixhawk%20Autopilot%20Bus%20Standard.pdf) (including the guidelines for "mechanical compatibility across vendors").
|
||||
:::
|
||||
|
||||
## Purchase
|
||||
|
||||
- [Holybro Pixhawk RPi CM4 Baseboard](https://holybro.com/products/pixhawk-rpi-cm4-baseboard) (www.holybro.com)
|
||||
|
||||
The baseboard can be purchased with or without an RPi CM4 and/or flight controller:
|
||||
|
||||
- The Raspberry Pi CM4 (CM4008032) supplied by Holybro has the following specification:
|
||||
- RAM: 8GB
|
||||
- eMMC: 32GB
|
||||
- Wireless: No
|
||||
- The recommended minimum specification for the RPi CM4 is:
|
||||
- RAM: 4GB (or 8GB)
|
||||
- eMMC: 16GB
|
||||
- Wireless: Yes
|
||||
|
||||
## Connections & Ports
|
||||
|
||||
:::info
|
||||
The [Holybro Documentation](https://docs.holybro.com/autopilot/pixhawk-baseboards/pixhawk-rpi-cm4-baseboard/connections-and-ports) has more detailed (and possibly more "up to date") port and connection information.
|
||||
:::
|
||||
|
||||
The diagram below shows all the connectors and ports on the baseboard.
|
||||
|
||||

|
||||
|
||||
### RPi CM4 & FC Serial Connection
|
||||
|
||||
The flight controller `TELEM2` port is internally connected to RPi CM4 as shown:
|
||||
|
||||
| RPi CM4 | FC TELEM2 (FMU) |
|
||||
| ------- | ---------------------------------- |
|
||||
| GPIO14 | TXD |
|
||||
| GPIO15 | RXD |
|
||||
| GPIO16 | CTS |
|
||||
| GPIO17 | RTS: |
|
||||
|
||||
:::info
|
||||
The connection must be also be [configured in both RPi and PX4](#configure-px4-to-cm4-mavlink-serial-connection) (unless [Ethernet](#ethernet-connection-optional) is used instead).
|
||||
:::
|
||||
|
||||
## Installing the Flight Controller
|
||||
|
||||
A plug-compatible flight controller such as [Holybro Pixhawk 5X](../flight_controller/pixhawk5x.md) and [Holybro Pixhawk 6X](../flight_controller/pixhawk6x.md) can simply be pushed into the module slot.
|
||||
|
||||
Flight controllers that have a different form factor will need additional wiring.
|
||||
|
||||
## Installing the RPi CM4 Companion
|
||||
|
||||
This section shows how to install/attach an RPi CM4 to the baseboard.
|
||||
|
||||

|
||||
|
||||
To install the RPi CM4 companion computer:
|
||||
|
||||
1. Disconnect the `FAN` wiring.
|
||||
|
||||

|
||||
|
||||
2. Remove these 4 screws on the back side of the baseboard.
|
||||
|
||||

|
||||
|
||||
3. Remove the baseboard case, install the CM4, and use the 4 screws to attach it (as shown):
|
||||
|
||||

|
||||
|
||||
4. Reattach the cover.
|
||||
|
||||
## Power Module Wiring
|
||||
|
||||
The PM03D power module is supplied with the board.
|
||||
|
||||
The RPi CM4 and flight controller must be powered separately:
|
||||
|
||||
- The flight controller is powered via the CLIK-Mate cable to `POWER1` or `POWER2` port
|
||||
- The RPi CM4 is powered by the `USB C` (CM4 Slave) connection.
|
||||
You can also use your own power supply to power the RPi CM4 baseboard.
|
||||
|
||||
The image below shows the wiring in greater detail.
|
||||
|
||||

|
||||
|
||||
## Flashing the RPi CM4
|
||||
|
||||
This section explains how you install your preferred Linux distro, such as "Raspberry Pi OS 64bit" onto the RPi EMCC.
|
||||
|
||||
备注:
|
||||
|
||||
- If you are using PX4, you will need to use PX4 version 1.13.1 or newer for PX4 to recognize this baseboard.
|
||||
- The fan does not indicate if the RPi CM4 is powered/running or not.
|
||||
- The power module plugged into Power1/2 does not power the RPi part.
|
||||
You can use the additional USB-C Cable from the PM03D power module to the CM4 Slave USB-C port.
|
||||
- The Micro-HDMI port is an output port.
|
||||
- RPi CM4 boards that do not have WiFi device will not connect automatically.
|
||||
In this case you will need to plug it into a router or plug a compatible WiFi dongle into the CM4 Host ports.
|
||||
|
||||
### Flash EMMC
|
||||
|
||||
To flash a RPi image onto EMMC.
|
||||
|
||||
1. Switch Dip-Switch to `RPI`.
|
||||
|
||||

|
||||
|
||||
2. Connect computer to USB-C _CM4 Slave_ port used to power & flash the RPi.
|
||||
|
||||

|
||||
|
||||
3. Get `usbboot`, build it and run it.
|
||||
|
||||
```sh
|
||||
sudo apt install libusb-1.0-0-dev
|
||||
git clone --depth=1 https://github.com/raspberrypi/usbboot
|
||||
cd usbboot
|
||||
make
|
||||
sudo ./rpiboot
|
||||
```
|
||||
|
||||
4. You can now install your preferred Linux distro using The `rpi-imager`.
|
||||
Make sure you add WiFi and SSH settings (hidden behind the gear/advanced symbol).
|
||||
|
||||
```sh
|
||||
sudo apt install rpi-imager
|
||||
rpi-imager
|
||||
```
|
||||
|
||||
5. Once done, unplugging USB-C CM4 Slave (this will unmount the volumes, and power off the CM4).
|
||||
|
||||
6. Switch Dip-Switch back to `EMMC`.
|
||||
|
||||
7. Power on CM4 by providing power to USB-C CM4 Slave port.
|
||||
|
||||
8. To check if it's booting/working you can either:
|
||||
- Check there is HDMI output
|
||||
- Connect via SSH (if set up in rpi-imager, and WiFi is available).
|
||||
|
||||
## Configure PX4 to CM4 MAVLink Serial Connection
|
||||
|
||||
:::info
|
||||
If you are using [Ethernet](#ethernet-connection-optional) to connect the FC and RPi, this setup is not needed.
|
||||
:::
|
||||
|
||||
The Pixhawk FC module is [internally connected to the RPi CM4](#rpi-cm4-fc-serial-connection) using `TELEM2` (`/dev/ttyS4`).
|
||||
The FC and RPi CM4 must both be configured to communicate over this port.
|
||||
|
||||
### FC Serial Port Setup
|
||||
|
||||
The FC should be set up to connect to the `TELEM2` port correctly by default.
|
||||
If not, you can configure the port using the parameters as shown.
|
||||
|
||||
To enable this MAVLink instance on the FC:
|
||||
|
||||
1. Connect a computer running QGroundControl via USB Type C port on the baseboard labeled `FC`
|
||||
|
||||

|
||||
|
||||
2. [Set the parameters](../advanced_config/parameters.md):
|
||||
|
||||
- `MAV_1_CONFIG` = `102`
|
||||
- `MAV_1_MODE = 2`
|
||||
- `SER_TEL2_BAUD` = `921600`
|
||||
|
||||
3. Reboot the FC.
|
||||
|
||||
### RPi Serial Port Setup
|
||||
|
||||
On the RPi side:
|
||||
|
||||
1. Connect to the RPi (using WiFi, a router, or a WiFi Dongle).
|
||||
|
||||
2. Enable the RPi serial port by running `RPi-config`
|
||||
|
||||
- Go to `3 Interface Options`, then `I6 Serial Port`.
|
||||
Then choose:
|
||||
- `login shell accessible over serial → No`
|
||||
- `serial port hardware enabled` → `Yes`
|
||||
|
||||
3. Finish, and reboot.
|
||||
This will add `enable_uart=1` to `/boot/config.txt`, and remove `console=serial0,115200` from `/boot/cmdline.txt`.
|
||||
|
||||
4. Now MAVLink traffic should be available on `/dev/serial0` at a baudrate of 921600.
|
||||
|
||||
## Try out MAVSDK-Python
|
||||
|
||||
1. Make sure the CM4 is connected to the internet, e.g. using a WiFi, or Ethernet.
|
||||
|
||||
2. Install MAVSDK Python:
|
||||
|
||||
```sh
|
||||
python3 -m pip install mavsdk
|
||||
```
|
||||
|
||||
3. Copy an example from the [MAVSDK-Python examples](https://github.com/mavlink/MAVSDK-Python/tree/main/examples).
|
||||
|
||||
4. Change the `system_address="udp://:14540"` to `system_address="serial:///dev/serial0:921600"`
|
||||
|
||||
5. Try out the example. Permission for the serial port should already be available through the `dialout` group.
|
||||
|
||||
## Ethernet Connection (Optional)
|
||||
|
||||
The flight controller module is [internally connected to RPi CM4](#rpi-cm4-fc-serial-connection) from `TELEM2` (serial).
|
||||
|
||||
You can also set up a local Ethernet connection between them using the supplied cable.
|
||||
以太网连接提供了一种快速、可靠和灵活的通信选择,可替代使用USB或其他串行连接。
|
||||
|
||||
:::info
|
||||
For general Ethernet setup information see: [PX4 Ethernet Setup](../advanced_config/ethernet_setup.md).
|
||||
|
||||
The setup here is much the same, except that we have used the following `netplan` config on PX4:
|
||||
|
||||
```sh
|
||||
network:
|
||||
version: 2
|
||||
renderer: NetworkManager
|
||||
ethernets:
|
||||
eth0:
|
||||
addresses:
|
||||
- 10.41.10.1/24
|
||||
nameservers:
|
||||
addresses: [10.41.10.1]
|
||||
routes:
|
||||
- to: 10.41.10.0/24 # Local route to access devices on this subnet
|
||||
scope: link # Scope link to restrict it to local subnet
|
||||
```
|
||||
|
||||
This sets `eth0` as our channel for the local Ethernet link from the RPi (instead of `enp2s0`, which is assumed in [Ethernet Setup](../advanced_config/ethernet_setup.md#ubuntu-ethernet-network-setup)).
|
||||
|
||||
Note that we could have used WiFi for the link, but by setting up a dedicated route we leave our WiFi free for Internet comms.
|
||||
:::
|
||||
|
||||
### Connect the Cable
|
||||
|
||||
To set up a local ethernet connection between CM4 and the flight computer, the two Ethernet ports need to be connected using the provided 8 pin to 4 pin connector.
|
||||
|
||||

|
||||
|
||||
The pinout of the cable is:
|
||||
|
||||
| CM4 Eth 8 Pin | FC ETH 4 Pin |
|
||||
| ------------- | ------------ |
|
||||
| A | B |
|
||||
| B | A |
|
||||
| C | D |
|
||||
| D | C |
|
||||
| - | N/A |
|
||||
| - | N/A |
|
||||
| - | N/A |
|
||||
| - | N/A |
|
||||
|
||||
### IP Setup on CM4
|
||||
|
||||
Since there is no DHCP server active in this configuration, the IP addresses have to be set manually:
|
||||
|
||||
First, connect to the CM4 via SSH by connecting to the CM4's WiFi (or use a WiFi dongle).
|
||||
Once the Ethernet cables are plugged in, the `eth0` network interface seems to switch from DOWN to UP.
|
||||
|
||||
You can check the status using:
|
||||
|
||||
```sh
|
||||
ip address show eth0
|
||||
```
|
||||
|
||||
You can also try to enable it manually:
|
||||
|
||||
```sh
|
||||
sudo ip link set dev eth0 up
|
||||
```
|
||||
|
||||
This sets a link-local address.
|
||||
For this example it looks like this:
|
||||
|
||||
```sh
|
||||
$: ip address show eth0
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
|
||||
link/ether e4:5f:01:bf:e0:17 brd ff:ff:ff:ff:ff:ff
|
||||
inet 10.41.10.1/24 brd 10.41.10.255 scope global noprefixroute eth0
|
||||
valid_lft forever preferred_lft forever
|
||||
inet6 fe80::e65f:1ff:febf:e017/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
```
|
||||
|
||||
This means the CM4's Ethernet IP is `10.41.10.1` .
|
||||
|
||||
#### Ping Test
|
||||
|
||||
First ping PX4 from the CM4 (using the PX4's default address):
|
||||
|
||||
```sh
|
||||
$ ping 10.41.10.2
|
||||
```
|
||||
|
||||
Should give something like:
|
||||
|
||||
```sh
|
||||
PING 10.41.10.2 (10.41.10.2) 56(84) bytes of data.
|
||||
64 bytes from 10.41.10.2: icmp_seq=1 ttl=64 time=0.187 ms
|
||||
64 bytes from 10.41.10.2: icmp_seq=2 ttl=64 time=0.109 ms
|
||||
64 bytes from 10.41.10.2: icmp_seq=3 ttl=64 time=0.091 ms
|
||||
^C
|
||||
--- 10.41.10.2 ping statistics ---
|
||||
3 packets transmitted, 3 received, 0% packet loss, time 2049ms
|
||||
rtt min/avg/max/mdev = 0.091/0.129/0.187/0.041 ms
|
||||
```
|
||||
|
||||
:::info
|
||||
If this step fails, check if a [firewall](https://wiki.ubuntu.com/UncomplicatedFirewall) is active.
|
||||
:::
|
||||
|
||||
Then ping the CM4 from the flight controlle.
|
||||
Enter the following command in the Nuttx Shell:
|
||||
|
||||
```sh
|
||||
nsh> ping 10.41.10.1
|
||||
```
|
||||
|
||||
This should result in output like:
|
||||
|
||||
```sh
|
||||
PING 10.41.10.1 56 bytes of data
|
||||
56 bytes from 10.41.10.1: icmp_seq=0 time=0.0 ms
|
||||
56 bytes from 10.41.10.1: icmp_seq=1 time=0.0 ms
|
||||
56 bytes from 10.41.10.1: icmp_seq=2 time=0.0 ms
|
||||
56 bytes from 10.41.10.1: icmp_seq=3 time=0.0 ms
|
||||
56 bytes from 10.41.10.1: icmp_seq=4 time=0.0 ms
|
||||
56 bytes from 10.41.10.1: icmp_seq=5 time=0.0 ms
|
||||
56 bytes from 10.41.10.1: icmp_seq=6 time=0.0 ms
|
||||
56 bytes from 10.41.10.1: icmp_seq=7 time=0.0 ms
|
||||
56 bytes from 10.41.10.1: icmp_seq=8 time=0.0 ms
|
||||
56 bytes from 10.41.10.1: icmp_seq=9 time=0.0 ms
|
||||
10 packets transmitted, 10 received, 0% packet loss, time 10010 ms
|
||||
rtt min/avg/max/mdev = 0.000/0.000/0.000/0.000 ms
|
||||
```
|
||||
|
||||
#### MAVLink/MAVSDK Test
|
||||
|
||||
For this, we need to set the MAVLink instance to send traffic to the CM4's IP address:
|
||||
|
||||
For an initial test we can do:
|
||||
|
||||
```sh
|
||||
mavlink start -o 14540 -t 10.41.10.1
|
||||
```
|
||||
|
||||
This will send MAVLink traffic on UDP to port 14540 (the MAVSDK/MAVROS port) to that IP which means MAVSDK can just listen to any UDP arriving at that default port.
|
||||
|
||||
To run a MAVSDK example, install mavsdk via pip, and try out an example from [MAVSDK-Python/examples](https://github.com/mavlink/MAVSDK-Python/tree/main/examples).
|
||||
|
||||
#### XRCE-Client Ethernet Setup
|
||||
|
||||
Next we enable `XRCE-DDS` on the new Ethernet Link.
|
||||
|
||||
You can [modify the required parameters](../advanced_config/parameters.md) in QGroundControl parameter editor, or using `param set` in the [MAVLINK shell](../debug/mavlink_shell.md).
|
||||
Below we show the settings assuming you're setting the parameters using the shell.
|
||||
|
||||
First ensure `MAV_2_CONFIG` is not set to use the Ethernet port (`1000`) as this would clash with XRCE-DDS (see [enable MAVLINK on Ethernet](../advanced_config/ethernet_setup.md#px4-mavlink-serial-port-configuration)):
|
||||
|
||||
```sh
|
||||
nsh>
|
||||
param set MAV_2_CONFIG 0 # Change to 0 IFF value is 1000
|
||||
```
|
||||
|
||||
Then enable uXRCE-DDS on the Ethernet port (see [starting uXRCE-DDS client](../middleware/uxrce_dds.md#starting-the-client)):
|
||||
|
||||
```sh
|
||||
param set UXRCE_DDS_AG_IP 170461697 # The int32 version of 10.41.10.1
|
||||
param set UXRCE_DDS_CFG 1000 # Set Serial Configuration for uXRCE-DDS Client to Ethernet
|
||||
param set UXRCE_DDS_DOM_ID 0 # Set uXRCE-DDS domain ID
|
||||
param set UXRCE_DDS_KEY 1 # Set uXRCE-DDS session key
|
||||
param set UXRCE_DDS_PRT 8888 # Set uXRCE-DDS UDP port
|
||||
param set UXRCE_DDS_PTCFG 0 # Set uXRCE-DDS participant configuration
|
||||
param set UXRCE_DDS_SYNCC 0 # Disable uXRCE-DDS system clock synchronization
|
||||
param set UXRCE_DDS_SYNCT 1 # Enable uXRCE-DDS timestamp synchronization
|
||||
```
|
||||
|
||||
Then run the Agent:
|
||||
|
||||
```sh
|
||||
MicroXRCEAgent udp4 -p 8888
|
||||
```
|
||||
|
||||
And such output is expected if everything is set up correctly:
|
||||
|
||||
```sh
|
||||
[1731210063.537033] info | UDPv4AgentLinux.cpp | init | running... | port: 8888
|
||||
[1731210063.538279] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4
|
||||
[1731210066.577413] info | Root.cpp | create_client | create | client_key: 0x00000001, session_id: 0x81
|
||||
[1731210066.577515] info | SessionManager.hpp | establish_session | session established | client_key: 0x00000001, address: 10.41.10.2:58900
|
||||
[1731210066.583965] info | ProxyClient.cpp | create_participant | participant created | client_key: 0x00000001, participant_id: 0x001(1)
|
||||
[1731210066.584754] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x00000001, topic_id: 0x800(2), participant_id: 0x001(1)
|
||||
[1731210066.584988] info | ProxyClient.cpp | create_subscriber | subscriber created | client_key: 0x00000001, subscriber_id: 0x800(4), participant_id: 0x001(1)
|
||||
[1731210066.589864] info | ProxyClient.cpp | create_datareader | datareader created | client_key: 0x00000001, datareader_id: 0x800(6), subscriber_id: 0x800(4)
|
||||
[1731210066.591007] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x00000001, topic_id: 0x801(2), participant_id: 0x001(1)
|
||||
[1731210066.591164] info | ProxyClient.cpp | create_subscriber | subscriber created | client_key: 0x00000001, subscriber_id: 0x801(4), participant_id: 0x001(1)
|
||||
[1731210066.591912] info | ProxyClient.cpp | create_datareader | datareader created | client_key: 0x00000001, datareader_id: 0x801(6), subscriber_id: 0x801(4)
|
||||
[1731210066.592701] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x00000001, topic_id: 0x802(2), participant_id: 0x001(1)
|
||||
[1731210066.592846] info | ProxyClient.cpp | create_subscriber | subscriber created | client_key: 0x00000001, subscriber_id: 0x802(4), participant_id: 0x001(1)
|
||||
[1731210066.593640] info | ProxyClient.cpp | create_datareader | datareader created | client_key: 0x00000001, datareader_id: 0x802(6), subscriber_id: 0x802(4)
|
||||
[1731210066.594749] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x00000001, topic_id: 0x803(2), participant_id: 0x001(1)
|
||||
[1731210066.594883] info | ProxyClient.cpp | create_subscriber | subscriber created | client_key: 0x00000001, subscriber_id: 0x803(4), participant_id: 0x001(1)
|
||||
[1731210066.595592] info | ProxyClient.cpp | create_datareader | datareader created | client_key: 0x00000001, datareader_id: 0x803(6), subscriber_id: 0x803(4)
|
||||
[1731210066.596188] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x00000001, topic_id: 0x804(2), participant_id: 0x001(1)
|
||||
[1731210066.596334] info | ProxyClient.cpp | create_subscriber | subscriber created | client_key: 0x00000001, subscriber_id: 0x804(4), participant_id: 0x001(1)
|
||||
[1731210066.597046] info | ProxyClient.cpp | create_datareader | datareader created | client_key: 0x00000001, datareader_id: 0x804(6), subscriber_id: 0x804(4)
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- [Get The Pixhawk Raspberry Pi CM4 Baseboard By Holybro Talking With PX4](https://px4.io/get-the-pixhawk-raspberry-pi-cm4-baseboard-by-holybro-talking-with-px4/) (px4.io blog):
|
||||
- 展示如何通过有线以太网连接 Pixhawk 6X + Raspberry Pi 到 CM4 主板。
|
||||
@@ -0,0 +1,98 @@
|
||||
# 机载电脑
|
||||
|
||||
Companion computers ("mission computers"), are separate on-vehicle computers that are connected to the flight controller, and which enable computationally expensive features like [collision prevention](../computer_vision/collision_prevention.md).
|
||||
|
||||
下图显示了一个可能的无人驾驶架构,其中包括飞控和机载计算机。
|
||||
|
||||

|
||||
|
||||
<!-- source for drawing: https://docs.google.com/drawings/d/1ZDSyj5djKCEbabgx8K4ESdTeEUizgEt8spUWrMGbHUE/edit?usp=sharing -->
|
||||
|
||||
飞控在 NuttX 上运行 PX4, 提供核心飞控和安全代码。
|
||||
机载计算机通常运行 Linux, 因为这是一个“通用”软件开发的更好平台。
|
||||
They are connected using a fast serial or Ethernet link, and typically communicate using the [MAVLink protocol](https://mavlink.io/en/) or uXRCE-DDS.
|
||||
|
||||
Communications with the ground stations and the cloud are usually routed via the companion computer (e.g. using the [MAVLink Router](https://github.com/mavlink-router/mavlink-router)).
|
||||
|
||||
## Pixhawk 自动驾驶仪总线载板与机载计算机
|
||||
|
||||
The following carrier boards make it easy to integrate Pixhawk flight controllers with a companion computer, significantly easing both hardware and software setup.
|
||||
The boards support the [Pixhawk Autopilot Bus (PAB)](../flight_controller/pixhawk_autopilot_bus.md) open standard so you can plug in any compliant controller:
|
||||
|
||||
- [ARK Jetson PAB Carrier](../companion_computer/ark_jetson_pab_carrier.md)
|
||||
- [Holybro Pixhawk Jetson Baseboard](../companion_computer/holybro_pixhawk_jetson_baseboard.md)
|
||||
- [Holybro Pixhawk RPi CM4 Baseboard](../companion_computer/holybro_pixhawk_rpi_cm4_baseboard.md)
|
||||
|
||||
## 管理集成系统
|
||||
|
||||
以下集成的机载计算机/飞控系统默认使用受控/自定义版本的飞控和机载计算机软件。
|
||||
它们在这里列出,因为它们可以使用 "vanilla" PX4 固件进行更新,以进行测试/快速开发。
|
||||
|
||||
- [Auterion Skynode](../companion_computer/auterion_skynode.md)
|
||||
- [ModalAI VOXL 2](https://docs.modalai.com/voxl-2/)
|
||||
|
||||
## 机载计算机选项
|
||||
|
||||
PX4 可以与计算机一起使用,可以配置为通过基于串口(或以太网端口) 的 MAVLink 或 microROS/uXRCE-DDS 进行通信。
|
||||
以下列出了一小部分可能的替代方案。
|
||||
|
||||
高性能计算机:
|
||||
|
||||
- [ModalAI VOXL 2](https://docs.modalai.com/voxl2-external-flight-controller/)
|
||||
- [NXP NavQPlus](https://nxp.gitbook.io/navqplus/user-contributed-content/ros2/microdds)
|
||||
- [Nvidia Jetson TX2](https://developer.nvidia.com/embedded/jetson-tx2)
|
||||
|
||||
* [Intel NUC](https://www.intel.com/content/www/us/en/products/details/nuc.html)
|
||||
* [Gigabyte Brix](https://www.gigabyte.com/Mini-PcBarebone/BRIX)
|
||||
|
||||
小型/低功耗设备如:
|
||||
|
||||
- [Raspberry Pi](../companion_computer/pixhawk_rpi.md)
|
||||
|
||||
:::info
|
||||
The choice of computer will depend on the usual tradeoffs: cost, weight, power consumption, ease of setup, and computational resources required.
|
||||
:::
|
||||
|
||||
## 机载计算机软件
|
||||
|
||||
机载计算机需要运行能与飞控通信的软件,并将消息路由到地面站和云端。
|
||||
|
||||
#### 无人机应用程序
|
||||
|
||||
Drone API 和 SDK 允许您编写能够控制 PX4 的软件。
|
||||
Popular alternatives include:
|
||||
|
||||
- [MAVSDK](https://mavsdk.mavlink.io/main/en/index.html) - libraries in various programming languages to interface with MAVLink systems such as drones, cameras or ground systems.
|
||||
- [ROS 2](../ros2/index.md) to communicate to ROS 2 nodes (may also be used).
|
||||
- [ROS 1 and MAVROS](../ros/mavros_installation.md)
|
||||
|
||||
MAVSDK 通常更容易学习和使用,而 ROS 提供更多预先编写的软件,用于像计算机视觉这样的高级案例。
|
||||
[Drone APIs and SDKs > What API Should I Use?](../robotics/index.md#what-api-should-i-use) explains the different options in detail.
|
||||
|
||||
您还可以从头开始编写您的自定义 MAVLink 库:
|
||||
|
||||
- [C/C++ example code](https://github.com/mavlink/c_uart_interface_example) shows how to connect custom code
|
||||
- MAVLink also can also be used with [many other programming languages](https://mavlink.io/en/#mavlink-project-generatorslanguages)
|
||||
|
||||
#### 路由
|
||||
|
||||
如果您需要将 MAVLink 从载具桥接到地面站或 IP 网络,您将需要一个路由器。 或者如果您需要多个连接:
|
||||
|
||||
- [MAVLink Router](https://github.com/intel/mavlink-router) (recommended)
|
||||
- [MAVProxy](https://ardupilot.org/mavproxy/)
|
||||
|
||||
## 以太网设置
|
||||
|
||||
以太网是推荐的连接方式,如果飞行控制器支持的话。
|
||||
See [Ethernet Setup](../advanced_config/ethernet_setup.md) for instructions.
|
||||
|
||||
## 飞控特定设置
|
||||
|
||||
以下章节介绍了如何为特定的飞控设置机载计算机,特别是当您不是使用以太网连接时。
|
||||
|
||||
- [Using a Companion Computer with Pixhawk Controllers](../companion_computer/pixhawk_companion.md)
|
||||
|
||||
## 附加信息
|
||||
|
||||
- [Companion Computer Peripherals](../companion_computer/companion_computer_peripherals.md)
|
||||
- [PX4 System Architecture > FC and Companion Computer](../concept/px4_systems_architecture.md#fc-and-companion-computer)
|
||||
@@ -0,0 +1,106 @@
|
||||
# 使用机载计算机与 Pixhawk 控制器
|
||||
|
||||
PX4 running on Pixhawk-series flight controllers can connect to a companion computer using any free configurable serial port, including the Ethernet port (if supported).
|
||||
|
||||
See [Companion Computers](../companion_computer/index.md) for information about supported hardware and general setup.
|
||||
|
||||
## 机载计算机软件
|
||||
|
||||
机载计算机需要运行能与飞控通信的软件,并将消息路由到地面站和云端。
|
||||
|
||||
Common options are listed in [Companion Computers > Companion Computer Setup](../companion_computer/index.md#companion-computer-software).
|
||||
|
||||
## 以太网设置
|
||||
|
||||
以太网是推荐的连接方式,如果飞行控制器支持的话。
|
||||
See [Ethernet Setup](../advanced_config/ethernet_setup.md) for instructions.
|
||||
|
||||
## Serial Port Setup
|
||||
|
||||
These instructions explain how to setup the connection if you're not using Ethernet.
|
||||
|
||||
### Pixhawk Configuration
|
||||
|
||||
PX4 expects companion computers to connect via `TELEM2` for offboard control.
|
||||
The port is configured by default to interface using MAVLink.
|
||||
|
||||
If using MAVLink, no other PX4-side configuration should be required.
|
||||
To use MAVLink on another port, and/or disable it on `TELEM2`, see [MAVLink Peripherals (GCS/OSD/Companion)](../peripherals/mavlink_peripherals.md) and [Serial Port Configuration](../peripherals/serial_configuration.md).
|
||||
|
||||
To use [ROS 2/uXRCE-DDS](../ros2/user_guide.md) instead of MAVLink on `TELEM2`, disable MAVLink on the port and then enable the uXRCE-DDS client on `TELEM2`(see [uXRCE-DDS > Starting the client](../middleware/uxrce_dds.md#starting-the-client)).
|
||||
|
||||
### Serial Port Hardware Setup
|
||||
|
||||
If you're connecting using a serial port, wire the port according to the instructions below.
|
||||
All Pixhawk serial ports operate at 3.3V and are 5V level compatible.
|
||||
|
||||
:::warning
|
||||
Many modern companion computers only support 1.8V levels on their hardware UART and can be damaged by 3.3V levels.
|
||||
Use a level shifter.
|
||||
In most cases the accessible hardware serial ports already have some function (modem or console) associated with them and need to be _reconfigured in Linux_ before they can be used.
|
||||
:::
|
||||
|
||||
A safe and easy to set up option is to use an FTDI Chip USB-to-serial adapter board to connect from `TELEM2` on the Pixhawk to the USB port on the companion computer.
|
||||
The `TELEM2` to FTDI wiring map is shown below.
|
||||
|
||||
| TELEM2 | | FTDI | &nbsp; |
|
||||
| ------ | ---------------------------- | ---- | -------------------------------- |
|
||||
| 1 | + 5v (红色) | | DO NOT CONNECT! |
|
||||
| 2 | 2 | 5 | 5 |
|
||||
| 3 | 3 | 4 | 4 |
|
||||
| 4 | CTS(输入) | 6 | 6 |
|
||||
| 5 | RTS(输出) | 2 | 2 |
|
||||
| 6 | GND | 1 | FTDI GND (黑色) |
|
||||
|
||||
You may also be able to directly connect `TELEM2` directly to a companion computer serial port.
|
||||
This is demonstrated for the Raspberry Pi in [Raspberry Pi Companion with Pixhawk](../companion_computer/pixhawk_rpi.md).
|
||||
|
||||
### USB Serial Port Software setup on Linux
|
||||
|
||||
On Linux the default name of a USB FTDI would be like `\dev\ttyUSB0`.
|
||||
If you have a second FTDI linked on the USB or an Arduino, it will registered as `\dev\ttyUSB1`.
|
||||
To avoid the confusion between the first plugged and the second plugged, we recommend you to create a symlink from `ttyUSBx` to a friendly name, depending on the Vendor and Product ID of the USB device.
|
||||
|
||||
Using `lsusb` we can get the vendor and product IDs.
|
||||
|
||||
```sh
|
||||
$lsusb
|
||||
总线006 设备002:ID 0BDA:8153 Realtek 半导体公司
|
||||
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
|
||||
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
|
||||
Bus 004 Device 002: ID 05e3:0616 Genesys Logic, Inc.
|
||||
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
|
||||
Bus 003 Device 004: ID 2341:0042 Arduino SA Mega 2560 R3 (CDC ACM)
|
||||
Bus 003 Device 005: ID 26ac:0011
|
||||
Bus 003 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
|
||||
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
|
||||
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
|
||||
Bus 001 Device 002: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
|
||||
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
|
||||
```
|
||||
|
||||
The Arduino is `Bus 003 Device 004: ID 2341:0042 Arduino SA Mega 2560 R3 (CDC ACM)`
|
||||
|
||||
The Pixhawk is `Bus 003 Device 005: ID 26ac:0011`
|
||||
|
||||
:::info
|
||||
If you do not find your device, unplug it, execute `lsusb`, plug it, execute `lsusb` again and see the added device.
|
||||
:::
|
||||
|
||||
Therefore, we can create a new UDEV rule in a file called `/etc/udev/rules.d/99-pixhawk.rules` with the following content, changing the idVendor and idProduct to yours.
|
||||
|
||||
```sh
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0042", SYMLINK+="ttyArduino"
|
||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="26ac", ATTRS{idProduct}=="0011", SYMLINK+="ttyPixhawk"
|
||||
```
|
||||
|
||||
Finally, after a **reboot** you can be sure to know which device is what and put `/dev/ttyPixhawk` instead of `/dev/ttyUSB0` in your scripts.
|
||||
|
||||
:::info
|
||||
Be sure to add yourself in the `tty` and `dialout` groups via `usermod` to avoid to have to execute scripts as root.
|
||||
:::
|
||||
|
||||
```sh
|
||||
usermod -a -G tty ros-user
|
||||
usermod -a -G dialout ros-user
|
||||
```
|
||||
@@ -0,0 +1,339 @@
|
||||
# Raspberry Pi Companion with Pixhawk
|
||||
|
||||
This topic describes how to setup a Raspberry Pi ("RPi") companion companion running [ROS 2](../ros2/user_guide.md) on Linux Ubuntu OS, connecting to a [Pixhawk](../flight_controller/autopilot_pixhawk_standard.md) flight controller using a serial connection between the Pixhawk `TELEM2` port and the RPi's TX/RX pins.
|
||||
|
||||
These instructions should be readily extensible to other RPi and flight controller configurations.
|
||||
|
||||
:::info
|
||||
Other common ways to connect RPi and Pixhawk are:
|
||||
|
||||
- Ethernet connection between RPi and Pixhawk.
|
||||
Pixhawk controllers based on FMUv5x, FMUv6x and later may have an inbuilt Ethernet port.
|
||||
See [PX4 Ethernet > Supported Controllers](../advanced_config/ethernet_setup.md#supported-flight-controllers).
|
||||
- Serial connection to the RPi USB port.
|
||||
This is simple and reliable, but requires an additional FTDI Chip USB-to-serial adapter board.
|
||||
This option is covered in [Pixhawk Companion > Serial Port Setup](../companion_computer/pixhawk_companion.md#serial-port-setup).
|
||||
|
||||
:::
|
||||
|
||||
## 布线
|
||||
|
||||
### Serial connection
|
||||
|
||||
First wire up the serial connection between the RPi and PX4 that is to be used for offboard control.
|
||||
|
||||
This setup connects the Pixhawk `TELEM2` port, which is generally recommended for offboard control.
|
||||
It is initially configured in PX4 to use with MAVLink, which we will change later when setting up ROS 2.
|
||||
Pixhawk ports can be located anywhere on the flight controller, but are almost always well labeled, and should be obvious on your particular [flight controller](../flight_controller/index.md).
|
||||
|
||||
Connect the Pixhawk `TELEM2` `TX`/`RX`/`GND` pins to the complementary `RXD`/`TXD`/`Ground` pins on the RPi GPIO board:
|
||||
|
||||
| PX4 TELEM2 Pin | RPi GPIO Pin |
|
||||
| ---------------------------------------------------- | ----------------------------------------- |
|
||||
| UART5_TX (2) | RXD (GPIO 15 - pin 10) |
|
||||
| UART5_RX (3) | TXD (GPIO 14 - pin 8) |
|
||||
| GND (6) | Ground (pin 6) |
|
||||
|
||||
The diagram shows Pixhawk `TELEM2` port pins on the left and RPi GPIO board pins on the right.
|
||||
The pins on the `TELEM2` port are normally numbered right-to-left as shown.
|
||||
|
||||
| `TELEM2` | RPi GPIO |
|
||||
| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
|
||||
|  |  |
|
||||
|
||||
:::info
|
||||
Almost all recent Pixhawk boards, such as the Pixhawk-6C, use the same connectors and pin numbers for corresponding ports, as defined in the Pixhawk Connector Standard.
|
||||
You can check the specific board documentation to confirm the pin layout.
|
||||
|
||||
The standard `TELEM2` pin assignments are shown below.
|
||||
|
||||
| Pins | 信号 | Voltage |
|
||||
| ---------------------------- | ------------------------------------------------------- | --------------------- |
|
||||
| 1 (Red) | VCC | +5V |
|
||||
| 2 (Black) | UART5_TX (out) | +3.3V |
|
||||
| 3 (Black) | UART5_RX (in) | +3.3V |
|
||||
| 4 (Black) | UART5_CTS (in) | +3.3V |
|
||||
| 5 (Black) | UART5_RTS (out) | +3.3V |
|
||||
| 6 (Black) | GND | GND |
|
||||
|
||||
:::
|
||||
|
||||
### TELEM1/Telemetry Radio
|
||||
|
||||
The Pixhawk `TELEM1` port is preconfigured for connecting to a GCS via MAVLink over a telemetry radio.
|
||||
|
||||
You can plug an [appropriate radio](../telemetry/index.md) into the Pixhawk `TELEM1` port and in most cases it should just work.
|
||||
Generally the other radio needs to be connected to the ground station USB port.
|
||||
If you have any issues, check the radio documentation.
|
||||
|
||||
### Power Supply
|
||||
|
||||
Pixhawk boards usually require a reliable 5V DC supply, which is commonly supplied from LiPO batteries via a [Power Module and/or Power Distribution board](../power_module/index.md) to a port labeled `POWER` (or similar).
|
||||
|
||||
The instructions for your flight controller will normally explain the recommended setup.
|
||||
例如:
|
||||
|
||||
- [Holybro Pixhawk 6C > Voltage Ratings](../flight_controller/pixhawk6c.md#voltage-ratings)
|
||||
- [Holybro Pixhawk 6C Wiring Quick Start > Power](../assembly/quick_start_pixhawk6c.md#power)
|
||||
|
||||
Pixhawk controllers can supply power to a _small_ number of low-power peripherals, such as GPS modules and low-range telemetry radios.
|
||||
The RPi companion computer, servos, high power radios, and other peripherals require a separate power supply, which is usually from a battery elimination circuit (BEC) wired to the same or another battery.
|
||||
Some power modules have a separate BEC included.
|
||||
|
||||
:::warning
|
||||
Overloading your Pixhawk is a good way to destroy it.
|
||||
:::
|
||||
|
||||
:::info
|
||||
During PX4 setup and configuration the USB connection with your ground station laptop is sufficient to power the Pixhawk board, and your companion computer might be powered from a desktop charger.
|
||||
:::
|
||||
|
||||
## PX4 Setup
|
||||
|
||||
These instructions work on PX4 v1.14 and later.
|
||||
|
||||
If you need to update the firmware then connect the Pixhawk to your laptop/desktop via the `USB` port and use QGroundControl to update the firmware as described [Firmware > Install Stable PX4](../config/firmware.md#install-stable-px4).
|
||||
If you want the latest developer version then update the firmware to the "main" as described in [Firmware > Installing PX4 Master, Beta or Custom Firmware](../config/firmware.md#installing-px4-main-beta-or-custom-firmware).
|
||||
|
||||
:::info
|
||||
You can alternatively [setup a development environment](../dev_setup/dev_env.md), [build](../dev_setup/building_px4.md#building-for-nuttx) and [upload](../dev_setup/building_px4.md#uploading-firmware-flashing-the-board) the firmware manually.
|
||||
:::
|
||||
|
||||
<!-- Keeping this line as record - this is only unexpected dependency:
|
||||
```
|
||||
sudo apt -y install stlink-tools
|
||||
```
|
||||
-->
|
||||
|
||||
<!-- Keeping this because we might need it for updating linux instructions
|
||||
On Linux, the default name of a USB connection is `/dev/ttyACM0`:
|
||||
|
||||
```
|
||||
sudo chmod a+rw /dev/ttyACM0
|
||||
cd /PX4-Autopilot
|
||||
make px4_fmu-v6c_default upload
|
||||
```
|
||||
-->
|
||||
|
||||
## Ubuntu Setup on RPi
|
||||
|
||||
The following steps show how to install and setup Ubuntu 22.04 on the RPi.
|
||||
Note that ROS 2 versions target particular Ubuntu versions.
|
||||
We're using Ubuntu 22.04 to match ROS 2 "Humble", so if you're working with ROS 2 "Foxy" you would instead install Ubuntu 20.04.
|
||||
|
||||
First install Ubuntu onto the RPi:
|
||||
|
||||
1. Prepare a Ubuntu 22.04 bootable Ubuntu Desktop SD card by following the official tutorial: [How to install Ubuntu Desktop on Raspberry Pi 4](https://ubuntu.com/tutorials/how-to-install-ubuntu-desktop-on-raspberry-pi-4#1-overview)
|
||||
2. Connect the mouse, keyboard, monitor and connect the RPi to a 5V Power Supply (external source/charger).
|
||||
3. Insert the SD card into the RPi and turn on the RPi to boot from the SD card.
|
||||
4. Follow the on-screen instructions to install Ubuntu.
|
||||
|
||||
Enter the following commands (in sequence) a terminal to configure Ubuntu for RPi:
|
||||
|
||||
1. Install `raspi-config`:
|
||||
|
||||
```sh
|
||||
sudo apt update
|
||||
sudo apt upgrade
|
||||
sudo apt-get install raspi-config
|
||||
```
|
||||
|
||||
2. Open `raspi-config`:
|
||||
|
||||
```sh
|
||||
sudo raspi-config
|
||||
```
|
||||
|
||||
3. Go to the **Interface Option** and then click **Serial Port**.
|
||||
|
||||
- Select **No** to disable serial login shell.
|
||||
- Select **Yes** to enable the serial interface.
|
||||
- Click **Finish** and restart the RPi.
|
||||
|
||||
4. Open the firmware boot configuration file in the `nano` editor on RPi:
|
||||
|
||||
```sh
|
||||
sudo nano /boot/firmware/config.txt
|
||||
```
|
||||
|
||||
5. Append the following text to the end of the file (after the last line):
|
||||
|
||||
```sh
|
||||
enable_uart=1
|
||||
dtoverlay=disable-bt
|
||||
```
|
||||
|
||||
6. Then save the file and restart the RPi.
|
||||
|
||||
- In `nano` you can save the file using the following sequence of keyboard shortcuts: **ctrl+x**, **ctrl+y**, **Enter**.
|
||||
|
||||
7. Check that the serial port is available.
|
||||
In this case we use the following terminal commands to list the serial devices:
|
||||
|
||||
```sh
|
||||
cd /
|
||||
ls /dev/ttyAMA0
|
||||
```
|
||||
|
||||
The result of the command should include the RX/TX connection `/dev/ttyAMA0` (note that this serial port is also available as `/dev/serial0`).
|
||||
|
||||
The RPi is now setup to work with RPi and communicate using the `/dev/ttyAMA0` serial port.
|
||||
Note that we'll install more software in the following sections to work with MAVLink and ROS 2.
|
||||
|
||||
## MAVLink Communication
|
||||
|
||||
[MAVLink](https://mavlink.io/en/) is the default and stable communication interface for working with PX4.
|
||||
MAVLink applications running on the companion computer can connect to the `/dev/ttyAMA0` serial port you just set up on the RPi and should automatically (by default) connect to `TELEM 2` on the Pixhawk.
|
||||
|
||||
PX4 recommends [MAVSDK](https://mavsdk.mavlink.io/main/en/index.html) for writing MAVLink companion computer applications, as it provides simple APIs for using many common MAVLink services in many different programming languages.
|
||||
You can also write applications using the libraries provided by [MAVLink](https://mavlink.io/en/#mavlink-project-generatorslanguages), such as [Pymavlink](https://mavlink.io/en/mavgen_python/), but then you are more likely to have to provide your own implementations of some microservices.
|
||||
|
||||
For this tutorial we're not going to go into MAVLink control in any detail (it is well covered in the respective SDKs).
|
||||
However we will install and use a simple developer MAVLink GCS called `mavproxy`.
|
||||
This will allow us to verify the MAVLink connection, and therefore that our physical connection has been set up properly.
|
||||
A very similar connection pattern would be used for MAVSDK and other MAVLink applications.
|
||||
|
||||
First check the Pixhawk `TELEM 2` configuration:
|
||||
|
||||
1. Connect the Pixhawk with the laptop using a USB cable.
|
||||
2. Open QGroundControl (the vehicle should connect).
|
||||
3. [Check/change the following parameters](../advanced_config/parameters.md) in QGroundControl:
|
||||
|
||||
```ini
|
||||
MAV_1_CONFIG = TELEM2
|
||||
UXRCE_DDS_CFG = 0 (Disabled)
|
||||
SER_TEL2_BAUD = 57600
|
||||
```
|
||||
|
||||
Note that the parameters may already be set appropriately.
|
||||
For information about how serial ports and MAVLink configuration work see [Serial Port Configuration](../peripherals/serial_configuration.md) and [MAVLink Peripherals](../peripherals/mavlink_peripherals.md).
|
||||
|
||||
Then install setup MAVProxy on the RPi using the following terminal commands:
|
||||
|
||||
1. Install MAVProxy:
|
||||
|
||||
```sh
|
||||
sudo apt install python3-pip
|
||||
sudo pip3 install mavproxy
|
||||
sudo apt remove modemmanager
|
||||
```
|
||||
|
||||
2. Run MAVProxy, setting the port to connect to `/dev/ttyAMA0` and the baud rate to match the PX4:
|
||||
|
||||
```sh
|
||||
sudo mavproxy.py --master=/dev/serial0 --baudrate 57600
|
||||
```
|
||||
|
||||
::: info
|
||||
Note that above we used `/dev/serial0`, but we could equally well have used `/dev/ttyAMA0`.
|
||||
If we were connecting via USB then we would instead set the port as `/dev/ttyACM0`:
|
||||
|
||||
```sh
|
||||
sudo chmod a+rw /dev/ttyACM0
|
||||
sudo mavproxy.py --master=/dev/ttyACM0 --baudrate 57600
|
||||
```
|
||||
|
||||
|
||||
:::
|
||||
|
||||
MAVProxy on RPi should now connect to the Pixhawk, via RX/TX pins.
|
||||
You should be able to see this in the RPi terminal.
|
||||
|
||||
We have now verified that our connection is wired up properly.
|
||||
In the next section we'll set up the both Pixhawk and RPi to use uXRCE-DDS and ROS2 instead of MAVLink.
|
||||
|
||||
## ROS 2 and uXRCE-DDS
|
||||
|
||||
The [ROS 2 Guide](../ros2/user_guide.md) and [uXRCE-DDS](../middleware/uxrce_dds.md) pages cover the options for setting up the uXRCE-DDS and ROS, focussing on ROS 2 "Foxy".
|
||||
This tutorial uses ROS 2 "Humble" and covers the specific setup for working with RPi.
|
||||
It is worth reading both!
|
||||
|
||||
### Pixhawk/PX4 Setup
|
||||
|
||||
Next we set up ROS 2 instead of MAVLink on `TELEM2`.
|
||||
We do this by changing parameters in QGroundControl, which can be connected via USB, or using a telemetry radio connected to `TELEM1`.
|
||||
|
||||
The configuration steps are:
|
||||
|
||||
1. Connect the Pixhawk with the laptop using a USB cable and open QGroundControl (if not currently connected).
|
||||
|
||||
2. [Check/change the following parameters](../advanced_config/parameters.md) in QGroundControl:
|
||||
|
||||
```ini
|
||||
MAV_1_CONFIG = 0 (Disabled)
|
||||
UXRCE_DDS_CFG = 102 (TELEM2)
|
||||
SER_TEL2_BAUD = 921600
|
||||
```
|
||||
|
||||
[MAV_1_CONFIG=0](../advanced_config/parameter_reference.md#MAV_1_CONFIG) and [UXRCE_DDS_CFG=102](../advanced_config/parameter_reference.md#UXRCE_DDS_CFG) disable MAVLink on TELEM2 and enable the uXRCE-DDS client on TELEM2, respectively.
|
||||
The `SER_TEL2_BAUD` rate sets the comms link data rate.\
|
||||
You could similarly configure a connection to `TELEM1` using either `MAV_1_CONFIG` or `MAV_0_CONFIG`.
|
||||
|
||||
::: info
|
||||
You will need to reboot the flight controller to apply any changes to these parameters.
|
||||
|
||||
:::
|
||||
|
||||
3. Check that the [uxrce_dds_client](../modules/modules_system.md#uxrce-dds-client) module is now running.
|
||||
YOu can do this by running the following command in the QGroundControl [MAVLink Console](https://docs.qgroundcontrol.com/master/en/qgc-user-guide/analyze_view/mavlink_console.html):
|
||||
|
||||
```sh
|
||||
uxrce_dds_client status
|
||||
```
|
||||
|
||||
:::info
|
||||
If the client module is not running you can start it manually in the MAVLink console:
|
||||
|
||||
```sh
|
||||
uxrce_dds_client start -t serial -d /dev/ttyS3 -b 921600
|
||||
```
|
||||
|
||||
Note that `/dev/ttyS3` is the PX4 port for `TELEM2` on the [Holybro Pixhawk 6c](../flight_controller/pixhawk6c.md#serial-port-mapping).
|
||||
For other flight controllers check the serial port mapping section in their overview page.
|
||||
:::
|
||||
|
||||
### ROS Setup on RPi
|
||||
|
||||
The steps to setup ROS 2 and the Micro XRCE-DDS Agent on the RPi are:
|
||||
|
||||
1. Install ROS 2 Humble by following the [official tutorial](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html).
|
||||
|
||||
2. Install the git using the RPi terminal:
|
||||
|
||||
```sh
|
||||
sudo apt install git
|
||||
```
|
||||
|
||||
3. Install the uXRCE_DDS agent:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
|
||||
cd Micro-XRCE-DDS-Agent
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
sudo make install
|
||||
sudo ldconfig /usr/local/lib/
|
||||
```
|
||||
|
||||
See [uXRCE-DDS > Micro XRCE-DDS Agent Installation](../middleware/uxrce_dds.md#micro-xrce-dds-agent-installation) for alternative ways of installing the agent.
|
||||
|
||||
4. Start the agent in the RPi terminal:
|
||||
|
||||
```sh
|
||||
sudo MicroXRCEAgent serial --dev /dev/serial0 -b 921600
|
||||
```
|
||||
|
||||
Note how we use the serial port set up earlier and the same baud rate as for PX4.
|
||||
|
||||
Now that both the agent and client are running, you should see activity on both the MAVLink console and the RPi terminal.
|
||||
You can view the available topics using the following command on the RPi:
|
||||
|
||||
```sh
|
||||
source /opt/ros/humble/setup.bash
|
||||
ros2 topic list
|
||||
```
|
||||
|
||||
That's it.
|
||||
Once you have the connection working, see the [ROS 2 Guide](../ros2/user_guide.md) for more information about working with PX4 and ROS 2.
|
||||
@@ -0,0 +1,85 @@
|
||||
# Video Streaming (Companion Computer/QGroundControl)
|
||||
|
||||
PX4-based vehicles support video streaming using a camera connected to a [companion computer](../companion_computer/index.md).
|
||||
|
||||
:::info
|
||||
You can't video stream directly from a camera connected to PX4.
|
||||
:::
|
||||
|
||||
GStreamer is used to send the video to _QGroundControl_ over an IP link.
|
||||
To support streaming use cases you will need to install _GStreamer_ development packages on both your companion computer and on the system running _QGroundControl_.
|
||||
_QGroundControl_ uses GStreamer 1.18.1 and a stripped down version of _QtGstreamer_ to support UDP RTP and RSTP video streaming.
|
||||
|
||||
## 机载计算机设置
|
||||
|
||||
You will need to install the _GStreamer_ packages that match those used by QGC.
|
||||
|
||||
For a Ubuntu companion, a minimal set might be:
|
||||
|
||||
```sh
|
||||
sudo apt install gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl -y
|
||||
```
|
||||
|
||||
For the full set you can mirror the QGC dependencies installed by [/tools/setup/install-dependencies-debian.sh](https://github.com/mavlink/qgroundcontrol/blob/master/tools/setup/install-dependencies-debian.sh).
|
||||
At time of writing this is:
|
||||
|
||||
```sh
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -y --quiet install \
|
||||
libgstreamer1.0-dev \
|
||||
libgstreamer-plugins-bad1.0-dev \
|
||||
libgstreamer-plugins-base1.0-dev \
|
||||
libgstreamer-plugins-good1.0-dev \
|
||||
libgstreamer-gl1.0-0 \
|
||||
gstreamer1.0-plugins-bad \
|
||||
gstreamer1.0-plugins-base \
|
||||
gstreamer1.0-plugins-good \
|
||||
gstreamer1.0-plugins-ugly \
|
||||
gstreamer1.0-plugins-rtp \
|
||||
gstreamer1.0-gl \
|
||||
gstreamer1.0-libav \
|
||||
gstreamer1.0-rtsp \
|
||||
gstreamer1.0-vaapi \
|
||||
gstreamer1.0-x
|
||||
```
|
||||
|
||||
:::tip
|
||||
For other companion platforms you can mirror the instructions in the [corresponding installation scripts](https://github.com/mavlink/qgroundcontrol/tree/master/tools/setup).
|
||||
:::
|
||||
|
||||
General instructions for starting the stream on a companion computer are provided in the [QGroundControl VideoReceiver GStreamer README](https://github.com/mavlink/qgroundcontrol/blob/master/src/VideoManager/VideoReceiver/GStreamer/README.md).
|
||||
|
||||
The setup of cameras and data links depends on many factors.
|
||||
Examples in this library are listed below (note, these are options, not "recommended"):
|
||||
|
||||
- [Video Streaming using WFB-ng Wifi](../companion_computer/video_streaming_wfb_ng_wifi.md) (Tutorial): Using RPi and WiFi module in unconnected (broadcast) mode to stream video and as a bidirectional telemetry link.
|
||||
|
||||
## QGC Setup
|
||||
|
||||
To setup and use video steaming with QGC:
|
||||
|
||||
1. Install GStreamer if using Ubuntu QGC 4 release builds (or earlier)
|
||||
|
||||
::: tip
|
||||
All other QGroundControl builds include GStreamer binaries, including daily builds, release builds after version 4, and builds for other platforms include GStreamer binaries.
|
||||
|
||||
:::
|
||||
|
||||
Install the runtime dependencies using the command:
|
||||
|
||||
```sh
|
||||
sudo apt install gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl -y
|
||||
```
|
||||
|
||||
2. Start QGC
|
||||
|
||||
3. Enable video in _Fly View_: [QGroundControl > General Settings (Settings View) > Video](https://docs.qgroundcontrol.com/master/en/qgc-user-guide/settings_view/general.html#video)
|
||||
|
||||
4. If everything works, you should see the video stream displayed in the QGC Video Switcher (QGC Fly View bottom left corner).
|
||||
You can click on the video switcher to toggle the video full-screen, as shown in the screenshot below.
|
||||
|
||||

|
||||
|
||||
## Gazebo Classic 模拟
|
||||
|
||||
[Gazebo Classic](../sim_gazebo_classic/index.md) supports video streaming from within the simulated environment.
|
||||
For more information see [Gazebo Classic Simulation > Video Streaming](../sim_gazebo_classic/index.md#video-streaming).
|
||||
@@ -0,0 +1,173 @@
|
||||
# Video Streaming Data-link using WiFi in Raw Mode (WFB-ng)
|
||||
|
||||
This tutorial shows how to set up a [companion computer](../companion_computer/index.md) with a Logitech C920 or RaspberryPi camera, such that the video stream is transferred from the UAV to a ground computer and displayed in _QGroundControl_.
|
||||
The setup uses WiFi in unconnected (broadcast) mode and software from the [WFB-ng project](https://github.com/svpcom/wfb-ng).
|
||||
|
||||
The channel can also be used as a bidirectional [telemetry](../telemetry/index.md) link and TCP/IP tunnel for drone control during flight.
|
||||
If you manually control the drone with a Joystick from QGroundControl (which uses MAVLink) then you can use WFB-ng as single link for all drone communications (Video, MAVLink telemetry, remote control using a Joystick).
|
||||
|
||||
:::warning
|
||||
Before using _WFB-ng_ check regulators allow this kind of WiFi use in your country.
|
||||
:::
|
||||
|
||||
## WFB-ng Overview
|
||||
|
||||
The _WFB-ng project_ provides a data transport that use low-level WiFi packets to avoid the distance and latency limitations of the ordinary IEEE 802.11 stack.
|
||||
|
||||
The high level benefits of _WFB-ng_ include:
|
||||
|
||||
- Low-latency video link.
|
||||
- Bidirectional telemetry link (MAVLink).
|
||||
- TCP/IP tunnel.
|
||||
- Automatic TX diversity - use multiple cards on the ground to avoid antenna tracker.
|
||||
- Full link encryption and authentication (using [libsodium](https://download.libsodium.org/doc/)).
|
||||
- Aggregation of MAVLink packets (pack small packets into batches before transmitting).
|
||||
- Enhanced [OSD](https://github.com/svpcom/wfb-ng-osd) for Raspberry PI or generic linux desktop with gstreamer.
|
||||
|
||||
Additional information is provided in the [FAQ](#faq) below.
|
||||
|
||||
## 硬件
|
||||
|
||||
### Vehicle Setup
|
||||
|
||||
The vehicle setup consists of:
|
||||
|
||||
- Raspberry PI 3B/3B+/ZeroW
|
||||
|
||||
- A camera.
|
||||
These have been tested:
|
||||
|
||||
- [Raspberry Pi camera](https://www.raspberrypi.org/products/camera-module-v2/) connected via CSI.
|
||||
- [Logitech camera C920](https://www.logitech.com/en-us/product/hd-pro-webcam-c920?crid=34) connected via USB
|
||||
|
||||
- WiFi module [ALPHA AWUS036ACH](https://www.alfa.com.tw/products_detail/1.htm) or any other **RTL8812au** card.
|
||||
|
||||
### Ground Station
|
||||
|
||||
- Ground Station Computer.
|
||||
These options have been tested:
|
||||
|
||||
- Any Linux computer with a USB port (tested on Ubuntu 18.04 x86-64)
|
||||
- A computer with any OS running QGround control and Raspberry PI connected via Ethernet (RPi provides the wifi connection).
|
||||
|
||||
- WiFi module [ALPHA AWUS036ACH](https://www.alfa.com.tw/products_detail/1.htm) or any other **RTL8812au** card.
|
||||
See [WFB-ng wiki > WiFi hardware](https://github.com/svpcom/wfb-ng/wiki/WiFi-hardware) for more information on supported modules.
|
||||
|
||||
## Hardware Modification
|
||||
|
||||
Alpha AWUS036ACH is a medium power card that uses a lot of current while transmitting.
|
||||
If you power it from ordinary USB2 it will reset the port on most **ARM boards**.
|
||||
If you connect it to **USB3** port via **native USB3 cable** to a **Linux laptop** you can use it without modification.
|
||||
|
||||
For **Raspberry PI** (UAV or ground) it must be directly connected to 5V BEC (or high current power adapter in case of ground pi) in one of two ways:
|
||||
|
||||
- Make a custom USB cable ([cut `+5V` wire from USB plug and connect it to BEC])(https://electronics.stackexchange.com/questions/218500/usb-charge-and-data-separate-cables)
|
||||
- Cut a `+5V` wire on PCB near USB port and wire it to BEC (don't do this if doubt - use custom cable instead).
|
||||
|
||||
You must also add a 470uF **low ESR capacitor** (like ESC has) between **card +5v and ground** to filter voltage spikes.
|
||||
You should integrate the capacitor with a custom USB cable.
|
||||
Without the capacitor you can get packet corruption or packet loss.
|
||||
Be aware of [ground loop](https://en.wikipedia.org/wiki/Ground_loop_%28electricity%29) when using several ground wires.
|
||||
|
||||
:::info
|
||||
If you use a special "very" high power cards from Taobao/Aliexpress then you MUST power it as described above in ANY case.
|
||||
:::
|
||||
|
||||
### UAV Configuration
|
||||
|
||||
1. Download Raspberry PI image from [latest wfb-ng release](https://github.com/svpcom/wfb-ng/releases/)
|
||||
2. Flash it to the **UAV** Raspberry PI
|
||||
3. Reboot it and ssh with standard credentials (pi/raspberry).
|
||||
4. Run actions for **air** role as displayed in motd.
|
||||
5. Setup camera pipeline. Open `/etc/systemd/system/fpv-camera.service` and uncomment pipeline according to your camera (PI camera or Logitech camera)
|
||||
6. Open `/etc/wifibroadcast.cfg` and configure WiFi channel according to your antenna setup (or use default #165 for 5.8GHz)
|
||||
7. Configure PX4 to output telemetry stream at speed 1500 Kbps (other UART speeds doesn't match well to RPi frequency dividers).
|
||||
Connect Pixhawk UART to Raspberry Pi UART.
|
||||
In `/etc/wifibroadcast.cfg` uncomment `peer = 'serial:ttyS0:1500000'` in `[drone_mavlink]` section.
|
||||
|
||||
### Using a Linux Laptop as GCS (Harder than using a RPi)
|
||||
|
||||
1. On **ground** Linux development computer:
|
||||
|
||||
```sh
|
||||
sudo apt install libpcap-dev libsodium-dev python3-all python3-twisted
|
||||
git clone -b stable https://github.com/svpcom/wfb-ng.git
|
||||
cd wfb-ng && make deb && sudo apt install ./deb_dist/wfb-ng*.deb
|
||||
```
|
||||
|
||||
2. Follow the [Setup HOWTO](https://github.com/svpcom/wfb-ng/wiki/Setup-HOWTO) to complete installation
|
||||
|
||||
3. Don't forget to copy `/etc/gs.key` from **UAV** side to **ground** side to bind two setups.
|
||||
|
||||
4. Also don't forget to use the same frequency channel as on the UAV side.
|
||||
|
||||
### Using Raspberry PI as GCS (Easier)
|
||||
|
||||
If you have Windows or OSX, or don't want to setup WFB-ng to your Linux laptop then you can use the same prebuilt image and another Raspberry Pi:
|
||||
|
||||
1. Flash image to the **ground** Raspberry Pi.
|
||||
2. Reboot it and SSH in with standard credentials (pi/raspberry).
|
||||
3. Run actions for **ground** role as displayed in motd, but skip setup of `fpv-video` service and `osd` service.
|
||||
4. Connect your laptop and ground RPi via ethernet and configure IP addresses
|
||||
5. Edit `/etc/wifibroadcast.cfg` and set the IP address of the laptop in `[gs_mavlink]` and `[gs_video]` sections (replacing `127.0.0.1`).
|
||||
|
||||
### QGroundControl Setup
|
||||
|
||||
1. Run _QGroundControl_ and set `RTP h264` on port 5600 as video source
|
||||
2. Use default settings (udp on port 14550) as mavlink source
|
||||
|
||||
## Tuning Radio Settings
|
||||
|
||||
With default settings WFB use radio channel 165 (5825 MHz), width 20MHz, MCS #1 (QPSK 1/2) with long GI.
|
||||
This provides ~7 mbit/s of **effective** speed (i.e. usable speed after FEC and packet encoding) for **both directions** in sum, because WiFi is half-duplex.
|
||||
So it is suitable for video down stream 720p@49fps (4 mbit/s) + two full-speed telemetry streams (uplink and downlink).
|
||||
If you need a higher bandwidth you can use other MCS index (for example 2 or greater)
|
||||
|
||||
## Antennas and Diversity
|
||||
|
||||
For simple cases you can use omnidirectional antennas with linear (that bundled with wifi cards) or circular leaf ([circularly polarized Coverleaf Antenna](http://www.antenna-theory.com/antennas/cloverleaf.php)) polarization.
|
||||
If you want to setup long distance link you can use multiple wifi adapters with directional and omnidirectional antennas. TX/RX diversity for multiple adapters supported out of box (just add multiple NICs to `/etc/default/wifibroadcast`).
|
||||
If your WiFi adapter has two antennas (like Alfa AWU036ACH) TX diversity is implemented via [STBC](https://en.wikipedia.org/wiki/Space%E2%80%93time_block_code).
|
||||
Cards with 4 ports (like Alfa AWUS1900) are currently not supported.
|
||||
|
||||
## 常见问题
|
||||
|
||||
**Q:** _What type of data can be transmitted using wfb-ng?_
|
||||
|
||||
**A:** Any UDP with packet size <= 1445.
|
||||
For example x264 inside RTP or MAVLink.
|
||||
|
||||
**Q:** _What are transmission guarantees?_
|
||||
|
||||
**A:** Wifibroadcast uses FEC (forward error correction).
|
||||
You can tune it (both TX and RX simultaneously!) to fit your needs.
|
||||
|
||||
**Q** _How far I can fly and still connect?_
|
||||
|
||||
**A** It depends on your antennas and WiFi cards.
|
||||
With Alfa AWU036ACH and 20dBi patch antenna on the ground ~20km is possible.
|
||||
|
||||
:::warning
|
||||
Don't use band that the RC TX operates on!
|
||||
Or setup RTL properly to avoid model loss.
|
||||
:::
|
||||
|
||||
**Q:** _Is only Raspberry PI supported?_
|
||||
|
||||
**A:** WFB-ng is not tied to any GPU - it operates with UDP packets.
|
||||
But to get RTP stream you need a video encoder (which encodes raw data from camera to x264 stream), or you must use a camera with a hardware video codec like Logitech C920 or Ethernet security cameras.
|
||||
|
||||
#### What ARM Boards are Recommended for the UAV?
|
||||
|
||||
- RPI3b/3b+/ZeroW.
|
||||
Prebuilt images are available, but it supports only h264 video for CSI cameras.
|
||||
- Jetson Nano.
|
||||
It supports h264 and h265 but you need to setup it yourself according to [Setup HOWTO](https://github.com/svpcom/wfb-ng/wiki/Setup-HOWTO)
|
||||
|
||||
You can use any other Linux ARM board, but you need to use an Ethernet or USB camera with built-in hardware video codecs (such as Logitech C920).
|
||||
|
||||
## Theory
|
||||
|
||||
WFB-ng puts the WiFi cards into monitor mode. This mode allows to send and receive arbitrary packets without association and waiting for ACK packets.
|
||||
[Analysis of Injection Capabilities and Media Access of IEEE 802.11 Hardware in Monitor Mode](https://github.com/svpcom/wfb-ng/blob/master/doc/Analysis%20of%20Injection%20Capabilities%20and%20Media%20Access%20of%20IEEE%20802.11%20Hardware%20in%20Monitor%20Mode.pdf)
|
||||
[802.11 timings](https://github.com/ewa/802.11-data)
|
||||
Reference in New Issue
Block a user