forked from IQTLabs/SkyScan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_move.py
67 lines (55 loc) · 2.58 KB
/
test_move.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
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python3
import argparse
import logging
import coloredlogs
import sys
import os
import time
from sensecam_control import vapix_control,vapix_config
def main():
global camera
global cameraConfig
parser = argparse.ArgumentParser(description='An MQTT based camera controller')
parser.add_argument('-u', '--axis-username', help="Username for the Axis camera", required=True)
parser.add_argument('-p', '--axis-password', help="Password for the Axis camera", required=True)
parser.add_argument('-a', '--axis-ip', help="IP address for the Axis camera", required=True)
args = parser.parse_args()
print("hello")
styles = {'critical': {'bold': True, 'color': 'red'}, 'debug': {'color': 'green'}, 'error': {'color': 'red'}, 'info': {'color': 'white'}, 'notice': {'color': 'magenta'}, 'spam': {'color': 'green', 'faint': True}, 'success': {'bold': True, 'color': 'green'}, 'verbose': {'color': 'blue'}, 'warning': {'color': 'yellow'}}
level = logging.DEBUG if '-v' in sys.argv or '--verbose' in sys.argv else logging.INFO
if 1:
coloredlogs.install(level=level, fmt='%(asctime)s.%(msecs)03d \033[0;90m%(levelname)-8s '
''
'\033[0;36m%(filename)-18s%(lineno)3d\033[00m '
'%(message)s',
level_styles = styles)
else:
# Show process name
coloredlogs.install(level=level, fmt='%(asctime)s.%(msecs)03d \033[0;90m%(levelname)-8s '
'\033[0;90m[\033[00m \033[0;35m%(processName)-15s\033[00m\033[0;90m]\033[00m '
'\033[0;36m%(filename)s:%(lineno)d\033[00m '
'%(message)s')
print("hello")
logging.info("---[ Starting %s ]---------------------------------------------" % sys.argv[0])
camera = vapix_control.CameraControl(args.axis_ip, args.axis_username, args.axis_password)
print("hello")
#############################################
## Main Loop ##
#############################################
while True:
delay = 5
camera.absolute_move(0, 0, 0, 50)
time.sleep(delay)
camera.absolute_move(90, 0, 0, 50)
time.sleep(delay)
camera.absolute_move(180, 0, 0, 50)
time.sleep(delay)
camera.absolute_move(270, 0, 0, 50)
time.sleep(delay)
camera.absolute_move(0, 90, 0, 50)
time.sleep(delay)
if __name__ == "__main__":
try:
main()
except Exception as e:
logging.critical(e, exc_info=True)