wu_xinjun
2022-06-27 1292adc7aafa34a7c93c80390826bdc5b6d05cbf
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
import queue
from typing import Union
import threading
 
from .MessageThreads import send_logs_tool
from ..microwave.servers import MicroWaveUDPThread,UDP2PointcloudThread
 
 
class micorwaveMannager(object):
 
    def __init__(self,
            MicrowaveHost:str,
            MicrowavePort:int,
            ):
 
        # microwave
        self.MicrowaveHost = MicrowaveHost
        self.MicrowavePort = MicrowavePort
        # udp get
        self._udp_get_thread = None
        # self.packet_threshold = packet_threshold
        # self.timeusage_threshold = timeusage_threshold
        self.udp_queue = queue.Queue()
        self.udp_get_stop = threading.Event()
        self._udp_get_thread_name = "Thread-UDPGet"
        # udp to pointcloud
        self._udp2pointcloud_thread = None
        self.pointcloud_queue = queue.Queue()
        self._udp2pointcloud_thread_name = "Thread-UDP2PointCloud"
        
 
    def _udp_get_thread_launcher(self,
                    packet_threshold:Union[int, None],
                    timeusage_threshold:Union[int, None]):
        self.udp_get_stop.clear()
        self._udp_get_thread = MicroWaveUDPThread(MicrowaveHost=self.MicrowaveHost,
                            MicrowavePort=self.MicrowavePort,
                            udp_queue=self.udp_queue,
                            udp_get_stop=self.udp_get_stop,
                            packet_threshold=packet_threshold,
                            timeusage_threshold=timeusage_threshold)
        self._udp_get_thread.setDaemon(True)
        self._udp_get_thread.setName(self._udp_get_thread_name)
        self._udp_get_thread.start()
 
 
    def _udp2pointcloud_thread_launcher(self):
        self._udp2pointcloud_thread = UDP2PointcloudThread(
                                        udp_queue = self.udp_queue,
                                        pointcloud_queue=self.pointcloud_queue
                                        )
        self._udp2pointcloud_thread.setDaemon(True)
        self._udp2pointcloud_thread.setName(self._udp2pointcloud_thread_name)
        self._udp2pointcloud_thread.start()