首页 最新 热门 推荐

  • 首页
  • 最新
  • 热门
  • 推荐

msposd 开源代码之树莓派3B+ Bookworm部署

  • 25-02-20 11:40
  • 4160
  • 12487
blog.csdn.net

msposd 开源代码之树莓派3B+ Bookworm部署

  • 1. 源由
  • 2. 安装
  • 3. 脚本
  • 4. 服务
  • 5. TODO

1. 源由

在前面文档中,我们已经基本上搭建了 树莓派FPV的 Ardupilot Rover测试平台:

  • 《wfb-ng 开源代码之树莓派3B+ Bookworm安装》
  • 《wfb-ng 开源代码之树莓派3B+ Bookworm无线配置》

在实际使用过程中,由于msposd采用了native build方式,与OpenIPC的安装方式不太一样,所以有些细节需要进行调整。

  1. 天空端安装路径
  2. 自定义数据支持

2. 安装

msposd由于navtive build方式编译,安装应用了gs目录结构。

  • 目录结构:
$ tree /usr/local/bin/fpvdrone/
/usr/local/bin/fpvdrone/
├── font_ardu_hd.png
├── font_ardu.png
├── font_btfl_hd.png
├── font_btfl.png
├── font_inav_hd.png
├── font_inav.png
├── fpv-drone.sh
├── fpv-update.sh
├── vtxmenu.ini
└── msposd

1 directory, 8 files
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

3. 脚本

  • 自定义更新脚本 (每秒更新)
$ sudo nano /usr/local/bin/fpvdrone/fpv-update.sh
$ sudo chmod +x /usr/local/bin/fpvdrone/fpv-update.sh
$ cat /usr/local/bin/fpvdrone/fpv-update.sh
#!/bin/bash

while true; do
  echo "Monitor... &L24 &F28 CPU:&C &B temp:&T" > /usr/local/bin/fpvdrone/MSPOSD.msg
  sleep 1
done
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 启动脚本支持libcamera-vid日志管道
$ cat /usr/local/bin/fpvdrone/fpv-drone.sh
#!/bin/bash

# Set up environment variables
export PATH=$PATH:/usr/local/bin:/usr/bin
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib

# Start the wfb_tx process
/usr/bin/wfb_tx \
  -p 17 \
  -u 14560 \
  -K /etc/drone.key \
  -B 20 \
  -M 1 \
  -S 1 \
  -L 1 \
  -G long \
  -k 1 \
  -n 2 \
  -T 0 \
  -i 7669206 \
  -f data \
  wfb-rf0 &

# Check if /tmp/libcamera-logs FIFO file exists, create it if not
if [ ! -p /tmp/libcamera-logs ]; then
  mkfifo /tmp/libcamera-logs
fi

# Start libcamera-vid and pipe its output to GStreamer while logging to /tmp/libcamera-logs
/usr/bin/libcamera-vid \
  --verbose \
  --inline \
  --width 1920 \
  --height 1080 \
  --bitrate 4000000 \
  --framerate 30 \
  --hflip \
  --vflip \
  --timeout 0 \
  -o - 2> /tmp/libcamera-logs | \
  /usr/bin/gst-launch-1.0 \
    -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=35 ! udpsink sync=false host=127.0.0.1 port=5602 &

# Change to the FPVDrone directory and start the msposd process
cd /usr/local/bin/fpvdrone/
/usr/local/bin/fpvdrone/msposd \
  --master /dev/ttyUSB0 \
  --baudrate 115200 \
  --out 127.0.0.1:14560 \
  --matrix 11 \
  --ahi 1 \
  -r 30 \
  -c 7 \
  -c 9 &

# (Optional) Run the FPVDrone update script
# /usr/local/bin/fpvdrone/fpv-update.sh &

# Wait for all background processes to finish
wait
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61

4. 服务

  • 服务配置路径更新
$ cat /etc/systemd/system/fpvdrone.service
[Unit]
Description=FPV Drone Service
Requires=wifibroadcast.service
ReloadPropagatedFrom=wifibroadcast.service
After=wifibroadcast.service

[Service]
Type=simple
ExecStartPre=/bin/sleep 10
ExecStart=/usr/local/bin/fpvdrone/fpv-drone.sh

Restart=always
User=root
Group=root
AmbientCapabilities=CAP_NET_RAW CAP_NET_ADMIN
WorkingDirectory=/
StandardOutput=journal
StandardError=journal
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

5. TODO

树莓派目前尚不在msposd支持范围,树莓派官网在制作工具链二进制方面的情况尚没有研究透,所以暂时还没有计划。

  • How can I get up to date cross-compiler on x86 platform for Pi3B+ bookworm? #135

依据前面步骤,调整安装路径,脚本,以及相关配置,native build是可以在树莓派Pi3B+上部署和使用的。

  • [Request] Custom message(bitrate/fps) support for other platform except SIGMASTAR

