-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrun.py
57 lines (43 loc) · 1.46 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
"""
GrabberControls2Gui
---------------------
Simple GUI for controlling GigE cameras using Aravis and YARP
Author: David Estevez
Copyright: Universidad Carlos III de Madrid (C) 2017;
CopyPolicy: Released under the terms of the GNU GPL v2.0.
"""
import sys
import logging
import begin
import yarp
from PySide2 import QtWidgets
from .GrabberControls2GuiBackend import GrabberControls2GuiBackend
from .GrabberControls2GuiGUI import GrabberControls2GuiGUI
@begin.start(auto_convert=True)
@begin.logging
def main(remote_port: 'Remote port running the AravisGigE grabber'='/grabber'):
# Check for YARP network
yarp.Network.init()
if not yarp.Network.checkNetwork():
logging.error('Could not connect to YARP network. Please try running YARP server.')
sys.exit(1)
# Create and configure driver
options = yarp.Property()
options.put('device', 'remote_grabber')
options.put('remote', remote_port)
options.put('local', '/grabberControls2Gui')
dd = yarp.PolyDriver(options)
# View driver as FrameGrabber
controls = dd.viewIFrameGrabberControls()
# Create Qt app
app = QtWidgets.QApplication(sys.argv)
# Create the widget and show it
controller = GrabberControls2GuiBackend(controls)
gui = GrabberControls2GuiGUI(controller)
gui.show()
# Run the app
exit_code = app.exec_()
dd.close()
yarp.Network.fini() # disconnect from the YARP network
sys.exit(exit_code)