diff --git a/deploy/rb5-deploy.sh b/deploy/rb5-deploy.sh new file mode 100644 index 00000000..dd5342c8 --- /dev/null +++ b/deploy/rb5-deploy.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +set -e +set -x + +git submodule update --init --recursive + +## Set permissions +sudo adduser $USER dialout +sudo adduser $USER video + +## Packages +./install_common_libraries.sh + +sudo apt-get install -y ca-certificates curl gnupg +sudo mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list + +sudo apt update +sudo apt install -y nodejs + +## Configure nmcli to not need sudo +#sudo sed -i.bak -e '/^\[main\]/aauth-polkit=false' /etc/NetworkManager/NetworkManager.conf + +## Ensure nmcli can manage all network devices +#sudo touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf +#echo "[keyfile]" | sudo tee -a /etc/NetworkManager/conf.d/10-globally-managed-devices.conf >/dev/null +#echo "unmanaged-devices=*,except:type:wifi,except:type:gsm,except:type:cdma,except:type:wwan,except:type:ethernet,type:vlan" | sudo tee -a /etc/NetworkManager/conf.d/10-globally-managed-devices.conf >/dev/null +#sudo service network-manager restart + +## mavlink-router +./build_mavlinkrouter.sh + +## and build & run Rpanion +./build_rpanion.sh + +## For wireguard. Must be installed last as it messes the DNS resolutions +sudo apt install -y resolvconf + +sudo reboot + diff --git a/python/gstcaps.py b/python/gstcaps.py index 9347b03b..ed1ef9f7 100755 --- a/python/gstcaps.py +++ b/python/gstcaps.py @@ -17,7 +17,7 @@ device_provider = Gst.DeviceProviderFactory.get_by_name("v4l2deviceprovider") devices = device_provider.get_devices() - +registry = Gst.Registry.get() # Get list of vals in cap def getcapval(caps): @@ -37,6 +37,12 @@ def is_raspberry_pi(): return False +# Return true if running on RB5 +def is_qualcomm_rb5(): + element = registry.find_plugin("qtiqmmfsrc") + return element is not None + + retDevices = [] # Libcamera check, if installed @@ -56,6 +62,26 @@ def is_raspberry_pi(): except: pass +if is_qualcomm_rb5(): + # manually add cameras. 4K main: + caps = [] + caps.append({'value': "3840x2160", 'label': "3840x2160", 'height': 2160, 'width': 3840, 'format': 'video/x-raw', 'fpsmax': '30'}) + caps.append({'value': "2560x1440", 'label': "2560x1440", 'height': 1440, 'width': 2560, 'format': 'video/x-raw', 'fpsmax': '30'}) + caps.append({'value': "1920x1080", 'label': "1920x1080", 'height': 1080, 'width': 1920, 'format': 'video/x-raw', 'fpsmax': '60'}) + caps.append({'value': "1280x720", 'label': "1280x720", 'height': 720, 'width': 1280, 'format': 'video/x-raw', 'fpsmax': '60'}) + name = "Main Camera (IMX577)" + path = "qti-0" + retDevices.append({'value': path, 'label': name, 'caps': caps}) + + # tracking camera + caps = [] + caps.append({'value': "1280x800", 'label': "1280x800", 'height': 800, 'width': 1280, 'format': 'video/x-raw', 'fpsmax': '60'}) + caps.append({'value': "1280x720", 'label': "1280x720", 'height': 720, 'width': 1280, 'format': 'video/x-raw', 'fpsmax': '60'}) + caps.append({'value': "640x400", 'label': "640x400", 'height': 400, 'width': 640, 'format': 'video/x-raw', 'fpsmax': '120'}) + name = "Tracking Camera (OV9282)" + path = "qti-1" + retDevices.append({'value': path, 'label': name, 'caps': caps}) + legacycamint = 0 for device in devices: diff --git a/python/rtsp-server.py b/python/rtsp-server.py index e08bd22a..af6e8d49 100755 --- a/python/rtsp-server.py +++ b/python/rtsp-server.py @@ -94,6 +94,19 @@ def getPipeline(device, height, width, bitrate, format, rotation, framerate, tim if device == "testsrc": s_src = "videotestsrc pattern=ball ! video/x-raw,width={0},height={1}{2}".format( width, height, framestr) + elif device in ["qti-0", "qti-1"]: + # RB5 board + s_src = "qtiqmmfsrc camera={3} ! video/x-raw,format=NV12,width={0},height={1}{2}".format( + width, height, framestr, int(device[-1])) + if rotation == 90: + s_src += " ! qtivtransform rotate=1" + if rotation == 180: + s_src += " ! qtivtransform rotate=3" + if rotation == 270: + s_src += " ! qtivtransform rotate=2" + # qtic2venc (hardware enc) won't work on rtsp. Also can't get qtioverlay to show timestamp + # So, going to software encoding here :( + s_h264 = "{1}x264enc tune=zerolatency bitrate={0} speed-preset=superfast".format(bitrate, ts) elif device in ["argus0", "argus1"]: s_src = "nvarguscamerasrc sensor-id={0} ! video/x-raw(memory:NVMM),width={1},height={2},format=NV12{3}".format( device[-1], width, height, framestr) diff --git a/server/flightController.js b/server/flightController.js index 5e831f28..720e14a3 100644 --- a/server/flightController.js +++ b/server/flightController.js @@ -434,6 +434,11 @@ class FCDetails { this.serialDevices.push({ value: '/dev/ttyTHS1', label: '/dev/ttyTHS1', pnpId: '' }) } + // Qualcomm RB5 + if (fs.existsSync('/dev/ttyHS5')) { + this.serialDevices.push({ value: '/dev/ttyHS5', label: '/dev/ttyHS5', pnpId: '' }) + } + // has the active device been disconnected? if (this.port) { console.log('Lost active device')