-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.py
46 lines (43 loc) · 1.39 KB
/
util.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
"""
retorna dicionarios com coordenadas das consultas no mapa de caminho filepath
/usr/local/Aria/maps/office.map no osboxes
"""
def get_map_min_pos(filepath):
file = open(filepath)
read = file.readline()
while 'LineMinPos' not in read:
read = file.readline()
if not read: # evita um loop inf se mapa nao tiver informacao de posicao min
return None
read = read.split()
try:
min_pos = {'x': float(read[1]), 'y': float(read[2])}
return min_pos
except Exception as e:
print e
def get_robot_home(filepath):
file = open(filepath)
read = file.readline()
while 'RobotHome' not in read:
read = file.readline()
if not read: # evita um loop inf se mapa nao tiver informacao de robot home
return None
read = read.split()
try:
robot_home = {'x': float(read[2]), 'y': float(read[3]), 't': float(read[4])}
return robot_home
except Exception as e:
print e
def get_map_max_pos(filepath):
file = open(filepath)
read = file.readline()
while 'LineMaxPos' not in read:
read = file.readline()
if not read: # evita um loop inf se mapa nao tiver informacao de posicao min
return None
read = read.split()
try:
max_pos = {'x': float(read[1]), 'y': float(read[2])}
return max_pos
except Exception as e:
print e