示例#1
0
def main():
    try:
        bot = StratumsphereStatusBot('#stratum0')
        bot.connection.buffer_class.errors = 'replace'
        callbacks['send_status'] = bot.send_status
        jsonserver = JsonServer(('134.169.175.96', 8766))

        status.init()
        jsonserver.start()
        bot.start()
    except KeyboardInterrupt:
        bot.connection.quit("I'm meeeltiiiiiiing!")
        jsonserver.stop()
        jsonserver.join()
示例#2
0
文件: main.py 项目: cboylan/pdx-rov
		opts, args = getopt.getopt(sys.argv[1:], 'p:s:t:u:h', '')
	except getopt.GetOptError:
		print 'Invalid argument'
		showHelp()
	for opt in opts:
		if opt[0] == '-p':
			port = int(opt[1])
		elif opt[0] == '-s':
			SC_PATH = opt[1]
		elif opt[0] == '-t':
			T1_PATH = opt[1]
		elif opt[0] == '-u':
			T2_PATH = opt[1]
		elif opt[0] == '-h':
			showHelp()
			sys.exit(0)
	setupLogging()

	#propulsion = Propulsion(Teensy('/dev/ttyACM0'))
	arm = arm.Arm(Teensy('/dev/ttyACM0'))
	
	server = JsonServer('', port)
#	server.add_module('propulsion', propulsion)
	server.add_module('arm', arm)
	
	while True:
		asyncore.loop(timeout=.02, count=1)
		cur_time = time.time()
		servo.servo_manager.update_servos(cur_time)