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",
|
"request": "launch",
|
||||||
"module": "car",
|
"module": "car",
|
||||||
"env": {
|
"env": {
|
||||||
"CAR_LIDAR": "LIDAR_MOCK",
|
"CAR_LIDAR": "LIDAR_RPLIDAR",
|
||||||
"CAR_VEHICLE": "CAR_MOCK"
|
"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"))
|
return MockLidar(loader.load_scans_bytes_file("car/src/car/tracking/out.pickle"))
|
||||||
elif actual_device == RPLIDAR:
|
elif actual_device == RPLIDAR:
|
||||||
try:
|
try:
|
||||||
|
# TODO: Cleanup connection setting, probably don't need to pass it into the method.
|
||||||
from rplidar import RPLidar
|
from rplidar import RPLidar
|
||||||
|
if "LIDAR_DEVICE" in os.environ:
|
||||||
|
return RPLidar(os.environ['LIDAR_DEVICE'])
|
||||||
return RPLidar(connection)
|
return RPLidar(connection)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print('Could not import RPLidar. Have you downloaded rplidar?')
|
print('Could not import RPLidar. Have you downloaded rplidar?')
|
||||||
|
|||||||
Reference in New Issue
Block a user