Setup spiri-link

This commit is contained in:
Alex 2024-10-20 14:17:07 -03:00
parent cc38077527
commit aa97e869d5
6 changed files with 78 additions and 2 deletions

View File

@ -1,5 +1,6 @@
# Makefile for installation of echomav_deploy on EchoPilot AI hardware # Makefile for installation of echomav_deploy on EchoPilot AI hardware
# This is installation of mavlink-router, cockpit and network setup # This is installation of mavlink-router, cockpit and network setup
# Spiri modified to install additional features
.DEFAULT_GOAL := default .DEFAULT_GOAL := default
SHELL := /bin/bash SHELL := /bin/bash
SUDO := $(shell test $${EUID} -ne 0 && echo "sudo") SUDO := $(shell test $${EUID} -ne 0 && echo "sudo")
@ -7,7 +8,7 @@ SUDO := $(shell test $${EUID} -ne 0 && echo "sudo")
SYSCFG = /etc/mavlink-router SYSCFG = /etc/mavlink-router
CONFIG ?= /var/local CONFIG ?= /var/local
LIBSYSTEMD=/lib/systemd/system LIBSYSTEMD=/lib/systemd/system
SERVICES=mavlink-router.service temperature.service SERVICES=mavlink-router.service temperature.service wifibroadcast@drone fpv-camera.service
DRY_RUN=false DRY_RUN=false
LOCAL=/usr/local LOCAL=/usr/local
LOCAL_SCRIPTS=temperature.sh cockpitScript.sh LOCAL_SCRIPTS=temperature.sh cockpitScript.sh
@ -78,6 +79,28 @@ install:
@$(SUDO) install -Dm755 version.txt $(LOCAL)/echopilot/. @$(SUDO) install -Dm755 version.txt $(LOCAL)/echopilot/.
@for s in $(LOCAL_SCRIPTS) ; do $(SUDO) install -Dm755 $${s} $(LOCAL)/echopilot/$${s} ; done @for s in $(LOCAL_SCRIPTS) ; do $(SUDO) install -Dm755 $${s} $(LOCAL)/echopilot/$${s} ; done
# install modified 8812EU drivers
@git clone https://github.com/libc0607/rtl88x2eu-20230815 ~/tmp/rtl88x2eu && cd ~/tmp/rtl88x2eu && git submodule update --init --recursive
@$(SUDO) sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile
@$(SUDO) sed -i 's/CONFIG_PLATFORM_ARM64_RPI = n/CONFIG_PLATFORM_ARM64_RPI = y/g' Makefile
@$(SUDO) apt -y install dkms
@$(SUDO) ./dkms-install.sh
# configure naming of wireless interface
# Install WFB-NG dependancies and compile deb
@git clone -b stable https://github.com/svpcom/wfb-ng.git ~/tmp/wfb-ng && cd ~/tmp/wfb-ng
@$(SUDO) apt -y install python3-all libpcap-dev libsodium-dev python3-pip python3-pyroute2 python3-future python3-twisted python3-serial python3-all-dev iw virtualenv debhelper dh-python build-essential
@$(SUDO) make deb
@$(SUDO) dpkg -i /deb_dist/wfb*.deb
# create initial WFB-NG config file
@$(SUDO) cp wifibroadcast.cfg /etc/
# move drone encryption key to /etc/
@$(SUDO) cp drone.key /etc/
# stop any running services we care about # stop any running services we care about
@for c in stop disable ; do $(SUDO) systemctl $${c} $(SERVICES) ; done ; true @for c in stop disable ; do $(SUDO) systemctl $${c} $(SERVICES) ; done ; true

BIN
drone.key Normal file

Binary file not shown.

26
fpv-camera.service Normal file
View File

@ -0,0 +1,26 @@
[Unit]
Description=FPV camera
After=network-online.target
[Service]
## Pipeline for PI camera
#ExecStart=/bin/sh -c 'gst-launch-1.0 v4l2src do-timestamp=true io-mode=mmap device=/dev/video0 extra-controls="controls,rotate=180,image_stabilization=1,h264_profile=4,h264_i_frame_period=60,h264_level=11,power_line_frequency=1,exposure_metering_mong=1,exposure_dynamic_framerate=0,scene_mode=0,video_bitrate_mode=1,video_bitrate=4000000,repeat_sequence_header=1" ! video/x-h264,profile=high,width=1280,height=720,framerate=30/1,stream-format=byte-stream ! h264parse disable-passthrough=true ! rtph264pay config-interval=1 pt=96 mtu=1400 aggregate-mode=zero-latency ! udpsink host=127.0.0.1 port=5602 sync=false'
##
## Pipeline for Logitec C920 camera
# ExecStart=/bin/sh -c "gst-launch-1.0 uvch264src device=/dev/video0 initial-bitrate=4000000 average-bitrate=4000000 iframe-period=1000 name=src auto-start=true src.vidsrc ! video/x-h264,width=1280,height=720,framerate=30/1 ! h264parse disable-passthrough=true ! rtph264pay config-interval=1 pt=96 mtu=1400 aggregate-mode=zero-latency ! udpsink host=127.0.0.1 port=5602 sync=false"
##
## Pipeline for IP Camera
ExecStart=/bin/sh -c "gst-launch-1.0 rtspsrc protocols=tcp location=rtsp:192.168.10.11:8554/main.264 ! udpsink host=127.0.0.1 port=5602 sync=false"
##
Type=simple
Restart=always
RestartSec=1s
TimeoutStopSec=10s
KillMode=control-group
[Install]
WantedBy=multi-user.target

View File

@ -49,6 +49,21 @@ Mode = Normal
Address = 10.223.1.10 Address = 10.223.1.10
Port = 14550 Port = 14550
##
## UDP endpoints for connecting to SpiriLink
##
## sends UDP stream to localhost so WFB-NG can send it over the air to the ground control station
[UdpEndpoint ardupilot]
Mode = Eavesdropping
Address = 127.0.0.1
Port = 24550
[UdpEndpoint wifibroadcast]
Mode = Normal
Address = 127.0.0.1
Port = 14550
## ##
## TCP Client Endpoint Configuration Alpha ## TCP Client Endpoint Configuration Alpha
## ##

View File

@ -6,7 +6,7 @@
# The first two octets cab be changed per IP_PREFIX # The first two octets cab be changed per IP_PREFIX
# An alias is also added to the interface with the value of BACKDOOR_ADDR # An alias is also added to the interface with the value of BACKDOOR_ADDR
IP_PREFIX="10.223" IP_PREFIX="192.168"
BACKDOOR_ADDR="192.168.154.0/24" BACKDOOR_ADDR="192.168.154.0/24"
sigterm_handler() { sigterm_handler() {
echo "Shutdown signal received." echo "Shutdown signal received."

12
wifibroadcast.cfg Normal file
View File

@ -0,0 +1,12 @@
[common]
wifi_channel = 161 # 161 -- radio channel @5825 MHz, range: 58155835 MHz, width 20MHz
# 1 -- radio channel @2412 Mhz,
# see https://en.wikipedia.org/wiki/List_of_WLAN_channels for reference
wifi_region = 'BO' # Your country for CRDA (use BO or GY if you want max tx power)
[drone_mavlink]
peer = 'listen://0.0.0.0:14550' # incoming connection
#peer = 'connect://127.0.0.1:14550' # outgoing connection
[drone_video]
peer = 'listen://0.0.0.0:5602' # listen for video stream (gstreamer on drone)