def main(argv): try: opts, args = getopt.getopt(argv, 'h:v', ['help', 'viewer']) except getopt.GetoptError as err: print str(err) print HELP_MESSAGE return viewer = False for opt, arg in opts: if opt in ('-h', '--help'): print HELP_MESSAGE return elif opt in ('-v', '--viewer'): viewer = True env = Environment() try: execute = lambda: script(env) if viewer: execute_viewer(env, execute) else: execute() finally: if env.GetViewer() is not None: env.GetViewer().quitmainloop() RaveDestroy()
def main(argv): parser = argparse.ArgumentParser() # Automatically includes help parser.add_argument('-viewer', action='store_true', help='enable viewer.') args = parser.parse_args() env = Environment() try: execute = lambda: solve_tamp(env) if args.viewer: execute_viewer(env, execute) else: execute() finally: if env.GetViewer() is not None: env.GetViewer().quitmainloop() RaveDestroy() print 'Done!'
def main(or_viewer=False, hpn_viewer=False): #exp = Experiment({'tableIkea1' : (hu.Pose(1.3, 0.0, 0.0, math.pi/2.0), TINY_VAR)}, # {'objA' : (hu.Pose(1.1, 0.0, ikZ, 0.0), TINY_VAR)}, # ['tableIkea1Top', 'tableIkea1Left']) #PlanTest(exp) #raw_input('Here') # NOTE - cannot run both viewers assert not or_viewer or not hpn_viewer print 'Window:', not debug('noW') env = Environment() # NOTE - need this for load_problem #execute = lambda: solve_belief(env, no_window=not hpn_viewer) execute = lambda: solve_deterministic(env, no_window=not hpn_viewer) #execute = lambda: openrave_test(env) #execute = lambda: grasp_test(env, no_window=not hpn_viewer) try: if or_viewer: execute_viewer(env, execute) else: execute() finally: if env.GetViewer() is not None: env.GetViewer().quitmainloop() RaveDestroy()
def main(argv): parser = argparse.ArgumentParser() # Automatically includes help parser.add_argument('--problem', help='problem name.', default='simple') parser.add_argument('-fd', action='store_true', help='FastDownward (a dummy flag).') parser.add_argument('-viewer', action='store_true', help='enable viewer.') parser.add_argument('-display', action='store_true', help='display solution.') parser.add_argument('-focus', action='store_true', help='focused.') parser.add_argument('-movie', action='store_true', help='record a movie.') args = parser.parse_args() if args.problem not in list_problems(): print args.problem, 'is not a valid problem' return env = Environment() # NOTE - need this for load_problem problem = load_problem(args.problem) try: execute = lambda: solve_tamp(env, problem, args.display, incremental=not args.focus, focused=args.focus, movie=args.movie) if args.viewer: execute_viewer(env, execute) else: execute() finally: if env.GetViewer() is not None: env.GetViewer().quitmainloop() RaveDestroy()
def main(argv): HELP_MESSAGE = 'python generate_problem.py -p <problem>' try: opts, args = getopt.getopt(argv, 'hp:v', ['help', 'problem=', 'visualize']) except getopt.GetoptError: print HELP_MESSAGE return problem = None visualize = False for opt, arg in opts: if opt in ('-h', '--help'): print HELP_MESSAGE return elif opt in ('-p', '--problem'): problem = arg elif opt in ('-v', '--visualize'): visualize = not visualize if problem is None: print HELP_MESSAGE return if not hasattr(generate, problem): print problem, 'is not a valid problem' return env = Environment() try: execute = lambda: save(env, getattr(generate, problem)) if visualize: execute_viewer(env, execute) else: execute() finally: if env.GetViewer() is not None: env.GetViewer().quitmainloop() RaveDestroy()