def setup(parse_sys=True): global mode,klampt_model,motion_server_addr import os import motion motion_root = os.getenv("MOTION_API_PATH","./") if parse_sys: parse_args() print "Loading Motion Module model",klampt_model motion.setup(mode=mode,klampt_model=klampt_model,libpath=motion_root,server_addr=motion_server_addr)
def setup(parse_sys=True): global mode,klampt_model,motion_server_addr import os import motion ebolabot_root = os.getenv("EBOLABOT_PATH","./") if parse_sys: parse_args() print "Loading Motion Module model",klampt_model motion.setup(mode=mode,klampt_model=klampt_model,libpath=ebolabot_root,server_addr=motion_server_addr)
if __name__=='__main__': print('Program is starting') global currentHour global beginningHour #global r currentHour = int(datetime.today().strftime('%H')) print "Current Hour: " + str(currentHour) beginningHour = currentHour try: bub = time.time() motion_sensor_queue = mp.Queue() #used to get info from motion sensor motion_sensor_lock = mp.Lock() setup() #sets up Power Relay off() x = threading.Thread( target = lcd_multithread.LCDprint, args=("You could not Live with your own failure. Where did that bring you? Back to me",) ) x.daemon = True x.start() #start LCD motion.setup( motion_sensor_queue, motion_sensor_lock ) y = mp.Process(target = motion.loop, args = () ) y.start() t = threading.Thread ( target = Timer_Thread, args = () ) t.daemon = True t.start() #start timer thread (controls LCD and power relay) loop() except KeyboardInterrupt: turn_that_trash_off() r = False print "Exiting\n"
date = str(month) + '/' + str(day) + '/' + str(year) print date currentHour = int(datetime.today().strftime('%H')) beginningHour = currentHour #wait another hour to check if __name__=='__main__': print('Program is starting') global currentHour global beginningHour global r currentHour = int(datetime.today().strftime('%H')) beginningHour = currentHour """ This is where we shall start the thread for the LCD. """ try: x = threading.Thread(target=lcd_multithread.LCDprint,args=("Tom is stupid x.start() motion.setup() y = threading.Thread(target = motion.loop, args y.start() loop() except KeyboardInterrupt: r = False print "Exiting\n"
def keyboardfunc(self,c,x,y): #Put your keyboard handler here #the current example toggles simulation / movie mode print c,"pressed" if c == 'q': motion.robot.shutdown() exit(0) glutPostRedisplay() if __name__ == "__main__": print "motion_visualizer.py: sets up a visualizer for testing Motion" print "control loops. Press q to exit." print print "Loading APC Motion model",klampt_model motion.setup(mode=mode,klampt_model=klampt_model,libpath="./") res = motion.robot.startup() if not res: print "Error starting up APC Motion" exit(1) time.sleep(0.1) world = WorldModel() res = world.readFile(klampt_model) if not res: raise RuntimeError("Unable to load APC Motion model "+fn) viewer = MyGLViewer(world) viewer.run()