create instance
a string name or file-path to the serial driver
{minQuality: 5, debug: false}
serial port baudrate setting
flag to enable/disable display of debug info
path to serial port driver, e.g., com3, /dev/ttyusb0
buffers 360 degrees of scanSample data when sampleDeliveryMode == ONE_REV
determines how scan data is buffered and delivered to the driver client
used in parsing scan data packets
serial port commo interface
Asynchronously access device health information.
Promise
Asynchronously access device information.
Promise
Low level GET_LIDAR_CONF request
Return the average rotations per minute of the scan head. RPM can only be calculated when the device is actively scanning.
rpm
Asynchronously access device sample rates for each supported scan mode.
Promise
Asynchronously access RPLidar scan modes. Dynamically load and cache the modes.
Promise<ScanMode[]>
Asynchronously create the serial port and event handlers and connect to RPLidar device.
empty promise
Load scanMode data from the lidar device.
Asynchronously load scanMode information from the lidar device.
the scanMode to load
Promise
Parse a raw byte stream data into objects and dispatch via events to listeners.
the source from which parsed data events will be emitted
raw bytes received from serial port
Asynchronously reboot the device.
Promise
Asynchronously perform low level scan operation.
Asynchronously update the S1/A2/A3 device motor speed. Ignore this action if A1 device.
Promise
Asynchronously start the device motor. You can visually observe the device scanning head rotating upon completion.
Asynchronously start the device scanning and generating scanSample data.
A ScanSample contains the following data: quality: number // quality of reading based on laser reflected pulse strength angle: number // degree distance: number // millimeters start: boolean // when true indicates start of new 360 degree sampling
The delivered of scanSamples can be configured for continuously delivery, i.e., CONTINUOUS mode, as each scanSample packet is parsed or it can be buffered and delivered as a single array of scanSamples for a single 360 degree range, i.e., ONE_REV mode.
When the sampleScanDeliveryMode is CONTINUOUS, call stopScan() to terminate scan data capture. When the sampleScanDeliveryMode is ONE_REV, scan data capture will terminate automatically upon receipt of a full 360 degree collection of scanSamples.
The motor will be started automatically if it is not already running. Upon completion the motor will continue to run but no further scan data will be generated until the next startScan() call. Use stopMotor() if you wish to stop the lidar's scan head rotation.
UNBUFFERED is the default value When set to UNBUFFERED will emit 'scan' events, each event containing 1 scanSample. When set to BUFFERED will continuously return 360 degree blocks of scanSamples. When set to BUFFERED_ONE_REV buffer will return the next 360 degree block of scanSamples and stop.
filter all scanSamples with quality < minQuality
Promise
Asynchronously stop the device motor. You can visually observe the device scanning head stop rotating upon completion.
Discontinue capture of scanSamples. Not this operation does not stop the motor.
Generated using TypeDoc
rpLidar-driver provides api for controlling and reading data from Slamtec RPLidar A1-A3 and S1 devices via a host computer serial port.
You must call init() before using any other apis.
import { RPLidarDriver, ScanSample} from 'rplidar-driver'; async function run_demo() { const lidar = new RPLidarDriver(); await lidar.init(); console.log('health: ', await lidar.getHealth()); console.log('info: ', await lidar.getInfo()); lidar.on('scan', (scanSample: ScanSample) => console.log(scanSample)); lidar.startScan(); console.log('started scanning'); } run_demo(); ```