Add an RPlidar as a Modular Component
Requirements
Install the rplidar-module
binary on your machine and make it executable by running the following commands according to your machine’s architecture:
sudo curl -o /usr/local/bin/rplidar-module https://storage.googleapis.com/packages.viam.com/apps/rplidar/rplidar-module-latest-aarch64.AppImage
sudo chmod a+rx /usr/local/bin/rplidar-module
sudo curl -o /usr/local/bin/rplidar-module https://storage.googleapis.com/packages.viam.com/apps/rplidar/rplidar-module-latest-x86_64.AppImage
sudo chmod a+rx /usr/local/bin/rplidar-module
brew tap viamrobotics/brews && brew install rplidar-module
Configuration
Physically connect the RPlidar to your machine. Go to your robot’s page on the Viam app.
Navigate to the Config tab on your robot’s page, and click on the Components subtab.
Add a component with type camera
, model viam:lidar:rplidar
, and a name of your choice:
Paste the following into the Attributes field of your new component according to your machine’s architecture (none needed for Linux):
{
"device_path": "/dev/tty.SLAB_USBtoUART"
}
{
"device_path": "/dev/tty.usbserial-0001"
}
Click on the Modules subtab. Add the rplidar module with a name of your choice and an executable path that points to the location of your installed rplidar-module
binary:
Navigate to the Config tab.
Select the Raw JSON mode, then copy/paste the following "components"
and "modules"
JSON:
{
"modules": [
{
"executable_path": "/usr/local/bin/rplidar-module",
"name": "rplidar-module"
}
],
"components": [
{
"namespace": "rdk",
"type": "camera",
"depends_on": [],
"model": "viam:lidar:rplidar",
"name": "rplidar"
}
]
}
{
"modules": [
{
"executable_path": "/usr/local/bin/rplidar-module",
"name": "rplidar-module"
}
],
"components": [
{
"namespace": "rdk",
"type": "camera",
"depends_on": [],
"model": "viam:lidar:rplidar",
"attributes": {
"device_path": "/dev/tty.SLAB_USBtoUART"
},
"name": "rplidar"
}
]
}
{
"modules": [
{
"executable_path": "/opt/homebrew/bin/rplidar-module",
"name": "rplidar-module"
}
],
"components": [
{
"namespace": "rdk",
"type": "camera",
"depends_on": [],
"model": "viam:lidar:rplidar",
"attributes": {
"device_path": "/dev/tty.usbserial-0001"
},
"name": "rplidar"
}
]
}
Check the Logs tab of your robot in the Viam app to make sure your RPlidar has connected and no errors are being raised.
Troubleshooting
You can find additional assistance in the Troubleshooting section.
You can also ask questions in the Community Discord and we will be happy to help.
Next Steps
Have questions, or want to meet other people working on robots? Join our Community Discord.
Was this page helpful?
Glad to hear it! If there is anything we could be doing better, please create an issue.
We're sorry about that. If you'd like to talk to us for help, please join the Community Discord. To ensure we know what's wrong with this page, you can also open an issue.