Use multiprocessing for slam, add more debug prints

This commit is contained in:
Piv
2020-02-12 22:03:25 +10:30
parent 3a9906f7da
commit 65d5e94c0d
2 changed files with 7 additions and 4 deletions

View File

@@ -32,6 +32,7 @@ class SlamStreamer:
calling this method will have no effect.
'''
print('Starting to stream')
self._socket = self._start_socket(self._create_socket(self._zmq_context), self._port)
# Block until user opens zmq.
@@ -60,10 +61,10 @@ class SlamStreamer:
# Extract distances and angles from triples
distances = [item[2] for item in items]
angles = [item[1] for item in items]
print('Updating map')
# Update SLAM with current Lidar scan and scan angles
slam.update(distances, scan_angles_degrees=angles)
print('Map updated')
self._push_map(slam.getmap(mapbytes), slam.getpos())
def _push_map(self, mapbytes, location):
@@ -74,6 +75,7 @@ class SlamStreamer:
'''
protoScan = SlamScan(map = bytes(mapbytes), \
location = SlamLocation(x = location[0], y = location[1], theta = location[3]))
print('Sending map')
self._socket.send(protoScan.SerializeToString())
def stop_scanning(self):