-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
80 lines (55 loc) · 2.4 KB
/
Copy pathmain.py
File metadata and controls
80 lines (55 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import OS_Calls
import bug.BugRobot as BugRobot
import bug.Workspace as Workspace
import kinematics.Manipulator as Manipulator
import os.path
def main():
shouldSavePlots = True
basePlotDir = 'figures'
OS_Calls.clear_screen()
simType = 'bug'
simRunner(shouldSavePlots, basePlotDir, simType)
simType = 'manipulator'
simRunner(shouldSavePlots, basePlotDir, simType)
def simRunner(shouldSavePlots, basePlotDir, simType):
(configNames, configFileNames) = getConfigPaths(simType)
for (file, configName) in zip(configFileNames, configNames):
print('===============================')
print(configName)
print('===============================')
baseSaveFName = os.path.join(basePlotDir, configName)
if simType == 'bug':
runBugAlgorithmComparison(file, shouldSavePlots,
baseSaveFName)
elif simType == 'manipulator':
runManipulatorComparison(file, shouldSavePlots,
baseSaveFName)
def runBugAlgorithmComparison(configFileName, shouldSavePlots, baseSaveFName):
currWorkspace = Workspace.Workspace(configFileName=configFileName,
shouldSavePlots=shouldSavePlots,
baseSaveFName=baseSaveFName)
algStr = 'bug1'
BugRobot.runRobot(configFileName=configFileName,
currWorkspace=currWorkspace,
algorithmStr=algStr)
algStr = 'bug2'
BugRobot.runRobot(configFileName=configFileName,
currWorkspace=currWorkspace,
algorithmStr=algStr)
def runManipulatorComparison(configFileName, shouldSavePlots, baseSaveFName):
Manipulator.runManipulator(configFileName=configFileName,
shouldSavePlots=shouldSavePlots,
baseSaveFName=baseSaveFName)
def getConfigPaths(simType):
if simType == 'bug':
configNames = ['scenario1', 'scenario2']
elif simType == 'manipulator':
configNames = ['scenario1']
fullConfigNames = list(map(lambda x: simType + '_' + x, configNames))
configDir = 'config'
fType = '.yaml'
configFileNames = [os.path.join(configDir, fName) + fType
for fName in fullConfigNames]
return (fullConfigNames, configFileNames)
if __name__ == '__main__':
main()