OpenIPC開源FPV之Adaptive-Link安裝
- 1. 源由
- 2. 介紹
- 2.1 天空端安裝
- 2.2 地面端安裝
- 3. 問題匯總
- 3.1 安裝腳本問題
- 3.2 網絡安裝問題
- 3.3 非SSC30KQ/SSC338Q硬件
- 3.4 代碼疑問
- 4. 總結
- 5. 后續
1. 源由
鑒于飛行過程,發現一些馬賽克現象,且60FPS桌面30FPS的錄影有些許卡頓。
- OpenIPC SSC30KQ IMX335 + Ardupilot 4.5.6 + 梅嶺隧道南入口 FPV飛行
- OpenIPC地面站OSD + Ardupilot 4.5.6 + 梅家塢山坳 FPV飛行
為了更好的確保FPV飛行質量:
- 提高圖像的清晰度
- 保證圖像流暢性
- 更好應對穿越場景
引入Adaptive Link
勢在必行!
2. 介紹
前面,已經簡單的介紹了關于OpenIPC Adaptive Link的原理和邏輯:
【1】OpenIPC開源FPV之Adaptive-Link工程解析
【2】OpenIPC開源FPV之Adaptive-Link天空端代碼解析
【3】OpenIPC開源FPV之Adaptive-Link地面站代碼解析
接下去,我們將進行安裝,以便更好的后續在上面的場景上進行驗證。
2.1 天空端安裝
$ cd /etc
$ curl -L -o alink_install.sh https://raw.githubusercontent.com/sickgreg/OpenIPC-Adaptive-Link/refs/heads/main/alink_install.sh
$ chmod +x alink_install.sh
$ ./alink_install.sh drone install
$ reboot
2.2 地面端安裝
$ curl -L -o alink_install.sh https://raw.githubusercontent.com/sickgreg/OpenIPC-Adaptive-Link/refs/heads/main/alink_install.sh
$ sudo chmod +x alink_install.sh
$ sudo ./alink_install.sh gs install
3. 問題匯總
3.1 安裝腳本問題
- Install gs adaptive link failed #14
不過在jetson-fpv
中,會通過補丁的方式進行修正,并且所有安裝方式都會使用菜單方式進行安裝,詳見:How to install the jetson-fpv?
3.2 網絡安裝問題
由于天空端采用了網絡安裝方式,因此,由于網絡問題導致無法安裝成功。
建議通過代理,可參考:apt-get通過代理更新系統
3.3 非SSC30KQ/SSC338Q硬件
因為,目前安裝方式僅支持上述兩個硬件,若需要其他硬件版本,可以參考以下方式自行編譯:
- Build scripts for goke|hi3516|star6b0|star6e|star6c targets on x86 #13
3.4 代碼疑問
- 【OSD】“pnlt%d xtx%ld idr%d” string lost #15
- 【WiFi】Which is the best profile for the 8812EU currently?
- 【WiFi】WIP: Add support for RTL8812EU-based Wi-Fi adapters for FPV firmware #1344
- 【Version】stucked “initializing… 6.3Mb FPS:60 54% tx34c rssi-44, snr15 fec1 pnlt0 xtx0 i” #17
- 【Version】[Request] Version control of adaptive link
- 【Version】Build scripts for goke|hi3516|star6b0|star6e|star6c targets on x86
- 【Version】 add exective attribute to bash files #12
4. 總結
通過實際樓道環境測試顯示,H265最低比特率在2.2Mbps,最高在10Mbps左右。
實際情況,待天氣好轉,現場實測!
注意:目前該鏈路動態適配正在不斷完善和開發,因此,很多情況會發生變化。上述僅供參考,謝謝!歡迎大家留言,指正,謝謝!
5. 后續
鑒于當前官方版本尚未進入版本管控,且在OpenIPC較新固件master+9fbdc40, 2025-02-15
版本上無法使用最新的adaptive link
。
基于這些,我們做了一個兼容的版本,供大家使用,操作步驟如下:
- 更新最新的OpenIPC固件(晚于2025-02-15)
- 下載代碼
git clone https://github.com/SnapDragonfly/OpenIPC-Adaptive-Link.git
- 檢出ssc30kq分支
git checkout build_for_ssc30kq
- 編譯最新版本
./build.sh star6e
- 使用新構建的二進制
alink_drone
- BL-M8812EU2 功率表格更新
$ cat /etc/txprofiles.conf
# <ra - nge> <gi> <mcs> <fecK> <fecN> <bitrate> <gop> <Pwr> <roiQP> <bandwidth> <qpDelta>
999 - 999 long 0 12 15 3332 5.0 61 0,0,0,0 20 -12
1000 - 1150 long 0 12 15 3333 5.0 60 0,0,0,0 20 -12
1151 - 1300 long 1 12 15 6667 5.0 59 12,6,6,12 20 -12
1301 - 1700 long 2 12 15 10000 5.0 58 12,6,6,12 20 -12
1701 - 1950 long 3 12 15 12500 5.0 56 8,4,4,8 20 -12
1951 - 2001 short 3 12 15 14000 5.0 56 4,0,0,4 20 -12
- 配置更新
$cat /etc/alink.conf
### alink_drone settings ###### Allow power settings defined in txprofiles.conf
allow_set_power=1### weights - how much consideration alink_drone puts on gs rssi vs snr
rssi_weight=0.3
snr_weight=0.7### if gs heartbeat lost for x ms, set link low (fallback)
fallback_ms=1000
# keep link low for min x s
hold_fallback_mode_s=3### limit time between any link change and the next
min_between_changes_ms=150
# wait x seconds before increasing link speed
hold_modes_down_s=4### smooth out rssi/snr readings for link increase / decrease
hysteresis_percent=15
hysteresis_percent_down=5
exp_smoothing_factor=0.1
exp_smoothing_factor_down=1.0### allow lost GS packet to request new keyframe
allow_request_keyframe=1
# allow drone driver-tx_dropped to request new keyframe
allow_rq_kf_by_tx_d=1
# limit time between keyframe requests
request_keyframe_interval_ms=100
# request a keyframe at every link changes
idr_every_change=0### enable higher quality in center of image
roi_focus_mode=0### penalise link by this amount per packet above alarm (0 = disabled)
fec_rec_penalty=0
# allow fec below alarm value
fec_rec_alarm=2
# limit penalty to
max_fec_rec_penalty=150
apply_penalty_for_s=1### attempt to help encoder bitrate spikes by strategically lowering FPS when on high resolutions
allow_spike_fix_fps=0### Command templates - Don't change these unless you know what you are doing
powerCommand="iw dev wlan0 set txpower fixed %d"
fpsCommandTemplate="echo 'setfps 0 %d' > /proc/mi_modules/mi_sensor/mi_sensor0"
qpDeltaCommand="curl localhost/api/v1/set?video0.qpDelta=%d"
mcsCommand="wfb_tx_cmd 8000 set_radio -B %d -G %s -S 1 -L 1 -M %d"
bitrateCommand="curl -s 'http://localhost/api/v1/set?video0.bitrate=%d'"
gopCommand="curl -s 'http://localhost/api/v1/set?video0.gopSize=%f'"
fecCommand="wfb_tx_cmd 8000 set_fec -k %d -n %d"
roiCommand="curl -s 'http://localhost/api/v1/set?fpv.roiQp=%s'"
idrCommand="curl localhost/request/idr"
customOSD=&L%d0&F%d&B &C tx&Wc
reboot
重啟OpenIPC