Tidy up lidar classes
This commit is contained in:
@@ -59,6 +59,3 @@ class LidarCache():
|
||||
|
||||
def stop_scanning(self):
|
||||
self.run = False
|
||||
|
||||
def _create_socket(self):
|
||||
return zmq.Context.instance().socket(zmq.PUB)
|
||||
|
||||
@@ -5,7 +5,6 @@ from multiprocessing import Process
|
||||
|
||||
|
||||
class LidarServicer(PersonTrackingServicer):
|
||||
lidar_thread = None
|
||||
|
||||
def __init__(self):
|
||||
self.cache = LidarCache(measurements=100)
|
||||
@@ -15,12 +14,9 @@ class LidarServicer(PersonTrackingServicer):
|
||||
|
||||
def stop_tracking(self, request, context):
|
||||
self.cache.stop_scanning()
|
||||
self.lidar_thread.join()
|
||||
self.lidar_thread = None
|
||||
|
||||
def start_tracking(self, request, context):
|
||||
'''
|
||||
Starts the lidar cache.
|
||||
'''
|
||||
if self.lidar_thread is None:
|
||||
self.lidar_thread = Process(target=self.cache.do_scanning)
|
||||
self.cache.start_cache()
|
||||
|
||||
Reference in New Issue
Block a user