Skip to content

Commit f5a090e

Browse files
committed
RB5 support
1 parent 9d83353 commit f5a090e

File tree

4 files changed

+87
-1
lines changed

4 files changed

+87
-1
lines changed

deploy/rb5-deploy.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -x
5+
6+
git submodule update --init --recursive
7+
8+
## Set permissions
9+
sudo adduser $USER dialout
10+
sudo adduser $USER video
11+
12+
## Packages
13+
./install_common_libraries.sh
14+
15+
sudo apt-get install -y ca-certificates curl gnupg
16+
sudo mkdir -p /etc/apt/keyrings
17+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
18+
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
19+
20+
sudo apt update
21+
sudo apt install -y nodejs
22+
23+
## Configure nmcli to not need sudo
24+
#sudo sed -i.bak -e '/^\[main\]/aauth-polkit=false' /etc/NetworkManager/NetworkManager.conf
25+
26+
## Ensure nmcli can manage all network devices
27+
#sudo touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
28+
#echo "[keyfile]" | sudo tee -a /etc/NetworkManager/conf.d/10-globally-managed-devices.conf >/dev/null
29+
#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
30+
#sudo service network-manager restart
31+
32+
## mavlink-router
33+
./build_mavlinkrouter.sh
34+
35+
## and build & run Rpanion
36+
./build_rpanion.sh
37+
38+
## For wireguard. Must be installed last as it messes the DNS resolutions
39+
sudo apt install -y resolvconf
40+
41+
sudo reboot
42+

python/gstcaps.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
device_provider = Gst.DeviceProviderFactory.get_by_name("v4l2deviceprovider")
1919
devices = device_provider.get_devices()
20-
20+
registry = Gst.Registry.get()
2121

2222
# Get list of vals in cap
2323
def getcapval(caps):
@@ -37,6 +37,12 @@ def is_raspberry_pi():
3737
return False
3838

3939

40+
# Return true if running on RB5
41+
def is_qualcomm_rb5():
42+
element = registry.find_plugin("qtiqmmfsrc")
43+
return element is not None
44+
45+
4046
retDevices = []
4147

4248
# Libcamera check, if installed
@@ -56,6 +62,26 @@ def is_raspberry_pi():
5662
except:
5763
pass
5864

65+
if is_qualcomm_rb5():
66+
# manually add cameras. 4K main:
67+
caps = []
68+
caps.append({'value': "3840x2160", 'label': "3840x2160", 'height': 2160, 'width': 3840, 'format': 'video/x-raw', 'fpsmax': '30'})
69+
caps.append({'value': "2560x1440", 'label': "2560x1440", 'height': 1440, 'width': 2560, 'format': 'video/x-raw', 'fpsmax': '30'})
70+
caps.append({'value': "1920x1080", 'label': "1920x1080", 'height': 1080, 'width': 1920, 'format': 'video/x-raw', 'fpsmax': '60'})
71+
caps.append({'value': "1280x720", 'label': "1280x720", 'height': 720, 'width': 1280, 'format': 'video/x-raw', 'fpsmax': '60'})
72+
name = "Main Camera (IMX577)"
73+
path = "qti-0"
74+
retDevices.append({'value': path, 'label': name, 'caps': caps})
75+
76+
# tracking camera
77+
caps = []
78+
caps.append({'value': "1280x800", 'label': "1280x800", 'height': 800, 'width': 1280, 'format': 'video/x-raw', 'fpsmax': '60'})
79+
caps.append({'value': "1280x720", 'label': "1280x720", 'height': 720, 'width': 1280, 'format': 'video/x-raw', 'fpsmax': '60'})
80+
caps.append({'value': "640x400", 'label': "640x400", 'height': 400, 'width': 640, 'format': 'video/x-raw', 'fpsmax': '120'})
81+
name = "Tracking Camera (OV9282)"
82+
path = "qti-1"
83+
retDevices.append({'value': path, 'label': name, 'caps': caps})
84+
5985
legacycamint = 0
6086

6187
for device in devices:

python/rtsp-server.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ def getPipeline(device, height, width, bitrate, format, rotation, framerate, tim
9494
if device == "testsrc":
9595
s_src = "videotestsrc pattern=ball ! video/x-raw,width={0},height={1}{2}".format(
9696
width, height, framestr)
97+
elif device in ["qti-0", "qti-1"]:
98+
# RB5 board
99+
s_src = "qtiqmmfsrc camera={3} ! video/x-raw,format=NV12,width={0},height={1}{2}".format(
100+
width, height, framestr, int(device[-1]))
101+
if rotation == 90:
102+
s_src += " ! qtivtransform rotate=1"
103+
if rotation == 180:
104+
s_src += " ! qtivtransform rotate=3"
105+
if rotation == 270:
106+
s_src += " ! qtivtransform rotate=2"
107+
# qtic2venc (hardware enc) won't work on rtsp. Also can't get qtioverlay to show timestamp
108+
# So, going to software encoding here :(
109+
s_h264 = "{1}x264enc tune=zerolatency bitrate={0} speed-preset=superfast".format(bitrate, ts)
97110
elif device in ["argus0", "argus1"]:
98111
s_src = "nvarguscamerasrc sensor-id={0} ! video/x-raw(memory:NVMM),width={1},height={2},format=NV12{3}".format(
99112
device[-1], width, height, framestr)

server/flightController.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,11 @@ class FCDetails {
434434
this.serialDevices.push({ value: '/dev/ttyTHS1', label: '/dev/ttyTHS1', pnpId: '' })
435435
}
436436

437+
// Qualcomm RB5
438+
if (fs.existsSync('/dev/ttyHS5')) {
439+
this.serialDevices.push({ value: '/dev/ttyHS5', label: '/dev/ttyHS5', pnpId: '' })
440+
}
441+
437442
// has the active device been disconnected?
438443
if (this.port) {
439444
console.log('Lost active device')

0 commit comments

Comments
 (0)