-
Notifications
You must be signed in to change notification settings - Fork 0
/
getData.py
116 lines (115 loc) · 5.71 KB
/
getData.py
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import numpy as np
import os
from wheeledSim.parallelSimDataset import gatherData
if __name__ == '__main__':
runSystem1 = True
runSystem2 = True
# parameters for parallel processing
numParallelSims = 12
trajectoryLength = 64
numTrajectoriesPerSim = np.ceil(500000/numParallelSims/trajectoryLength)
# parameters consistent between systems
simParams = {"timeStep":1./500.,
"stepsPerControlLoop":50,
"numSolverIterations":300,
"gravity":-10,
"contactBreakingThreshold":0.0001,
"contactSlop":0.0001,
"moveThreshold":0.1,
"maxStopMoveLength":25}
terrainMapParams = {"mapWidth":300, # width of matrix
"mapHeight":300, # height of matrix
"widthScale":0.1, # each pixel corresponds to this distance
"heightScale":0.1}
senseParams = {"senseDim":[5,5], # width (meter or angle) and height (meter or angle) of terrain map or point cloud
"senseResolution":[64,64], # array giving resolution of map output (num pixels wide x num pixels high)
"senseType":-1, # 0 for terrainMap, 1 for lidar depth image, 2 for lidar point cloud
"sensorPose":[[0,0,0],[0,0,0,1]]} # pose of sensor relative to body
dataRootDir = 'data/'
if not os.path.isdir(dataRootDir):
os.mkdir(dataRootDir)
if runSystem1:
# parameters for expert and novice
expertRobotParams = {"maxThrottle":60,
"maxSteerAngle":0.8,
"susOffset":-0.002,
"susLowerLimit":-0.02,
"susUpperLimit":0.00,
"susDamping":50,
"susSpring":10000,
"traction":1,
"massScale":1.5}
noviceRobotParams = {"maxThrottle":30,
"maxSteerAngle":0.5,
"susOffset":-0.001,
"susLowerLimit":-0.02,
"susUpperLimit":0.00,
"susDamping":100,
"susSpring":50000,
"traction":1.25,
"masScale":1.0}
terrainParams = {"AverageAreaPerCell":1,
"cellPerlinScale":5,
"cellHeightScale":0.35,
"smoothing":0.7,
"perlinScale":2.5,
"perlinHeightScale":0.1}
experimentRootDir = dataRootDir + 'system1/'
if not os.path.isdir(experimentRootDir):
os.mkdir(experimentRootDir)
noviceRootDir = experimentRootDir+'novice/'
if not os.path.isdir(noviceRootDir):
os.mkdir(noviceRootDir)
np.save(noviceRootDir+'allSimParams.npy',[simParams,noviceRobotParams,terrainMapParams,terrainParams,senseParams])
print('System 1 novice parameters set at: ' + noviceRootDir)
expertRootDir = experimentRootDir+'expert/'
if not os.path.isdir(expertRootDir):
os.mkdir(expertRootDir)
np.save(expertRootDir+'allSimParams.npy',[simParams,expertRobotParams,terrainMapParams,terrainParams,senseParams])
# gather data for novice
gatherData(numParallelSims,numTrajectoriesPerSim,trajectoryLength,noviceRootDir,True)
# gather data for expert
gatherData(numParallelSims,numTrajectoriesPerSim,trajectoryLength,expertRootDir,True)
if runSystem2:
# parameters for expert and novice
noviceRobotParams = {"maxThrottle":30,
"maxSteerAngle":0.5,
"susOffset":-0.0,
"susLowerLimit":-0.01,
"susUpperLimit":0.003,
"susDamping":100,
"susSpring":50000,
"traction":1.0,
"massScale":1}
expertRobotParams = {"maxThrottle":40,
"maxSteerAngle":0.75,
"susOffset":-0.002,
"susLowerLimit":-0.02,
"susUpperLimit":0.00,
"susDamping":1,
"susSpring":75,
"traction":1.25,
"massScale":1.5}
terrainParams = {"AverageAreaPerCell":1,
"cellPerlinScale":5,
"cellHeightScale":0.9,
"smoothing":0.7,
"perlinScale":2.5,
"perlinHeightScale":0.1}
experimentRootDir = dataRootDir + 'system2/'
if not os.path.isdir(experimentRootDir):
os.mkdir(experimentRootDir)
noviceRootDir = experimentRootDir+'novice/'
if not os.path.isdir(noviceRootDir):
os.mkdir(noviceRootDir)
np.save(noviceRootDir+'allSimParams.npy',[simParams,noviceRobotParams,terrainMapParams,terrainParams,senseParams])
print('System 1 novice parameters set at: ' + noviceRootDir)
expertRootDir = experimentRootDir+'expert/'
if not os.path.isdir(expertRootDir):
os.mkdir(expertRootDir)
np.save(expertRootDir+'allSimParams.npy',[simParams,expertRobotParams,terrainMapParams,terrainParams,senseParams])
print('System 2 expert parameters set at: ' + expertRootDir)
# gather data for novice
gatherData(numParallelSims,numTrajectoriesPerSim,trajectoryLength,noviceRootDir,True)
# gather data for expert
gatherData(numParallelSims,numTrajectoriesPerSim,trajectoryLength,expertRootDir,True)