Tidy up lidar classes

This commit is contained in:
Piv
2020-03-05 20:18:41 +10:30
parent c52237cae4
commit e3f2cbd307
2 changed files with 1 additions and 8 deletions

View File

@@ -59,6 +59,3 @@ class LidarCache():
def stop_scanning(self): def stop_scanning(self):
self.run = False self.run = False
def _create_socket(self):
return zmq.Context.instance().socket(zmq.PUB)

View File

@@ -5,7 +5,6 @@ from multiprocessing import Process
class LidarServicer(PersonTrackingServicer): class LidarServicer(PersonTrackingServicer):
lidar_thread = None
def __init__(self): def __init__(self):
self.cache = LidarCache(measurements=100) self.cache = LidarCache(measurements=100)
@@ -15,12 +14,9 @@ class LidarServicer(PersonTrackingServicer):
def stop_tracking(self, request, context): def stop_tracking(self, request, context):
self.cache.stop_scanning() self.cache.stop_scanning()
self.lidar_thread.join()
self.lidar_thread = None
def start_tracking(self, request, context): def start_tracking(self, request, context):
''' '''
Starts the lidar cache. Starts the lidar cache.
''' '''
if self.lidar_thread is None: self.cache.start_cache()
self.lidar_thread = Process(target=self.cache.do_scanning)