yarp-devices
Loading...
Searching...
No Matches
exampleRemoteGrabber.py
1
4
5
6
7import yarp
8yarp.Network.init() # Check for YARP network
9
10if not yarp.Network.checkNetwork():
11 print('Could not connect to YARP network. Please try running YARP server.')
12 quit()
13
14# Create and configure driver
15options = yarp.Property()
16options.put('device','frameGrabber_nwc_yarp')
17options.put('remote', '/grabber')
18options.put('local','/python/grabber')
19
20dd = yarp.PolyDriver(options)
21
22if not dd.isValid():
23 print('[error] Please launch camera side')
24 quit()
25
26# View grabber interfaces
27grabberControls = dd.viewIFrameGrabberControls()
28grabber = dd.viewIFrameGrabberImage()
29
30# Check if a feature exists
31print(grabberControls.hasFeature(yarp.YARP_FEATURE_GAIN))
32
33# Get the current value of a feature
34gain = grabberControls.getFeature(yarp.YARP_FEATURE_GAIN)
35print(gain)
36
37# Set a new value for a feature
38grabberControls.setFeature(yarp.YARP_FEATURE_GAIN, 10)
39
40# Obtain an image
41yarp.delay(0.5) # May have to previously wait
42yarpImg = yarp.ImageRgb()
43grabber.getImage(yarpImg)
44
45# Close device and disconnect from the YARP network
46dd.close()
47yarp.Network.fini()