Explorer/RaspberryPi/Wifibroadcast/Run
Jump to navigation
Jump to search
/etc/rc.local
"su root -c /home/pi/airpi.sh &"
/home/pi/airpi.sh
chmod ugo+xwr airpi.sh
#!/bin/bash ifconfig wlan1 down sleep 1 iw dev wlan1 set monitor otherbss iw reg set DE ifconfig wlan1 up iw dev wlan1 set channel 36 iw dev wlan1_DEV set txpower fixed 4000 #iw wlan1 info /home/pi/wifibroadcast-svpcom/wfb_tx -K /home/pi/wifibroadcast-svpcom/drone.key -p 1 -u 5600 wlan1 & /home/pi/wifibroadcast-svpcom/wfb_tx -K /home/pi/wifibroadcast-svpcom/drone.key -p 2 -u 4242 -k 1 -n 2 wlan1 & /home/pi/wifibroadcast-svpcom/wfb_rx -K /home/pi/wifibroadcast-svpcom/drone.key -p 3 -u 4243 -c 127.0.0.1 -k 1 -n 2 wlan1 & /home/pi/wifibroadcast-svpcom/wfb_tx -K /home/pi/wifibroadcast-svpcom/drone.key -p 5 -u 14900 -k 1 -n 2 wlan1 & /home/pi/wifibroadcast-svpcom/wfb_rx -K /home/pi/wifibroadcast-svpcom/drone.key -p 4 -u 14901 -c 127.0.0.1 -k 1 -n 2 wlan1 & rm /tmp/camera*; \ /usr/bin/raspivid -t 0 -w 640 -h 480 -fps 30/1 -b 3000000 -g 5 -cd H264 -n -fl -ih -pf high -if both -ex sports -mm average -awb horizon -a ENAC -ae 22 -o - \ | gst-launch-1.0 fdsrc \ ! h264parse \ ! video/x-h264,stream-format=byte-stream,alignment=au \ ! tee name=streams \ ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 \ ! rtph264pay name=pay0 pt=96 config-interval=1 \ ! udpsink host=127.0.0.1 port=5600 streams. \ ! shmsink socket-path=/tmp/camera1 wait-for-connection=false sync=false socat -u udp-listen:4243,reuseaddr,fork /dev/ttyAMA0,raw,echo=0,b115200 & socat -u /dev/ttyAMA0,raw,echo=0,b115200 udp-sendto:127.0.0.1:4242 & socat TUN:10.0.1.2/24,tun-name=airpituntx,iff-no-pi,tun-type=tun,su=pi,iff-up udp-sendto:127.0.0.1:14900 & socat udp-listen:14901 TUN:10.0.1.2/24,tun-name=airpitunrx,iff-no-pi,tun-type=tun,su=pi,iff-up & sleep 1 ifconfig airpituntx mtu 1400 up &
chmod ugo+xwr groundpi.sh
/etc/rc.local
"su root -c /home/pi/groundpi.sh &"
or
sudo passwd root
/etc/ssh/sshd_config
PermitRootLogin yes
On GCS
/etc/hosts
192.168.1.111 groundpi_111
ssh-keygen ssh-copy-id -i root@groundpi_111
ssh root@groundpi_111 "/home/pi/groundpi.sh MY_GCS_IP
#!/bin/bash if /bin/pidof -x "wfb_tx" >/dev/null ; then exit 1 fi #Update GCS_IP with yours #export GCS_IP=192.168.1.236 GCS_IP=$1 ifconfig wlan1 down sleep 1 iw dev wlan1 set monitor otherbss iw reg set DE ifconfig wlan1 up iw dev wlan1 set channel 36 iw dev wlan1_DEV set txpower fixed 4000 /home/pi/wifibroadcast-svpcom/wfb_rx -K /home/pi/wifibroadcast-svpcom/drone.key -p 1 -c 127.0.0.1 -u 5600 wlan1 & /home/pi/wifibroadcast-svpcom/wfb_rx -K /home/pi/wifibroadcast-svpcom/drone.key -p 2 -u 4242 -c $GCS_IP -k 1 -n 2 wlan1 & /home/pi/wifibroadcast-svpcom/wfb_tx -K /home/pi/wifibroadcast-svpcom/drone.key -p 3 -u 4243 -k 1 -n 2 wlan1 & /home/pi/wifibroadcast-svpcom/wfb_tx -K /home/pi/wifibroadcast-svpcom/drone.key -p 4 -u 14800 -k 1 -n 2 wlan1 & /home/pi/wifibroadcast-svpcom/wfb_rx -K /home/pi/wifibroadcast-svpcom/drone.key -p 5 -u 14801 -c 127.0.0.1 -k 1 -n 2 wlan1 & gst-launch-1.0 udpsrc port=5600 \ ! tee name=streams \ ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 \ ! udpsink host=127.0.0.1 port=5610 streams. \ ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 \ ! application/x-rtp, encoding-name=H264,payload=96 \ ! rtph264depay ! video/x-h264,stream-format=byte-stream \ ! fdsink \ | /home/pi/wifibroadcast_osd/fpv_video/fpv_video & /home/pi/gst-rtsp-server-1.14.4/examples/.libs/test-launch \ "\"udpsrc port=5610 do-timestamp=true ! application/x-rtp, encoding-name=H264,payload=96 ! rtph264depay ! video/x-h264,stream-format=byte-stream,alignment=au ! rtph264pay name=pay0 pt=96 config-interval=1\"" "\" " & socat -u TUN:10.0.1.1/24,tun-name=groundpituntx,iff-no-pi,tun-type=tun,iff-up udp-sendto:127.0.0.1:14800 & socat -u udp-listen:14801 TUN:10.0.1.1/24,tun-name=groundpitunrx,iff-no-pi,tun-type=tun,iff-up & sleep 1 ifconfig groundpituntx mtu 1400 up &
Check:
pi@groundpi:~ $ ssh 10.0.1.2 pi@10.0.1.2's password: Linux airpi 4.19.118+ #1311 Mon Apr 27 14:16:15 BST 2020 armv6l pi@airpi:~ $