wfb-ng 开源代码之Jetson Orin安装
1. 源由
为了更好的使用Jetson上AI开发环境,通过wfb-ng将穿越机/无人机的视频以及控制链路引入后端分析。
这里将Step by Step简单介绍下wfb-ng开源代码在Jetson Orin的安装过程。
2. 准备
硬件:
- Jetson Orin 开发板
- RTL8812AU网卡
- OpenIPC FPV摄像头
软件:开源,一切都是开源的!!!请预装系统,推荐使用Linux 35.5 + JetPack v5.1.3
,目前ROS上开源支持的比较广泛。
3. 步骤
3.1 DKMS安装
$ sudo apt-get install dkms
$ git clone git@github.com:svpcom/rtl8812au.git
$ cd rtl8812au
$ sudo ./dkms-install.sh
3.2 RTL8812AU驱动
$ make
$ sudo make install
$ sudo modprobe 88XXau_wfb
插入网卡:
$ sudo dmesg|tail -n 8
[ 1267.101046] usb 1-2.1: new high-speed USB device number 6 using tegra-xusb
[ 1267.207162] usb 1-2.1: config 1 interface 0 altsetting 0 endpoint 0x85 has an invalid bInterval 0, changing to 7
[ 1267.219528] usb 1-2.1: New USB device found, idVendor=0bda, idProduct=881a, bcdDevice= 0.00
[ 1267.219534] usb 1-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1267.219538] usb 1-2.1: Product: 802.11n NIC
[ 1267.219541] usb 1-2.1: Manufacturer: Realtek
[ 1267.219544] usb 1-2.1: SerialNumber: 123456
[ 1271.179209] IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
3.3 确认网卡
经检查RTL8812AU网卡实际系统中显示的是wlan1
$ ethtool -i wlan1
driver: rtl88xxau_wfb
version: 5.10.192-tegra
firmware-version:
expansion-rom-version:
bus-info: 1-2.1:1.0
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
$ lsusb
Bus 002 Device 002: ID 0bda:0489 Realtek Semiconductor Corp. 4-Port USB 3.0 Hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 13d3:3549 IMC Networks Bluetooth Radio
Bus 001 Device 005: ID 222a:0001
Bus 001 Device 004: ID 046d:c52e Logitech, Inc. MK260 Wireless Combo Receiver
Bus 001 Device 006: ID 0bda:881a Realtek Semiconductor Corp.
Bus 001 Device 002: ID 0bda:5489 Realtek Semiconductor Corp. 4-Port USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$ iwconfig
lo no wireless extensions.
dummy0 no wireless extensions.
eth0 no wireless extensions.
wlan0 IEEE 802.11bgn ESSID:"AutoConnect" Nickname:"<WIFI@REALTEK>"
Mode:Managed Frequency:2.412 GHz Access Point: B8:F8:83:6E:16:9F
Bit Rate:300 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality=81/100 Signal level=68/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
l4tbr0 no wireless extensions.
rndis0 no wireless extensions.
usb0 no wireless extensions.
docker0 no wireless extensions.
wlan1 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=18 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
3.4 安装地面站
$ git clone -b stable https://github.com/svpcom/wfb-ng.git
$ cd wfb-ng
$ sudo ./scripts/install_gs.sh wlan1
3.5 wfg-ng服务操作
服务状态:
$ sudo systemctl status wifibroadcast@gs
启动服务:
$ sudo systemctl start wifibroadcast@gs
停止服务:
$ sudo systemctl stop wifibroadcast@gs
使能服务:
$ sudo systemctl enable wifibroadcast@gs
去使能服务:
$ sudo systemctl disable wifibroadcast@gs
3.6 其他操作
制作秘钥对,其中drone.key部署在天空端,而gs.key部署在地面端。
$ wfb_keygen
查看收发包状态:
$ wfb-cli gs
4. 总结
在jetson板子上仍然可以使用以下gstreamer
命令进行解析RTP视频流:
- H264
$ gst-launch-1.0 udpsrc port=5600 caps='application/x-rtp' ! rtph264depay ! h264parse disable-passthrough=true config-interval=1 ! nvv4l2decoder ! nvvidconv ! xvimagesink
$ gst-launch-1.0 udpsrc port=5600 caps='application/x-rtp' ! rtph265depay ! h265parse disable-passthrough=true config-interval=1 ! nvv4l2decoder ! nvvidconv ! xvimagesink
or
$ gst-launch-1.0 udpsrc port=5600 caps='application/x-rtp,encoding-name=H265,payload=96' ! rtph265depay ! h265parse disable-passthrough=true config-interval=1 ! nvv4l2decoder ! nvvidconv ! xvimagesink
在jetson板子上使用video-viewer
命令进行解析RTP视频流:
- H264
$ video-viewer rtp://@:5600 --input-decoder=v4l2 --input-codec=h264
- H265
$ video-viewer rtp://@:5600 --input-decoder=v4l2 --input-codec=h265
但是后续的重点是用nvidia的AI程序来进行视频的分析:
- Linux 36.3 + JetPack v6.0@jetson-inference之视频操作
- Linux 36.3 + JetPack v6.0@jetson-inference之图像分类
- Linux 36.3 + JetPack v6.0@jetson-inference之目标检测
- Linux 36.3 + JetPack v6.0@jetson-inference之语义分割
5. 问题:编译错误
Collecting git+https://github.com/svpcom/stdeb
Cloning https://github.com/svpcom/stdeb to /tmp/pip-req-build-ycqy88pl
Running command git clone -q https://github.com/svpcom/stdeb /tmp/pip-req-build-ycqy88pl
error: RPC failed; curl 28 Failed to connect to github.com port 443: Connection timed out
fatal: the remote end hung up unexpectedly
ERROR: Command errored out with exit status 128: git clone -q https://github.com/svpcom/stdeb /tmp/pip-req-build-ycqy88pl Check the logs for full command output.
make: *** [Makefile:27: /home/daniel/wfb/wfb-ng/env] Error 1
rm -rf deb_dist
$(PATH=/home/daniel/wfb/wfb-ng/env/bin:/home/daniel/wfb/wfb-ng/env/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin which python3) ./setup.py --command-packages=stdeb.command bdist_deb
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_deb'
make: *** [Makefile:65: deb] Error 1
rm -rf deb_dist
/home/daniel/wfb/wfb-ng/env/bin/python ./setup.py --command-packages=stdeb.command bdist_deb
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_deb'
make: *** [Makefile:50: deb] Error 1
编译最新库上版本,出现以上编译错误。其主要原因是虚拟编译环境,网络环境,出错后异常处理等问题导致最终就是出现以上问题。
解决方法挺简单的:rm -rf wfb-ng/env
6. 参考资料
【1】Ardupilot & OpenIPC & 基于WFB-NG构架分析和数据链路思考
【2】wfb-ng 开源工程结构&代码框架简明介绍
【3】wfb-ng 开源代码之wfb_tx&wfb_rx
【4】wfb-ng 开源代码之wfb_tx模式更新