Skip to content

Commit

Permalink
Add python requirements file and fix build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Sushant-Chavan committed Nov 12, 2019
1 parent 1c137ab commit ac6ed42
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
24 changes: 20 additions & 4 deletions generators/dataset/GenerateTestingDataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand Down
12 changes: 9 additions & 3 deletions launchTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
numpy
matplotlib
pandas
networkx
seaborn

0 comments on commit ac6ed42

Please sign in to comment.