Tidy up some lidar stuff for testing and clarity.

This commit is contained in:
Piv
2020-03-09 23:02:19 +10:30
parent ef83365fd8
commit 50d8923ad0
5 changed files with 85 additions and 28 deletions

View File

@@ -3,12 +3,13 @@ from tracking.lidar_tracker_pb2_grpc import PersonTrackingServicer
from tracking.lidar_cache import LidarCache
from multiprocessing import Process
import Messaging.message_factory as mf
from rplidar import RPLidar
class LidarServicer(PersonTrackingServicer):
def __init__(self):
self.cache = LidarCache(measurements=100)
#TODO: Put the rplidar creation in a factory or something, to make it possible to test this servicer.
self.cache = LidarCache(RPLidar('/dev/ttyUSB0'), measurements=100)
def set_tracking_group(self, request, context):
pass
@@ -17,7 +18,5 @@ class LidarServicer(PersonTrackingServicer):
self.cache.stop_scanning()
def start_tracking(self, request, context):
'''
Starts the lidar cache.
'''
"""Starts the lidar cache, streaming on the provided port."""
self.cache.start_cache(mf.getZmqPubSubStreamer(request.value))