-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobalGroundTruth.py
61 lines (43 loc) · 1.92 KB
/
globalGroundTruth.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
'''
Created on Aug 18, 2015
@author: ldhuy
'''
class globalGroundTruth(object):
'''
ground truth for robots
'''
maze = None
visited = None
@staticmethod
def setMaze(_maze):
globalGroundTruth.maze = _maze
@staticmethod
def setupVisited(nRegion):
globalGroundTruth.visited = [[[[0 for i in range(globalGroundTruth.maze.size/nRegion)] for j in range(globalGroundTruth.maze.size/nRegion)] for iReg in range(nRegion)] for jReg in range(nRegion)]
regSize = globalGroundTruth.maze.size/nRegion
extra = globalGroundTruth.maze.size % nRegion
# Add extra column
for e in range(extra):
for i in range(nRegion-1):
currentReg = globalGroundTruth.visited[i][-1]
for j in range(regSize):
currentReg[j].append(0)
# Add extra row
for e in range(extra):
for i in range(nRegion-1):
currentReg = globalGroundTruth.visited[-1][i]
currentReg.append([0 for j in range(regSize)])
# Add extra cell for region at the corner
for e in range(extra):
currentReg = globalGroundTruth.visited[-1][-1]
currentReg.append([0 for i in range(regSize+e)])
for j in range(len(currentReg)):
currentReg[j].append(0)
# if extra > 0:
# for i in range(extra):
# for j in range(nRegion):
# globalGroundTruth.visited[j][-1].append([0 for k in range(regSize)])
# regSize =regSize
# for k in range(regSize):
# globalGroundTruth.visited[-1][j].append([0 for k in range(regSize)])
# globalGroundTruth.visited[-1][-1][-1].append(1)