2022-12-09 17:04:33 -04:00

2022-09-08 15:28:30 -03:00
2022-07-04 16:44:21 -03:00
This is the next generation of long-range **packet** radio link based on **raw WiFi radio**
2017-04-24 17:09:18 -03:00
2019-01-02 09:15:38 -04:00
Main features:
--------------
2024-02-24 06:01:23 -04:00
- 1:1 map of RTP to IEEE80211 packets for minimum latency (doesn't serialize to byte stream)
2024-02-03 12:55:52 -04:00
- Smart FEC support (immediately yield packet to video decoder if FEC pipeline without gaps)
2022-11-23 16:44:19 -04:00
- [Bidirectional mavlink telemetry ](https://github.com/svpcom/wfb-ng/wiki/Setup-HOWTO ). You can use it for mavlink up/down and video down link.
2024-01-31 10:03:51 -04:00
- IP-over-WFB tunnel support. You can transmit ordinary ip packets over WFB link. Note, don't use ip tunnel for high-bandwidth transfers like video or mavlink. It uses less efficient FEC coding and doesn't aggregate small packets.
2018-12-13 14:33:16 -04:00
- Automatic TX diversity (select TX card based on RX RSSI)
2019-01-02 09:15:38 -04:00
- Stream encryption and authentication ([libsodium](https://download.libsodium.org/doc/))
2017-10-13 16:00:51 -03:00
- Distributed operation. It can gather data from cards on different hosts. So you don't limited to bandwidth of single USB bus.
2024-02-03 12:55:52 -04:00
- Aggregation of mavlink packets. Doesn't send wifi packet for every mavlink packet.
2022-11-23 16:44:19 -04:00
- Enhanced [OSD ](https://github.com/svpcom/wfb-ng-osd ) for Raspberry PI (consume 10% CPU on PI Zero) or any other system which
2022-04-13 08:08:41 -03:00
supports gstreamer (Linux X11, etc). Compatible with any screen resolution. Supports aspect correction for PAL to HD scaling.
- Provides IPv4 tunnel for generic usage
2017-04-24 17:09:18 -03:00
2022-08-01 09:58:04 -03:00
> :warning: **Warranty/Disclaimer** <br />
> This is free software and comes with no warranty, as stated in parts 15 and 16 of the GPLv3 license. The creators and contributors of the software are not responsible for how it is used.
2022-11-23 16:44:19 -04:00
> See [License and Support](https://github.com/svpcom/wfb-ng/wiki/License-and-Support) for details.
2017-04-24 17:09:18 -03:00
2024-03-01 19:04:27 -04:00
## Support project
If you like WFB-ng you can support author via:
- https://boosty.to/svpcom/donate
- `bitcoin:bc1qfvlsvr0ea7tzzydngq5cflf4yypemlacgt6t05`
2022-08-01 09:58:04 -03:00
## Getting Started
2017-04-24 17:09:18 -03:00
2022-08-01 09:58:04 -03:00
For detailed instructions on how to get started read through
2023-10-16 05:18:31 -03:00
[PX4-Guide ](https://docs.px4.io/main/en/companion_computer/video_streaming_wfb_ng_wifi.html )
2022-11-23 16:44:19 -04:00
and follow the [Setup HowTo ](https://github.com/svpcom/wfb-ng/wiki/Setup-HOWTO )
2017-04-24 17:09:18 -03:00
2022-08-01 09:58:04 -03:00
### Quick start using Raspberry Pi
2017-04-24 17:09:18 -03:00
2022-11-23 16:44:19 -04:00
- Under [Releases ](https://github.com/svpcom/wfb-ng/releases ) download the latest image file (`*.img.gz`).
2022-08-01 09:58:04 -03:00
- Unpack the `*.img` file and flash it to 2-SD Cards.
- Plug the WiFi Adapters into the Raspberry Pis
- Boot the Pis and ssh into them using the following command (replace `192.168.0.111` with their IP-Address). Password: `raspberry`
```
ssh pi@192.168.0.111
```
- On the Pi used as ground station:
```
sudo systemctl enable wifibroadcast@gs
2023-08-13 20:49:04 -03:00
sudo systemctl enable rtsp
2022-08-01 09:58:04 -03:00
sudo systemctl enable fpv-video
sudo systemctl enable osd
sudo reboot
```
2017-04-24 17:09:18 -03:00
2022-08-01 09:58:04 -03:00
- On the Pi used on the drone:
```
sudo systemctl enable wifibroadcast@drone
sudo systemctl enable fpv-camera
sudo reboot
```
- Done! You should be able to see the video from the FPV camera. To monitor the link use the following command on the ground station:
```
wfb-cli gs
```
2022-07-04 16:44:21 -03:00
2022-08-01 09:58:04 -03:00
### Quick start using Ubuntu Ground Station
2022-07-04 16:44:21 -03:00
2022-08-01 09:58:04 -03:00
- Install patched `RTL8812AU` driver:
```
sudo apt-get install dkms
2022-08-08 09:11:57 -03:00
git clone -b v5.2.20 https://github.com/svpcom/rtl8812au.git
2022-08-01 09:58:04 -03:00
cd rtl8812au/
sudo ./dkms-install.sh
```
- Make sure the driver is correctly installed by running the following command. You should see the WiFi card in an `unmanaged` state.
```
nmcli
```
- Get the name of the WiFi card by running:
```
ifconfig
```
- You should see output similar to:
```
wlan0: flags=4163< UP , BROADCAST , RUNNING , MULTICAST > mtu 2312
ether 0c:91:60:0a:5a:8b txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
```
- Copy the name of the RTL8812AU WiFi card.
- Install wfb-ng. Replace `wifi0` with the previously copied name of the WiFi card.
```
2022-11-23 16:44:19 -04:00
git clone -b stable https://github.com/svpcom/wfb-ng.git
cd wfb-ng
2022-08-01 10:03:06 -03:00
sudo ./scripts/install_gs.sh wifi0
2022-08-01 09:58:04 -03:00
```
- Done! To monitor the link use the following command on the ground station:
```
wfb-cli gs
```
**Failing to get connection?**
Make sure the WiFi channel on the ground and on the drone are the same. To check, use:
```
head /etc/wifibroadcast.cfg
```
2017-04-24 17:09:18 -03:00
2022-08-01 09:58:04 -03:00
You should see output similar to:
```
[common]
wifi_channel = 161 # 161 -- radio channel @5825 MHz, range: 5815– 5835 MHz, width 20MHz
# 1 -- radio channel @2412 Mhz,
# see https://en.wikipedia.org/wiki/List_of_WLAN_channels for reference
```
Ensure the WiFi channel selected is the same on the ground and on the drone.
2019-04-25 03:21:15 -03:00
2022-08-01 09:58:04 -03:00
---
## FAQ
**Q: What type of data can be transmitted using WFB-NG?**
2022-12-02 10:33:14 -04:00
**A:** Any UDP with packet size < = 1445. For example x264 inside RTP or Mavlink.
2022-08-01 09:58:04 -03:00
2024-01-31 10:03:51 -04:00
**Q: What are transmission guarantees?**
2022-08-01 09:58:04 -03:00
2024-01-31 10:03:51 -04:00
**A:** Wifibrodcast uses FEC (forward error correction) which can recover 4 lost packets from 12 packets block with default settings. You can tune it (both TX and RX simultaneously!) to fit your needs.
2022-08-01 09:58:04 -03:00
**Q: Is only Raspberry PI supported?**
2024-02-03 12:55:52 -04:00
**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). In my case RPI is only used for video encoding (because RPI Zero is too slow to do anything else) and all other tasks (including WFB-NG) are done by other board (NanoPI NEO2).
2022-08-01 09:58:04 -03:00
**Q: What is a difference from original wifibroadcast?**
2024-01-31 10:03:51 -04:00
**A:** Original version of wifibroadcast uses a byte-stream as input and splits it to packets of fixed size (1024 by default). If radio packets were lost and this is not corrected by FEC you'll get a hole at random (unexpected) place of stream. This is especially bad if data protocol is not resistant to (was not desired for) such random erasures. So i've rewritten it to use UDP as data source and pack one source UDP packet into one radio packet. Radio packets now have variable size depending on payload size. This reduces video latency a lot.
2022-08-01 09:58:04 -03:00
2019-01-02 09:15:38 -04:00
## Theory
2022-07-04 16:44:21 -03:00
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.
2022-11-23 16:44:19 -04:00
[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 )
2019-01-10 07:41:06 -04:00
[802.11 timings ](https://github.com/ewa/802.11-data )
2019-01-14 04:07:53 -04:00
2017-01-23 12:08:28 -04:00
Sample usage chain:
2017-10-13 16:00:51 -03:00
-------------------
2017-01-23 12:08:28 -04:00
```
2017-10-13 16:00:51 -03:00
Camera -> gstreamer --[RTP stream (UDP)]--> wfb_tx --//--[ RADIO ]--//--> wfb_rx --[RTP stream (UDP)]--> gstreamer --> Display
2017-01-23 12:08:28 -04:00
```
2024-01-31 10:03:51 -04:00
For encoding logitech c920 camera:
2017-01-23 12:08:28 -04:00
```
gst-launch-1.0 uvch264src device=/dev/video0 initial-bitrate=6000000 average-bitrate=6000000 iframe-period=1000 name=src auto-start=true \
src.vidsrc ! queue ! video/x-h264,width=1920,height=1080,framerate=30/1 ! h264parse ! rtph264pay ! udpsink host=localhost port=5600
```
2020-08-24 13:01:59 -03:00
To encode a Raspberry Pi Camera V2:
```
raspivid -n -ex fixedfps -w 960 -h 540 -b 4000000 -fps 30 -vf -hf -t 0 -o - | \
gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=35 ! udpsink sync=false host=127.0.0.1 port=5600
```
2017-01-23 12:08:28 -04:00
To decode:
```
gst-launch-1.0 udpsrc port=5600 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' \
! rtph264depay ! avdec_h264 ! clockoverlay valignment=bottom ! autovideosink fps-update-interval=1000 sync=false
```
2018-12-13 14:33:16 -04:00
HOWTO build:
----------------------
For development (inline build)
```
make
```
For binary distribution RHEL or Fedora
```
make rpm
```
For binary distribution Debian or Ubuntu
```
2023-01-20 05:05:54 -04:00
sudo apt install python3-all libpcap-dev libsodium-dev python3-pip python3-pyroute2 \
2023-08-27 15:48:07 -03:00
python3-future python3-twisted python3-serial python3-all-dev iw virtualenv \
2023-01-20 05:05:54 -04:00
debhelper dh-python build-essential -y
2022-06-27 08:46:05 -03:00
sudo make deb
2018-12-13 14:33:16 -04:00
```
For binary distribution (tar.gz)
```
make bdist
```
You need to generate encryption keys for gs(ground station) and drone:
```
wfb_keygen
```
2024-01-31 05:13:14 -04:00
Leave them in place for development build or copy to `/etc` for binary install.
2018-12-13 14:33:16 -04:00
Put `drone.key` to drone and `gs.key` to gs.
2017-01-23 12:08:28 -04:00
2017-10-13 16:00:51 -03:00
Supported WiFi hardware:
------------------------
2022-11-23 16:44:19 -04:00
My primary hardware target is Realtek **RTL8812au** . 802.11ac capable. Easy to buy. [**Requires external patched driver!** ](https://github.com/svpcom/rtl8812au ) System was tested with ALPHA AWUS036ACH on both sides in 5GHz mode.
2017-04-24 17:09:18 -03:00
2017-07-05 13:50:07 -03:00
2017-10-13 16:00:51 -03:00
Wiki:
-----
2022-11-23 16:44:19 -04:00
See https://github.com/svpcom/wfb-ng/wiki for additional info
2022-05-27 10:46:14 -03:00
2022-10-07 02:44:44 -03:00
Community support:
2022-05-27 10:46:14 -03:00
---------------
2023-01-14 04:58:46 -04:00
Telegram group: (**wfb-ng support**) https://t.me/wfb_ng
2022-11-19 13:05:11 -04:00
Please note, that it is only one official group.