添加map接口

This commit is contained in:
liwang zhang 2023-11-17 09:57:58 +08:00
parent 0da334d8b4
commit 956203300b
1 changed files with 19 additions and 7 deletions

View File

@ -1,3 +1,4 @@
import pickle
import sys import sys
import time import time
import grpc import grpc
@ -110,6 +111,9 @@ class Scene:
self.all_frontier_list = set() self.all_frontier_list = set()
self.semantic_map = semantic_map self.semantic_map = semantic_map
self.auto_map = np.ones((800, 1550)) self.auto_map = np.ones((800, 1550))
self.filename = "../proto/map_1.pkl"
with open(self.filename, 'rb') as file:
self.map_file = pickle.load(file)
def reset(self): def reset(self):
@ -700,3 +704,11 @@ class Scene:
ginger_x, ginger_y, ginger_z = [int(scene.location.X), int(scene.location.Y),100] ginger_x, ginger_y, ginger_z = [int(scene.location.X), int(scene.location.Y),100]
return math.sqrt((ginger_x - objx) ** 2 + (ginger_y - objy) ** 2 + (ginger_z - objz) ** 2) return math.sqrt((ginger_x - objx) ** 2 + (ginger_y - objy) ** 2 + (ginger_z - objz) ** 2)
# 根据map文件判断是否可达
def reachable(self, pos):
x, y = self.real2map(pos[0], pos[1])
if self.map_file[x, y] == 0:
return True
else:
return False