def __init__(self, bincam, izzy, turntable, controller, options=AMTOptions()): self.bc = bincam self.izzy = izzy self.turntable = turntable self.c = controller self.options = options self.r = reset_rollout.reset(izzy, turntable)
state_path = options.supervised_dir + 'supervised'+str(rollout_num) +'/states.txt' deltas_path = options.supervised_dir + 'supervised'+str(rollout_num) +'/deltas.txt' s_paths.append(state_path) d_paths.append(deltas_path) return s_paths, d_paths def assign_path(image_path, rollout_num, options): if image_path == options.supervised_dir: return options.supervised_dir + 'supervised'+str(rollout_num) +'/supervised'+str(rollout_num) + '_frame_' + str(0) + '.jpg' elif image_path == options.rollouts_dir: return options.rollouts_dir + 'rollout'+str(rollout_num) +'/rollout'+str(rollout_num) + '_frame_' + str(0) + '.jpg' return None options = AMTOptions() net = net6.NetSix() options.tf_net = net # options.tf_net = net6.NetSix() options.tf_net_path = '/media/1tb/Izzy/nets/net6_07-01-2016_16h24m28s.ckpt' sess = net.load(var_path=options.tf_net_path) # rollout_num = 63 best_ang = [344, 357, 341, 322, 374, 319, 315, 349, 342, 373] worst_ang = [323, 356, 331, 317, 351, 336, 367, 345, 324, 366] best_fore = [317, 335, 329, 343, 337, 348, 322, 370, 323, 351] worst_fore = [325, 369, 332, 326, 339, 346, 324, 364, 359, 353] worst_test = [441, 439, 448, 440, 453] trajectories = [250, 251] + list(range(253, 280)) + [252]
return s @staticmethod def roll(tuples, change): frames, states = zip(*tuples) frames = frames[change:] states = states[:-change] return zip(frames, states) if __name__ == "__main__": bincam = BinaryCamera('./meta.txt') bincam.open() options = AMTOptions() izzy = DexRobotZeke() izzy._zeke.steady(False) t = DexRobotTurntable() options.tf_net = net6.NetSix() template_file = open(options.amt_dir + '/saved_template_paths.txt', 'r') # FOR MULTINETS changed to a list # options.tf_net_path = ['/media/1tb/Izzy/nets/net6_06-16-2016_10h43m14s.ckpt'] options.tf_net_path = '/media/1tb/Izzy/nets/net6_06-17-2016_10h20m50s.ckpt' amt = AMT(bincam, izzy, t, options=options)
person = args.name else: person = None if args.iteration: iteration = args.iteration else: iteration = 0 limited = False if args.experiment: limited = True skip = args.expedited bincam = BinaryCamera('./meta.txt') bincam.open() options = AMTOptions() izzy = DexRobotZeke() izzy._zeke.steady(False) options.tf_net = net6.NetSix() print iteration == 1 and person is not None if iteration == 1 and person is not None: template_file = open(options.templates_dir + '/training_middle_20_paths.txt', 'r') elif iteration == 2 and person is not None: template_file = open(options.templates_dir + '/training_last_20_paths.txt', 'r') else: print "not running a set iteration" template_file = open(options.templates_dir + '/saved_template_paths.txt', 'r') test_file = open(options.templates_dir + '/human_study_test_set_paths.txt', 'r')
return s @staticmethod def roll(tuples, change): frames, states = zip(*tuples) frames = frames[change:] states = states[:-change] return zip(frames, states) if __name__ == "__main__": bincam = BinaryCamera('./meta.txt') bincam.open() options = AMTOptions() #t = TurnTableControl() # the com number may need to be changed. Default of com7 is used #izzy = PyControl(115200, .04, [0,0,0,0,0],[0,0,0]) # same with this c = None #c = XboxController([options.scales[0],155,options.scales[1],155,options.scales[2],options.scales[3]]) izzy = DexRobotZeke() izzy._zeke.steady(False) t = DexRobotTurntable() #options.tf_net = net5.NetFive() #options.tf_net_path = '/home/annal/Izzy/vision_amt/Net/tensor/net5/net5_02-15-2016_11h58m56s.ckpt' options.tf_net = net6.NetSix() #options.tf_net_path = '/media/1tb/Izzy/nets/net6_02-26-2016_17h58m15s.ckpt' #options.tf_net_path = '/media/1tb/Izzy/nets/net6_02-27-2016_15h30m01s.ckpt'
return s @staticmethod def roll(tuples, change): frames, states = zip(*tuples) frames = frames[change:] states = states[:-change] return zip(frames, states) if __name__ == "__main__": bincam = BinaryCamera('./meta.txt') bincam.open() options = AMTOptions() izzy = DexRobotZeke() izzy._zeke.steady(False) # t = DexRobotTurntable() # options.tf_net = net6_c.NetSix_C() options.tf_net = net6.NetSix() template_file = open(options.amt_dir + '/saved_template_paths.txt', 'r') # FOR MULTINETS changed to a list # options.tf_net_path = ['/media/1tb/Izzy/nets/net6_06-16-2016_10h43m14s.ckpt'] options.tf_net_path = '/media/1tb/Izzy/nets/net6_06-22-2016_11h32m47s.ckpt'
if args.name: person = args.name else: person = None if args.iteration: iteration = args.iteration else: iteration = 0 limited = False if args.experiment: limited = True bincam = BinaryCamera('./meta.txt') bincam.open() options = AMTOptions() izzy = DexRobotZeke() izzy._zeke.steady(False) options.tf_net = net6.NetSix() print iteration == 1 and person is not None if iteration == 1 and person is not None: template_file = open(options.templates_dir + '/training_middle_20_paths.txt', 'r') elif iteration == 2 and person is not None: template_file = open(options.templates_dir + '/training_last_20_paths.txt', 'r') else: print "not running a set iteration" template_file = open(options.templates_dir + '/saved_template_paths.txt', 'r')
return s @staticmethod def roll(tuples, change): frames, states = zip(*tuples) frames = frames[change:] states = states[:-change] return zip(frames, states) if __name__ == "__main__": bincam = BinaryCamera('./meta.txt') bincam.open() options = AMTOptions() izzy = DexRobotZeke() izzy._zeke.steady(False) t = DexRobotTurntable() options.tf_net = net6.NetSix() options.tf_net_path = '/media/1tb/Izzy/nets/net6_03-28-2016_14h51m12s.ckpt' amt = AMT(bincam, izzy, t, options=options) while True: print "Waiting for keypress ('q' -> quit, 'r' -> rollout, 'u' -> update weights, 't' -> test, 'd' -> demonstrate, 'c' -> compile train/test sets): " char = getch() if char == 'q': print "Quitting..."