diff --git a/Makefile b/Makefile index bbdfe82..ac046e0 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ # Makefile for installation of echomav_deploy on EchoPilot AI hardware # This is installation of mavlink-router, cockpit and network setup +# Spiri modified to install additional features .DEFAULT_GOAL := default SHELL := /bin/bash SUDO := $(shell test $${EUID} -ne 0 && echo "sudo") @@ -7,7 +8,7 @@ SUDO := $(shell test $${EUID} -ne 0 && echo "sudo") SYSCFG = /etc/mavlink-router CONFIG ?= /var/local LIBSYSTEMD=/lib/systemd/system -SERVICES=mavlink-router.service temperature.service +SERVICES=mavlink-router.service temperature.service wifibroadcast@drone fpv-camera.service DRY_RUN=false LOCAL=/usr/local LOCAL_SCRIPTS=temperature.sh cockpitScript.sh @@ -78,6 +79,28 @@ install: @$(SUDO) install -Dm755 version.txt $(LOCAL)/echopilot/. @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 @for c in stop disable ; do $(SUDO) systemctl $${c} $(SERVICES) ; done ; true diff --git a/drone.key b/drone.key new file mode 100644 index 0000000..f0acf69 Binary files /dev/null and b/drone.key differ diff --git a/fpv-camera.service b/fpv-camera.service new file mode 100644 index 0000000..ec90711 --- /dev/null +++ b/fpv-camera.service @@ -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 \ No newline at end of file diff --git a/main.conf b/main.conf index 2d883c2..91af097 100644 --- a/main.conf +++ b/main.conf @@ -49,6 +49,21 @@ Mode = Normal Address = 10.223.1.10 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 ## diff --git a/static-network.sh b/static-network.sh index c307153..e0d0453 100644 --- a/static-network.sh +++ b/static-network.sh @@ -6,7 +6,7 @@ # The first two octets cab be changed per IP_PREFIX # 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" sigterm_handler() { echo "Shutdown signal received." diff --git a/wifibroadcast.cfg b/wifibroadcast.cfg new file mode 100644 index 0000000..e362e07 --- /dev/null +++ b/wifibroadcast.cfg @@ -0,0 +1,12 @@ +[common] +wifi_channel = 161 # 161 -- radio channel @5825 MHz, range: 5815–5835 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) \ No newline at end of file