Skip to content

Commit

Permalink
RB5 support
Browse files Browse the repository at this point in the history
bitrate

Fix append typo

quote fix

more quote fix

morefix
  • Loading branch information
stephendade committed Dec 12, 2023
1 parent 9d83353 commit e22a8dc
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 1 deletion.
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
15 changes: 15 additions & 0 deletions python/rtsp-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,21 @@ 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(memory:GBM),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"
if timestamp:
s_src += " ! qtioverlay overlay-date=date0,date-format=\"10122023\",time-format=\"101010_24HR\",color=(uint)0xFF00FFFF,dest-rect=<0,0,256,80>;"
s_h264 = "qtic2venc control-rate=3 target-bitrate={0} idr-interval=15 ! video/x-h264 ! h264parse".format(
bitrate*1000)
#gst-launch-1.0 -e qtiqmmfsrc name=qmmf camera=0 ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1 ! qtioverlay overlay-date="date0,date-format=\"10122023\", time-format=\"101010_24HR\",color=(uint)0xFF00FFFF, dest-rect=<0, 0, 256, 80>;" ! waylandsink x=0 y=0 width=1920 height=1080 sync=false
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

0 comments on commit e22a8dc

Please sign in to comment.