以下libcamera-vid日志数据可以提供FPS/bitrate分析:

#31 (30.00 fps) exp 33216.00 ag 8.00 dg 1.00
FileOutput: output buffer 0x7f9d97a000 size 21529
Viewfinder frame 32
#32 (30.01 fps) exp 33216.00 ag 8.00 dg 1.00
FileOutput: output buffer 0x7f9d8ba000 size 21331
Viewfinder frame 33
#33 (30.00 fps) exp 33216.00 ag 8.00 dg 1.00
FileOutput: output buffer 0x7f9d7fa000 size 20932
Viewfinder frame 34
#34 (29.99 fps) exp 33216.00 ag 8.00 dg 1.00
FileOutput: output buffer 0x7f9d73a000 size 21008
Viewfinder frame 35
#35 (30.02 fps) exp 33216.00 ag 8.00 dg 1.00
FileOutput: output buffer 0x7f9d67a000 size 14030
Viewfinder frame 36
FileOutput: output buffer 0x7f9d5ba000 size 20665
#36 (30.01 fps) exp 33216.00 ag 8.00 dg 1.00
Viewfinder frame 37
#37 (30.00 fps) exp 33216.00 ag 8.00 dg 1.00
FileOutput: output buffer 0x7fa40c0000 size 13858
FileOutput: output buffer 0x7fa4000000 size 13573
Viewfinder frame 38
#38 (30.00 fps) exp 33216.00 ag 8.00 dg 1.00
Viewfinder frame 39
#39 (30.00 fps) exp 33216.00 ag 8.00 dg 1.00
FileOutput: output buffer 0x7f9dc7a000 size 20551
FileOutput: output buffer 0x7f9dbba000 size 13894
Viewfinder frame 40
#40 (30.01 fps) exp 33216.00 ag 8.00 dg 1.00
Viewfinder frame 41
#41 (30.00 fps) exp 33216.00 ag 8.00 dg 1.00
FileOutput: output buffer 0x7f9dafa000 size 13314
Viewfinder frame 42
FileOutput: output buffer 0x7f9da3a000 size 26276
#42 (30.00 fps) exp 33216.00 ag 8.00 dg 1.00
Viewfinder frame 43
#43 (30.00 fps) exp 33216.00 ag 8.00 dg 1.00
FileOutput: output buffer 0x7f9d97a000 size 15762
Viewfinder frame 44
FileOutput: output buffer 0x7f9d8ba000 size 8856
#44 (30.00 fps) exp 33216.00 ag 8.00 dg 1.00
Viewfinder frame 45
FileOutput: output buffer 0x7f9d7fa000 size 10674
#45 (30.00 fps) exp 33216.00 ag 8.00 dg 1.00
Viewfinder frame 46
#46 (30.00 fps) exp 33216.00 ag 8.00 dg 1.00
FileOutput: output buffer 0x7f9d73a000 size 16184
Viewfinder frame 47
FileOutput: output buffer 0x7f9d67a000 size 16389
#47 (30.00 fps) exp 33216.00 ag 8.00 dg 1.00
Viewfinder frame 48
#48 (30.00 fps) exp 33216.00 ag 8.00 dg 1.00
FileOutput: output buffer 0x7f9d5ba000 size 16489
Viewfinder frame 49
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
注:本文转载自blog.csdn.net的lida2003的文章"https://blog.csdn.net/lida2003/article/details/144872006"。版权归原作者所有,此博客不拥有其著作权,亦不承担相应法律责任。如有侵权,请联系我们删除。
复制链接
复制链接
相关推荐
发表评论
登录后才能发表评论和回复 注册

/ 登录

评论记录:

未查询到任何数据!
回复评论:

分类栏目

后端 (14832) 前端 (14280) 移动开发 (3760) 编程语言 (3851) Java (3904) Python (3298) 人工智能 (10119) AIGC (2810) 大数据 (3499) 数据库 (3945) 数据结构与算法 (3757) 音视频 (2669) 云原生 (3145) 云平台 (2965) 前沿技术 (2993) 开源 (2160) 小程序 (2860) 运维 (2533) 服务器 (2698) 操作系统 (2325) 硬件开发 (2492) 嵌入式 (2955) 微软技术 (2769) 软件工程 (2056) 测试 (2865) 网络空间安全 (2948) 网络与通信 (2797) 用户体验设计 (2592) 学习和成长 (2593) 搜索 (2744) 开发工具 (7108) 游戏 (2829) HarmonyOS (2935) 区块链 (2782) 数学 (3112) 3C硬件 (2759) 资讯 (2909) Android (4709) iOS (1850) 代码人生 (3043) 阅读 (2841)

热门文章

101
推荐
关于我们 隐私政策 免责声明 联系我们
Copyright © 2020-2025 蚁人论坛 (iYenn.com) All Rights Reserved.
Scroll to Top