class GenerateMaps: def __init__(self, size, image_array, position): self._buffer = mp.Queue() self.lidar = Lidar(self._buffer) print(self.lidar.start_lidar()) self.lf = LidarFunktions() self.size = size self.position = position self.shared_line_map_array = image_array def get_line_map(self, color=200, thickness=5): lidar_data = mp.Process(target=self.lidar.get_scan) lidar_data.start() while not self._buffer.empty(): i, data = self._buffer.get() pre_data = self.lf.prepare_data(data, position) line_map = self.lf.draw_line_map( np.zeros(self.size, dtype=np.uint8), pre_data, color, thickness) self.shared_line_map_array[:] = line_map.reshape(-1) print(self.shared_line_map_array[:])
def movement(last_pre_data, pre_data, rotation, size): last_cp = draw_map(last_pre_data, size) cp = draw_map(pre_data, size) cp = rotate(cp, rotation) # Queue lidar_data = Queue() mainMap_img_q = ImageQueue(5, 2) pci_img_q = ImageQueue(3, 2) lidar = Lidar(lidar_data) lf = LidarFunctions() print(lidar.start_lidar()) size = (5000, 5000) position = (size[0] // 2, size[1] // 2) mainMap = np.zeros(size, np.uint8) # mainMapArray = Array() new_scan_event = Event() get_lidar_data = Process(target=lidar.get_scan_v3, args=(new_scan_event, 3)) start_time = time.time() last_line_map = None rotation_counter = 0 last_rotation = 0 new_scan_event.set() try: get_lidar_data.start()