1. 源由
目前,在无人车上调试(修改、上传等)有以下网络问题:
- 需要网线才能
ssh
系统进行调整 - 板载
wifi
性能及安装位置遮挡,信号不是很好,导致稳定性问题
2. 计划
为了方便后续测试,想使用一个usb-rtl8192cu-wifi-dongler
来简化工作。
注:前期工作请参考:wfb-ng 开源代码之树莓派3B+ Bookworm安装
2.1 锁定MAC设备
rtl8812au:0c:91:60:03:5b:62 //wfb-ng -> wfb-rf0
rtl8192cu:14:cf:92:05:3c:d3 //wifi -> wlan0
$ cat /etc/udev/rules.d/75-wifi-interface-name-change.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="0c:91:60:03:5b:62", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="w*", NAME="wfb-rf0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="14:cf:92:05:3c:d3", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="w*", NAME="wlan0"
- 1
- 2
- 3
2.2 修改配置文件
fpv-drone.sh
修改wfb-ng设备号 wlan0
为 wfb-rf0
$ cat /usr/local/bin/fpv-drone.sh
#!/bin/bash
export PATH=$PATH:/usr/local/bin:/usr/bin
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib
/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 &
/usr/bin/msposd --master /dev/ttyUSB0 --baudrate 115200 --out 127.0.0.1:14560 --matrix 11 --ahi 1 -r 30 -c 7 -c 9 &
/usr/bin/libcamera-vid --inline --width 1920 --height 1080 --bitrate 4000000 --framerate 30 --hflip --vflip --timeout 0 -o - | /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 &
wait
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
2.3 配置wifi连接
$ sudo nmcli --ask dev wifi connect "AutoConnect" password "password" ifname wlan0
- 1
2.4 扫描Pi3B+端口
192.168.1.11 //wifi
192.168.1.201 //ethernet
2.5 配置ssh端口
2.6 安装samba
参考:CB2-2CARD的openSUSE安装&NAS环境配置
注:主要目的为了使用Windows桌面软件IDE环境修改代码和配置文件。
- 安装
deb
$ sudo apt-get install samba
- 1
- 配置修改
$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
$ sudo nano /etc/samba/smb.conf
$ diff -urN /etc/samba/smb.conf /etc/samba/smb.conf.bak
--- /etc/samba/smb.conf 2024-12-31 12:38:40.295111866 +0000
+++ /etc/samba/smb.conf.bak 2024-12-31 12:42:46.010808079 +0000
@@ -168,11 +168,11 @@
[homes]
comment = Home Directories
- browseable = yes
+ browseable = no
# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
- read only = no
+ read only = yes
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 添加用户
$ sudo smbpasswd -a daniel
New SMB password:
Retype new SMB password:
Added user daniel.
- 1
- 2
- 3
- 4
- 使能服务
$ sudo systemctl enable smb.service
- 1
- 启动服务
$ sudo systemctl restart smb.service
- 1
- 登录
\\192.168.1.11\daniel
2.7 映射驱动器
- 个人电脑界面
- 映射驱动器盘符
- 映射成功
2.8 vscode IDE
vscode IDE,这个就不多说了!
可以用Notepad++/Source Insignt/Eclipse等等IDE工具,看个人喜好!
3. 总结
上述方法就能使用Windows上vscode
和ssh
等工具来进行相应的开发、调试工作!
关键在于,无需连接网线,全部远程控制和操作!
4. 参考资料
【1】wfb-ng 开源代码之树莓派3B+ Bookworm安装
【2】Raspbian命令行连接WiFi网络
【3】wfb-ng 锁定WiFi接口
【4】CB2-2CARD的openSUSE安装&NAS环境配置
评论记录:
回复评论: