Add support for local RPLidar on macOS
This commit is contained in:
5
.vscode/launch.json
vendored
5
.vscode/launch.json
vendored
@@ -10,8 +10,9 @@
|
||||
"request": "launch",
|
||||
"module": "car",
|
||||
"env": {
|
||||
"CAR_LIDAR": "LIDAR_MOCK",
|
||||
"CAR_VEHICLE": "CAR_MOCK"
|
||||
"CAR_LIDAR": "LIDAR_RPLIDAR",
|
||||
"CAR_VEHICLE": "CAR_MOCK",
|
||||
"LIDAR_DEVICE": "/dev/tty.usbserial-0001"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -17,7 +17,10 @@ def get_lidar(device=None, connection='/dev/ttyUSB0'):
|
||||
return MockLidar(loader.load_scans_bytes_file("car/src/car/tracking/out.pickle"))
|
||||
elif actual_device == RPLIDAR:
|
||||
try:
|
||||
# TODO: Cleanup connection setting, probably don't need to pass it into the method.
|
||||
from rplidar import RPLidar
|
||||
if "LIDAR_DEVICE" in os.environ:
|
||||
return RPLidar(os.environ['LIDAR_DEVICE'])
|
||||
return RPLidar(connection)
|
||||
except ImportError:
|
||||
print('Could not import RPLidar. Have you downloaded rplidar?')
|
||||
|
||||
Reference in New Issue
Block a user