首先,获取代码的步骤很便捷的,直接通过github下载来获取,要注意的是版本号。
注:目前(截止发稿日)wfb-ng相对稳定,提出的问题和新增的功能都不多,代码框架应该改动不会太大。
$ git log -n 1
commit 02942ce0d52150a4ac75a4ed59680ef453042fb9 (HEAD -> master, origin/master, origin/HEAD)
Author: Vasily Evseenko <[email protected]>
Date: Tue Feb 7 21:25:03 2023 +0300
Update codec settings
然后,要确保系统上已经安装git工具。通过clone命令将代码下载到本地,版本问题请大家自行匹配,这里为了确保一致性,所以将代码版本记录下来了(其实这个对学习来说并不太重要,主要是方法论)。
$ git clone [email protected]:svpcom/wfb-ng.git
了解工程最简单的方法,就是阅读README。通常github上code页面显示的就是README.md文件,在浏览器上格式更美观(当然vi也是可以的)。
这里摘要部分内容,做个情况了解,为后续研读提供方向。
这里提供了两个文档链接,供读者阅读:
注1:如果需要备份可采用dd命令sudo dd bs=4M if=/dev/sdb of=/home/daniel/wfb-ng_23.01.001-rpi3-daniel.img。
注2:烧录方式可参考:Raspbian镜像无头烧录
启动天空端wfb_ng
$ sudo systemctl start wifibroadcast@drone
天空端wfb_ng状态查询
$ sudo systemctl status wifibroadcast@drone
天空端wfb_ng日志查询
sudo journalctl -xu wifibroadcast@drone
停止天空端wfb_ng
$ sudo systemctl stop wifibroadcast@drone
视频采集命令(CTRL + C 退出)
$ raspivid -n -ex fixedfps -w 1280 -h 720 -b 4000000 -fps 30 -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=5602
or
$ gst-launch-1.0 v4l2src do-timestamp=true io-mode=mmap device=/dev/video0 \
extra-controls="controls,image_stabilization=1,h264_profile=4,h264_i_frame_period=60,h264_level=11,power_line_frequency=1,exposure_metering_mong=1,exposure_dynamic_framerate=0,scene_mode=0,video_bitrate_mode=1,video_bitrate=2000000,repeat_sequence_header=1" \
! video/x-h264,profile=high,width=1280,height=720,framerate=30/1,stream-format=byte-stream \
! h264parse disable-passthrough=true ! rtph264pay config-interval=1 pt=96 mtu=1400 aggregate-mode=zero-latency ! udpsink host=127.0.0.1 port=5602 sync=false
功能使能/去使能命令(使能后,进程随系统自启动)
$ sudo systemctl enable wifibroadcast@drone
$ sudo systemctl disable wifibroadcast@drone
$ sudo systemctl enable fpv-camera
$ sudo systemctl disable fpv-camera
启动地面端wfb_ng
$ sudo systemctl start wifibroadcast@gs
地面端wfb_ng状态查询
$ sudo systemctl stop wifibroadcast@gs
地面端wfb_ng日志查询
sudo journalctl -xu wifibroadcast@gs
停止地面端wfb_ng
$ sudo systemctl stop wifibroadcast@gs
地面端维测命令(CTRL + C 退出)
$ wfb-cli gs
视频播放命令(CTRL + C 退出)
$ 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
or
$ 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 ! xvimagesink sync=false
功能使能/去使能命令(使能后,进程随系统自启动)
$ sudo systemctl enable wifibroadcast@gs
$ sudo systemctl disable wifibroadcast@gs
$ sudo systemctl enable fpv-video
$ sudo systemctl disable fpv-video
$ sudo systemctl enable osd
$ sudo systemctl disable osd
安装dkms
$ sudo apt-get install dkms
获取工程
$ git clone -b v5.2.20 https://github.com/svpcom/rtl8812au.git
一键安装
$ cd rtl8812au/
$ sudo ./dkms-install.sh
or
$ cd rtl8812au && make && sudo make install
请参考:
wfb-ng采用了Unix-style工程结构,也是笔者非常喜欢的一种软件工程组织方式。
Makefile
├──> C代码
│ ├──> wfb_keygen
│ ├──> wfb_rx
│ ├──> wfb_tx
│ └──> all_bin: wfb_rx wfb_tx wfb_keygen
├──> python代码
│ ├──> wfb-cli
│ ├──> wfb-test-latency
│ └──> wfb-server
└──> 工程目标
├──> env //python环境
├──> rpm: all_bin env //rpm包
├──> deb: all_bin env //deb包
├──> bdist: all_bin
├──> clean //工程清理
├──> test //测试
├──> gs.key //生成drone.key & gs.key
└──> all: all_bin gs.key test
.
├── doc
│ ├── Analysis of Injection Capabilities and Media Access of IEEE 802.11 Hardware in Monitor Mode.pdf
│ ├── enhanced_setup.dot
│ ├── logo-big.png
│ ├── logo-small.png
│ ├── Makefile
│ ├── mimo_for_dummies.pdf
│ └── wfb-ng-std-draft.md
├── LICENSE.txt
├── Makefile
├── README.md
├── scripts
│ ├── 98-wifibroadcast.conf
│ ├── default
│ │ └── wifibroadcast
│ ├── install_gs.sh
│ ├── rx_standalone.sh
│ ├── sample_voice_radio.sh
│ ├── systemd
│ │ ├── fpv-camera.service
│ │ ├── fpv-video.service
│ │ └── osd.service
│ ├── tx_standalone.sh
│ ├── video_test_sink.sh
│ ├── video_test_src.sh
│ ├── wifibroadcast
│ ├── wifibroadcast.service
│ └── [email protected]
├── setup.py
├── src
│ ├── fec.c
│ ├── fec.h
│ ├── ieee80211_radiotap.h
│ ├── keygen.c
│ ├── radiotap.c
│ ├── rx.cpp
│ ├── rx.hpp
│ ├── tx.cpp
│ ├── tx.hpp
│ ├── wifibroadcast.cpp
│ └── wifibroadcast.hpp
├── stdeb.cfg
├── version.py
└── wfb_ng
├── cli.py
├── common.py
├── conf
│ ├── __init__.py
│ ├── local.cfg
│ └── master.cfg
├── config_parser.py
├── __init__.py
├── latency_test.py
├── mavlink_protocol.py
├── mavlink.py
├── proxy.py
├── server.py
├── tests
│ ├── __init__.py
│ ├── test_proxy.py
│ ├── test_tuntap.py
│ └── test_txrx.py
└── tuntap.py
8 directories, 55 files
【1】Raspbian镜像无头烧录
【2】wfb-ng Release 23.01镜像无头烧录&配置(1)
【3】wfb-ng Release 23.01镜像无头烧录&配置(2)
【4】FPV Camera(RPI3+V2.1) | wfb_ng Release 23.01 | Ubuntu 20.04 xfce软解测试
【5】FPV Camera(RPI3+V2.1) | wfb_ng Release 23.01 | ubuntu 20.04 gnome软解测试