Rework slam streamer for easier testing
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import zmq
|
||||
from breezyslam.algorithms import RMHC_SLAM
|
||||
from breezyslam.sensors import RPLidarA1 as LaserModel
|
||||
from rplidar import RPLidar as Lidar
|
||||
from slam.SlamController_pb2 import SlamScan, SlamLocation
|
||||
import messaging.message_factory as mf
|
||||
import messaging.messages as messages
|
||||
import tracking.devices.factory as lidar_fact
|
||||
|
||||
|
||||
# Left here as was used in the example, configure as necessary.
|
||||
@@ -40,8 +40,8 @@ class SlamStreamer:
|
||||
|
||||
# Adapted from BreezySLAM rpslam example.
|
||||
# Connect to Lidar unit. For some reason it likes to be done twice, otherwise it errors out...
|
||||
lidar = Lidar(self._lidar_connection)
|
||||
lidar = Lidar(self._lidar_connection)
|
||||
lidar = lidar_fact.get_lidar(self._lidar_connection)
|
||||
lidar = lidar_fact.get_lidar(self._lidar_connection)
|
||||
|
||||
print('Initialised lidar')
|
||||
|
||||
|
||||
10
tracking/devices/factory.py
Normal file
10
tracking/devices/factory.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from tracking.devices.mock_lidar import MockLidar
|
||||
from rplidar import RPLidar
|
||||
import tracking.lidar_loader as loader
|
||||
|
||||
|
||||
def get_lidar(connection: str):
|
||||
if connection == 'TEST':
|
||||
return MockLidar(loader.load_scans_bytes_file("tracking/out.pickle"))
|
||||
else:
|
||||
return RPLidar(connection)
|
||||
Reference in New Issue
Block a user