forked from doublerobotics/d3-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
28 lines (25 loc) · 769 Bytes
/
example.py
File metadata and controls
28 lines (25 loc) · 769 Bytes
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
import double
import sys
d3 = double.DRDoubleSDK()
try:
d3.sendCommand('events.subscribe', { 'events': [
'DRBase.status',
'DRCamera.enable'
]})
d3.sendCommand('screensaver.nudge');
d3.sendCommand('camera.enable', { 'template': 'screen' });
d3.sendCommand('base.requestStatus');
while True:
packet = d3.recv()
if packet != None:
event = packet['class'] + '.' + packet['key']
if event == 'DRBase.status':
print(packet['data'])
elif event == 'DRCamera.enable':
print('camera enabled')
except KeyboardInterrupt:
d3.sendCommand('camera.disable');
d3.sendCommand('screensaver.nudge');
d3.close()
print('cleaned up')
sys.exit(0)