FInal fixes to move to message factory

This commit is contained in:
Piv
2020-03-05 19:40:34 +10:30
parent 9878aaf6a4
commit c52237cae4
2 changed files with 5 additions and 4 deletions

View File

@@ -4,6 +4,8 @@ from threading import Thread
from persontracking import algorithms
import persontracking.lidar_tracker_pb2 as tracker_pb
import zmq
import Messaging.message_factory as mf
import Messaging.messages as messages
class LidarCache():
@@ -36,8 +38,7 @@ class LidarCache():
Performs a scan for the given number of iterations.
'''
# Create the 0MQ socket first. This should not be passed between threads.
self._socket = self._create_socket()
self._socket.bind("tcp://*:" + str(self.port))
self._mFactory = mf.getZmqPubSubStreamer(self.port)
for i, scan in enumerate(self.lidar.iter_scans(min_len=self.measurements)):
print('%d: Got %d measurments' % (i, len(scan)))
@@ -53,7 +54,8 @@ class LidarCache():
def fireGroupsChanged(self):
# Send the updated groups to 0MQ socket.
self._socket.send_multipart(["lidar_map", tracker_pb.PointScan(points=[]).SerializeToString()])
self._mFactory.send_message_topic("lidar_map", messages.ProtoMessage(
message=tracker_pb.PointScan(points=[]).SerializeToString()))
def stop_scanning(self):
self.run = False