Add a Rplidar as a Modular Component

First, install the Rplidar Module:

sudo curl -o /usr/local/bin/rplidar-module http://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 http://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

Now, add the Rplidar as a modular component of your robot in the Viam app:

  1. Physically connect the Rplidar to your machine.
  2. Go to your robot’s page on the Viam app.
  3. In the CONFIG tab, select Raw JSON mode.
  4. Copy the following configuration code for your Rplidar device. Paste it into the Raw JSON block:
{
  "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": "/usr/local/bin/rplidar-module",
      "name": "rplidar_module"
    }
  ]
}
  1. Save the config.

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