path = [] path_name = gui.get_field(5) gp = importlib.import_module(path_name) # for steer_eta in [FT(0.1), FT(0.2), FT(0.3), FT(0.4), FT(0.5), FT(0.6), FT(0.7), FT(0.8), FT(0.9), FT(1.0), FT(1.1), FT(1.2), FT(1.3), FT(1.4), FT(1.5)]: # for i in range(10): gp.generate_path(path, ps.robots, ps.obstacles, ps.destinations) # print("Generated path via", path_name + ".generate_path") if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) gui = GUI() ps = Polygons_scene() gui.set_program_name("Multi-robot Motion Planning") gui.set_field(0, "data/scenes/scene3_very_hard_multi") # gui.set_field(0, "data/scenes/warehouse0") gui.set_field(3, "srm_drrt") gui.set_field(4, "path0.txt") gui.set_field(5, "run_tests") #gui.set_field(5, "path_out.txt") gui.set_logic(0, set_up_scene) gui.set_button_text(0, "Load scene") gui.set_logic(1, run_and_animate) gui.set_button_text(1, "run_and_animate") gui.set_logic(2, set_destinations) gui.set_button_text(2, "Set destinations") gui.set_logic(3, generate_path) gui.set_button_text(3, "Generate path") gui.set_logic(4, load_path) gui.set_button_text(4, "Load path")
s = gui.get_field(2).split(" ") destination = (int(s[0]), int(s[1])) ps.set_destination(destination) def animate_path(): gui.play_queue() if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) gui = GUI() ps = Polygons_scene() gui.set_program_name("Polygon Scene Motion Planning") gui.set_field(0, "scene_hole_error.txt") gui.set_field(1, "output_scene0.txt") gui.set_field(3, "ex23") gui.set_field(4, "path0.txt") gui.set_field(5, "path_out.txt") gui.set_logic(0, set_up_scene) gui.set_button_text(0, "Load scene") gui.set_logic(1, save_scene) gui.set_button_text(1, "Save scene") gui.set_logic(2, set_destination) gui.set_button_text(2, "Set destination") gui.set_logic(3, generate_path) gui.set_button_text(3, "Generate path") gui.set_logic(4, load_path) gui.set_button_text(4, "Load path") gui.set_logic(5, save_path)
gp = importlib.import_module(path_name) # for steer_eta in [FT(0.1), FT(0.2), FT(0.3), FT(0.4), FT(0.5), FT(0.6), FT(0.7), FT(0.8), FT(0.9), FT(1.0), FT(1.1), FT(1.2), FT(1.3), FT(1.4), FT(1.5)]: # for i in range(10): gp.generate_path(path, ps.robots, ps.obstacles, ps.destinations) # print("Generated path via", path_name + ".generate_path") def unused(): return if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) gui = GUI() ps = Polygons_scene() gui.set_program_name("Multi-robot Motion Planning") gui.set_field(0, "scenes/optimal_length_1") # gui.set_field(0, "data/scenes/warehouse0") gui.set_field(3, "run_all") gui.set_field(4, "path0.txt") gui.set_field(5, "run_tests") #gui.set_field(5, "path_out.txt") gui.set_logic(0, set_up_scene) gui.set_button_text(0, "Load scene") gui.set_logic(1, run_and_animate) gui.set_button_text(1, "run_and_animate") gui.set_logic(2, unused) gui.set_button_text(2, "unused") gui.set_logic(3, generate_path) gui.set_button_text(3, "Generate path") gui.set_logic(4, load_path) gui.set_button_text(4, "Load path")
def set_solution_field(): s = getfile() if s: gui.set_field(1, s) if __name__ == "__main__": instance = "" solution = "" if len(sys.argv) > 1: instance = sys.argv[1] if len(sys.argv) > 2: solution = sys.argv[2] app = QtWidgets.QApplication(sys.argv) gui = GUI() gui.set_program_name("CMP simulation") gui.set_logic(0, set_up_scene) gui.set_logic(1, run_simulation) gui.set_logic(2, set_scene_field) gui.set_logic(3, set_solution_field) gui.set_button_text(0, "Initialize") gui.set_button_text(1, "Run") gui.set_button_text(2, "...") gui.set_button_text(3, "...") gui.set_field(0, instance) gui.set_field(1, solution) gui.set_label(0, "Input file:") gui.set_label(1, "Solution file:") gui.set_animation_finished_action(lambda: None) gui.MainWindow.show() sys.exit(app.exec_())
ps.set_up_animation() gui.set_logic(n, update_button) gui.set_button_text(n, key) gui.turn_button_on(n, value) options[key] = float(value) if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) gui = GUI() OPTIONS = {} ps = Polygons_scene() gui.set_program_name("Kinodynamics- Dor Israeli") gui.set_button_text(0, "Load scene") gui.set_field(0, "scene0") gui.set_logic(0, set_up_scene) gui.set_button_text(1, "Generate path") gui.set_field(1, "rrt") gui.set_logic(1, generate_path) ez_option_text(OPTIONS, gui, 2, "K", 1000) ez_option_text(OPTIONS, gui, 3, "dt", 1) ez_option_text(OPTIONS, gui, 4, "g", -0.1) ez_option_text(OPTIONS, gui, 5, "epsilon", 1) ez_option_text(OPTIONS, gui, 6, "thrust", 1) ez_option_text(OPTIONS, gui, 7, "mass", 1) ez_option_button(OPTIONS, gui, 8, "re/draw", True) ez_option_button(OPTIONS, gui, 9, "two-sided", True) gui.MainWindow.show() sys.exit(app.exec_())
]) gp.play_turn(params) ps.process_turn() def animate_moves(): gui.play_queue() if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) gui = GUI() ps = Polygons_scene() gui.set_program_name("Multi-robot Motion Planning Game") gui.set_field(0, "scene0.txt") gui.set_field(1, "red") gui.set_field(2, "blue") gui.set_logic(0, set_up_scene) gui.set_button_text(0, "Load scene") gui.set_logic(1, play_turn) gui.set_button_text(1, "Play turn") #gui.set_logic(2, load_path) gui.set_button_text(2, "Unused") gui.set_logic(3, animate_moves) gui.set_button_text(3, "Animate moves") #gui.set_logic(4, is_path_valid) gui.set_button_text(4, "Unused") gui.set_button_text(5, "Unused") gui.set_button_text(6, "Unused") gui.set_button_text(7, "Unused")
import sys if len(sys.argv) >= 4: scene_file = sys.argv[1] red_file = sys.argv[2] blue_file = sys.argv[3] if len(sys.argv) >= 5: autoplay = True t0 = None t = None timer = QTimer() game_over = False app = QtWidgets.QApplication(sys.argv) gui = GUI() scene = Scene(gui) gui.set_program_name("Multi-robot Motion Planning Game") gui.set_field(0, scene_file) gui.set_field(1, red_file) gui.set_field(2, blue_file) gui.set_logic(0, set_up_scene) gui.set_logic(3, set_scene_file) gui.set_logic(4, set_red_file) gui.set_logic(5, set_blue_file) gui.set_button_text(0, "Load scene") gui.set_button_text(1, "Unavailable") gui.set_button_text(2, "Unavailable") gui.set_button_text(3, "...") gui.set_button_text(4, "...") gui.set_button_text(5, "...") gui.set_label(0, "Turn: -") gui.set_label(1, "Red team score: 0") gui.set_label(2, "Blue team score: 0")
def set_destination(): destination = gui.get_field(2).split(" ") ps.set_destination(destination) def animate_path(): gui.play_queue() if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) gui = GUI() ps = Polygons_scene() gui.set_program_name("Polygon Scene Motion Planning") gui.set_field(0, "scene0_new.txt") # gui.set_field(1, "output_scene0.txt") gui.set_field(3, "ex32") gui.set_field(4, "path0.txt") gui.set_field(5, "path_out.txt") gui.set_logic(0, set_up_scene) gui.set_button_text(0, "Load scene") # gui.set_logic(1, save_scene) gui.set_button_text(1, "Unused") gui.set_logic(2, set_destination) gui.set_button_text(2, "Set destination") gui.set_logic(3, generate_path) gui.set_button_text(3, "Generate path") gui.set_logic(4, load_path) gui.set_button_text(4, "Load path") gui.set_logic(5, save_path)