Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RB5 support #186

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions deploy/rb5-deploy.sh
Original file line number Diff line number Diff line change
@@ -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

28 changes: 27 additions & 1 deletion python/gstcaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand All @@ -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:
Expand Down
13 changes: 13 additions & 0 deletions python/rtsp-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions server/flightController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down