diff --git a/generators/dataset/GenerateTestingDataset.py b/generators/dataset/GenerateTestingDataset.py index 93c4c1dec..628820b2f 100644 --- a/generators/dataset/GenerateTestingDataset.py +++ b/generators/dataset/GenerateTestingDataset.py @@ -202,12 +202,27 @@ def generate_problem_scenarios(self): self.problems = np.arange(0, self.nRobots, 1).astype(int) np.random.shuffle(self.problems) + def get_or_create_dir(self, debugMaps=False): + directory = os.path.join(self.root_dir, "generated/testingData/") + if debugMaps: + directory = os.path.join(directory, "debugMaps") + + try: + os.makedirs(directory) + except OSError as exc: + if exc.errno ==errno.EEXIST and os.path.isdir(directory): + pass + else: + raise "Could not create directory {}".format(directory) + + return directory + def save_dataset_to_file(self, file_path=None): print("\nSaving dataset to a file...") if file_path is None: - file_path = self.root_dir + "/generated/testingData/" + self.map_name +\ - "-" + str(self.problems.shape[0]) + "Problems.txt" + filename = self.map_name + "-" + str(self.problems.shape[0]) + "Problems.txt" + file_path = os.path.join(self.get_or_create_dir(), filename) height = self.img_height * self.resolution @@ -321,8 +336,9 @@ def save_debug_map(self, file_path=None, plot_problems=True, plot_ellipses=True) self.source_mean, self.sigma_interval, col='b')) if file_path is None: - file_path = self.root_dir + "/generated/testingData/debugMaps/" + self.map_name +\ - "-" + str(self.nRobots) + "Problems.svg" + filename = self.map_name + "-" + str(self.nRobots) + "Problems.svg" + file_path = os.path.join(self.get_or_create_dir(debugMaps=True), filename) + plt.savefig(file_path, format='svg') print("Saved debug map at", file_path) diff --git a/launchTests.py b/launchTests.py index 3fd88b524..4a018e90b 100644 --- a/launchTests.py +++ b/launchTests.py @@ -101,13 +101,19 @@ def main(): parser.add_argument("--nIterations", type=int, help="Number to test iterations to run. Default: 2", default=2) parser.add_argument("--timeout", type=int, help="Maximum time allowed for each test in seconds. Default: 300", default=300) parser.add_argument("--sleep", type=int, help="Maximum time to pause between iterations in seconds. Default: 10", default=10) + parser.add_argument("--offline", type=bool, help="Indicate if gradle should try to use the existing snapshots", default=False) args = parser.parse_args() initialize_test(args) - run_test_cmd = ["./gradlew", "run", "--offline","-Pdemo=customTests.CustomTesting", "-PnRobots="+str(args.nRobots), - "-Pplanner="+str(args.planner), "-Pmap="+args.map, "-Pconstrained="+str(int(args.constrained)), - "-Pno_hotspots="+str(int(args.no_hotspots)), "-Pexp="+str(args.nExperiences)] + if args.offline: + run_test_cmd = ["./gradlew", "run", "--offline","-Pdemo=customTests.CustomTesting", "-PnRobots="+str(args.nRobots), + "-Pplanner="+str(args.planner), "-Pmap="+args.map, "-Pconstrained="+str(int(args.constrained)), + "-Pno_hotspots="+str(int(args.no_hotspots)), "-Pexp="+str(args.nExperiences)] + else: + run_test_cmd = ["./gradlew", "run","-Pdemo=customTests.CustomTesting", "-PnRobots="+str(args.nRobots), + "-Pplanner="+str(args.planner), "-Pmap="+args.map, "-Pconstrained="+str(int(args.constrained)), + "-Pno_hotspots="+str(int(args.no_hotspots)), "-Pexp="+str(args.nExperiences)] bool_strings = ["False", "True"] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..a71d2dd45 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +numpy +matplotlib +pandas +networkx +seaborn \ No newline at end of file