Skip to content
Snippets Groups Projects
Commit f11ecc17 authored by SebCas18's avatar SebCas18
Browse files

added stuff to change cache for different cameras

parent 1f9c722b
Branches master
No related tags found
No related merge requests found
default_map=Torrey
cams=Mid Res Cam,rtsp://admin:1234@192.168.0.30:554/media/media.amp?streamprofile=Profile6,Low Res Cam,rtsp://admin:1234@192.168.0.22:554/media/media.amp?streamprofile=Profile8,Amazon Special,rtsp://192.168.0.15:554/user=admin&password=&channel=1&stream=0.sdp
default_cam_1=2
default_cam_2=2
default_cam_3=0
default_map=Torrey
cams=Mid Res Cam,rtsp://admin:1234@192.168.0.42:554/media/media.amp?streamprofile=Profile8,0,Low Res Cam,rtsp://admin:1234@192.168.0.22:554/media/media.amp?streamprofile=Profile8,0,Amazon Special,rtsp://192.168.0.15:554/user=admin&password=&channel=1&stream=0.sdp,500ms
default_cam_1=6
default_cam_2=1
default_cam_3=2
......@@ -6,13 +6,13 @@ import vlc
class Player(QtGui.QWidget):
def __init__(self, urls, x, y, master=None):
def __init__(self, urls, cache, x, y, master=None):
super(Player, self).__init__(master)
self.sizeX = x
self.sizeY = y
self.createUI(urls)
self.createUI(urls, cache)
def createUI(self, urls):
def createUI(self, urls, cache):
self.widget = QtGui.QWidget(self)
# self.setContentsMargins(0, 0, 10, 5)
......@@ -23,7 +23,7 @@ class Player(QtGui.QWidget):
self.hbox.setContentsMargins(0, 0, 0, 0)
# Create the VLC video widgets
self.videos = self.createVLCWidgets(urls)
self.videos = self.createVLCWidgets(urls, cache)
self.recorders = self.createRecorders(urls)
for i in range(0, len(urls)):
......@@ -56,11 +56,11 @@ class Player(QtGui.QWidget):
self.videos[i].assignWindowId()
self.videos[i].play()
def createVLCWidgets(self, urls):
def createVLCWidgets(self, urls, cache):
# Empty list to hold vlc widgets
widgets = []
for i in range(0, len(urls)):
vlc_widget = CustomWidgets.VLCWidget(urls[i], ":network-caching=0", i)
vlc_widget = CustomWidgets.VLCWidget(urls[i], ":network-caching=" + cache[i], i)
vlc_widget.id = i
widgets.append(vlc_widget)
......
......@@ -204,11 +204,11 @@ class ArmConnection(UdpConnection):
# Change accordingly if your controller is different
base_rotation = self._base_axis(2, 5) / -2 # Triggers
shoulder = - self._joy_axis(1) / 2 # Left stick Y axis
elbow = self._joy_axis(4) / -2 # Right stick Y axis
wrist_lift = self._button_axis(2, 0) / 2 # X- open hand, A- Close hand. (x left, a bottom)
wrist_lift = self._joy_axis(4) / -2 # Right stick Y axis
elbow = self._button_axis(2, 0) / 2 # X- open hand, A- Close hand. (x left, a bottom)
wrist_rotation = self._button_axis(4, 5) / -4 # Bumpers
hand_grip = self._button_axis(1, 3) # B is down, Y is up (B is right, Y is up)
winch = self._joy_axis(0)
winch = self._joy_axis(0) / 5
buff = struct.pack("<fffffff", base_rotation, shoulder, elbow, wrist_lift, wrist_rotation, hand_grip, winch)
......
......@@ -13,6 +13,7 @@ class Settings:
self.main = ui
self.cam_list = []
self.cache_list = []
self.main.generate.clicked.connect(self.generate_new_map)
......@@ -128,6 +129,15 @@ class Settings:
return temp
def get_camera_cache(self):
temp = []
temp.append(self.cache_list[self.main.cam1.currentIndex()])
temp.append(self.cache_list[self.main.cam2.currentIndex()])
temp.append(self.cache_list[self.main.cam3.currentIndex()])
return temp
# Saves the current state of the settings page except for generation of new map form
def save(self):
"""
......@@ -177,12 +187,14 @@ class Settings:
list = QtCore.QStringList()
for i in range(0, len(camList)):
if i % 2 == 0:
if i % 3 == 0:
# Add the names of the cameras
list.append(camList[i])
else:
elif i % 3 == 1:
# Add the URLS to the list
self.cam_list.append(camList[i])
else :
self.cache_list.append(camList[i])
# Add the options to the selection boxes
self.main.cam1.addItems(list)
......
......@@ -24,7 +24,8 @@ def quitting():
# Shutdown the networking thread
iplist.worker.quit()
# Save the changes to the settings by the user
setting_widget.save()
# TODO: revert changes I made
#setting_widget.save()
cam1.quit()
cam2.quit()
......@@ -45,6 +46,7 @@ win.resize(1200, 675)
'''Init the Joysticks and Camera Movement Code'''
joys = joystick.getJoysticks()
+9
joys.start()
cam1 = Camera_Controller.CameraMove(joys, 1, "192.168.0.42", "admin", "1234")
cam1.start()
......@@ -57,7 +59,8 @@ sock = comms_update.ConnectionManager()
setting_widget = settings.Settings(main)
stop_widget = stop.Stop()
vlc_widget = UI.Player(setting_widget.get_camera_urls(), 300, 200)
vlc_widget = UI.Player(setting_widget.get_camera_urls(), setting_widget.get_camera_cache(), 300, 200)
# made change here!!!
# IP Pinging List, update specified in milliseconds
iplist = IPCheckerLayout.IPList({"192.168.0.50": "Rover Main", "192.168.0.90": "Arm Main", "192.168.0.91":
"Science Main", "192.168.0.22": "Eye of Sauron", "192.168.0.42": "Ground Cam",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment