| | |
| | | import open3d as o3d |
| | | from multiprocessing import Pool |
| | | import numpy as np |
| | | import threading |
| | | |
| | | from ..utils import file_fliter, write_ply |
| | | from ..utils.tools import file_fliter, write_ply |
| | | from .servers import MicroWaveReceiver,MicroWaveUDPThread |
| | | from .parsers import MicroWaveParser |
| | | |
| | |
| | | # host = '192.168.2.65' # use this host to get the udp data from microwave device |
| | | port = 9911 |
| | | udp_queue = queue.Queue() |
| | | udp_get_stop = {"value": False} |
| | | udp_get_stop = threading.Event() |
| | | |
| | | if subFolder is not None: |
| | | path = os.path.join(saveFolder,subFolder) |
| | |
| | | |
| | | while run: |
| | | packed_count = 0 |
| | | while run or not udp_queue.empty(): |
| | | while not udp_queue.empty(): |
| | | value = udp_queue.get() |
| | | while value is not False: |
| | | if value is not False: |
| | | time_tag = datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S') |
| | | with ('{}/{}_packet{}.udp'.format(path,time_tag,packed_count), 'wb') as f: |
| | | f.write(udp_queue.get()) |
| | |
| | | run = False |
| | | |
| | | except KeyboardInterrupt: |
| | | udp_get_stop = {"value": True} |
| | | udp_get_stop.set() |
| | | print(time.asctime(),"Server Stopped") |
| | | except: |
| | | udp_get_stop = {"value": True} |
| | | print(time.asctime(),"Server Stopped") |
| | | udp_get_stop.set() |
| | | print(time.asctime(),"Server Stopped with unknown reasons") |
| | | |
| | | # udp2bin |
| | | def udp2bin_tool(udp_folder_Or_list): |
| | |
| | | else: |
| | | UDPfolder = udp_folder_Or_list |
| | | # example pod1-2022-02-21-13-25-03_packet125.udp --> 125 |
| | | sort_lambda = lambda x:int(x.split('packet')[1][:-4]) |
| | | sort_lambda = lambda x:int(x.split('packet')[-1][:-4]) |
| | | udp_files = file_fliter(UDPfolder,'udp', sort_lambda) |
| | | Save = True |
| | | |