This repo integrates slamtec rplidar LIDARS to be configured as a camera with Viam's RDK.
It has been tested on the following rplidars:
Note
Before configuring your camera, you must create a robot.
Navigate to the Config tab of your robot’s page in the Viam app. Click on the Components subtab and click Create component. Select the camera type, then select the lidar:rplidar model. Enter a name for your camera and click Create.
Note
For more information, see Configure a Robot.
To save your changes, click Save config at the bottom of the page. Check the Logs tab of your robot in the Viam app to make sure your RPlidar has connected and no errors are being raised.
To use this module, follow these instructions to add a module from the Viam Registry and select the viam:lidar:rplidar model from the rplidar module.
The rplidar module is distributed as an AppImage.
AppImages require FUSE version 2 to run.
See FUSE troubleshooting for instructions on installing FUSE 2 on your system if it is not already installed.
Currently, the rplidar module supports the Linux platform only.
To configure a rplidar, you must set the serial path. To find your serial device path, first connect the serial device to your machine:
- On Linux, run
ls /dev/serial/by-path/to show connected serial devices, or look for your device in the output ofsudo dmesg | grep tty. Example:"/dev/serial/by-path/usb-0:1.1:1.0". - On macOS, run
ls /dev/tty* | grep -i usbto show connected USB serial devices,ls /dev/tty*to browse all devices, or look for your device in the output ofsudo dmesg | grep tty. Example:"/dev/ttyS0".
{
"serial_path": "<your-port>"
}The following attributes are available for viam:lidar:rplidar camera:
| Attribute | Type | Required? | Description |
|---|---|---|---|
serial_path |
string | Optional | The full filesystem path to the serial device, starting with /dev/. If no path is provided, the driver will attempt to configure automatically. |
The rplidar module is distributed as an AppImage.
AppImages require FUSE version 2 to run.
See FUSE troubleshooting for instructions on installing FUSE 2 on your system if it is not already installed.
If you don't want to load the model from the registry, for example because you are actively changing its functionality, you can install it locally. Follow these instructions to configure a local module on your machine.
- Install the rplidar module:
- OSx:
brew tap viamrobotics/brews && brew install rplidar-module - Linux AArch64 (ARM64) (e.g., on an RPI):
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
- Linux x86_64:
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
- OSx:
- Run the RDK web server using one of the example config files module/sample_osx_m1.json, module/sample_osx_x86.json or module/sample_linux.json, depending on your operating system and processor.
Install the following list of dependencies:
- Golang
make,swig,jpeg,pkg-config:- MacOS:
brew install make swig pkg-config jpeg - Linux:
apt update && apt install -y make swig libjpeg-dev pkg-config
- MacOS:
- Build the module:
make build-module - Run the RDK web server using one of the example config files:
- MacOS: modules/sample_osx.json
- Linux: modules/sample_linux.json
make lintIf desired, Viam's canon tool can be used to create a docker container to build arm64 or amd64 binaries of the SLAM server. The canon tool can be installed by running the following command:
go install github.com/viamrobotics/canon@latestAnd then by running one of the following commands in the rplidar repository to create the container:
canon -arch arm64canon -arch amd64These containers are set to persist between sessions via the persistent parameter in the .canon.yaml file located in the root of rplidar. More details regarding the use of Viam's canon tool can be found here.