RpLidar.NET 1.1.0

dotnet add package RpLidar.NET --version 1.1.0
                    
NuGet\Install-Package RpLidar.NET -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RpLidar.NET" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RpLidar.NET" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="RpLidar.NET" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RpLidar.NET --version 1.1.0
                    
#r "nuget: RpLidar.NET, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RpLidar.NET@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RpLidar.NET&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=RpLidar.NET&version=1.1.0
                    
Install as a Cake Tool

RpLidar.NET

A .NET library for interfacing with Slamtec RPLidar A-series LiDAR sensors over a serial connection. Tested with real hardware (A1M8). Targets netstandard2.0 — compatible with .NET 6, 7, 8, and .NET Framework 4.6.1+.


Supported Hardware

Model Scan Mode Max Range
A1M8 Standard / Sensitivity 12 m
A2M8 Standard / Boost / Sensitivity 18 m
A3M1 Standard / Boost / Sensitivity 25 m

Installation

dotnet add package RpLidar.NET

Or via the NuGet Package Manager in Visual Studio: search for RpLidar.NET.


Quick Start

using RpLidar.NET;
using RpLidar.NET.Entities;

// Replace with your actual port:
//   Windows : "COM3"
//   Linux   : "/dev/ttyUSB0"
//   macOS   : "/dev/tty.usbserial-..."
using var lidar = new RPLidar("COM3");

lidar.LidarPointScanEvent += points =>
{
    foreach (var p in points)
        Console.WriteLine($"Angle: {p.Angle:F1}°  Distance: {p.Distance:F0} mm  Quality: {p.Quality}");
};

Console.WriteLine("Scanning — press Enter to stop.");
Console.ReadLine();

The RPLidar constructor connects, starts the motor, and begins scanning immediately. Scan data is delivered via LidarPointScanEvent approximately every 400 ms (configurable).


Scan Modes

Mode Enum Value Protocol Description
Standard ScanMode.Standard Scan (0x20) Basic scan, ~2,000 samples/rev. All A-series.
Boost ScanMode.Boost Express Scan (0x82, mode=3) Higher frequency. A2/A3 only.
Sensitivity ScanMode.Sensitivity Express Scan (0x82, mode=4) Ultra-Capsule; highest density. Default.

Custom Configuration

Use RpLidarSerialDevice directly for full control:

using RpLidar.NET;
using RpLidar.NET.Entities;

var settings = new LidarSettings
{
    Port                = "COM3",
    BaudRate            = 115200,
    ScanMode            = ScanMode.Sensitivity,
    Pwm                 = 660,     // Motor speed: 0 (stop) – 1023 (full)
    MaxDistance         = 25000,   // mm — consumers can filter by this
    ElapsedMilliseconds = 400,     // Scan event fires at most every 400 ms
};

using var device = new RpLidarSerialDevice(settings);
device.LidarPointScanEvent += OnScan;
device.Start();

Console.ReadLine();
device.Stop();

static void OnScan(List<LidarPoint> points)
{
    Console.WriteLine($"{points.Count} points");
}

API Reference

RPLidar — high-level wrapper

Member Description
RPLidar(string port, int baudrate = 115200) Connect and start scanning.
event LidarPointScanEvent Raised with batched scan points.
Stop() Stop scanning and motor.
Dispose() Stop and release all resources.

RpLidarSerialDevice — low-level device

Member Description
Connect() Open the serial port.
Disconnect() Close the serial port.
StartMotor() Enable motor at the configured PWM.
StopMotor() Set PWM to 0 and stop motor.
StartScan() Start Standard scan and read thread.
ForceScan() Force scan (no motor-sync check).
ForceScanExpress() Start Express scan (Boost or Sensitivity).
StopScan() Stop the read thread and motor.
Start() ConnectStopScan → pick scan mode → start.
Stop() StopScan.
SendRequest(Command) Send a raw protocol command.
event LidarPointScanEvent Raw point list, fired on timer.
event LidarPointGroupScanEvent Angle-keyed LidarPointGroup, fired on timer.

LidarPoint

Property Type Description
Angle float Heading in degrees (0 – 360).
Distance float Distance in millimetres.
Quality ushort Measurement quality (higher = better).
StartFlag bool true at the start of a new 360° revolution.
IsValid bool true when Distance > 0.

LidarPointGroup

An angle-keyed collection (0.1° resolution) built from a batch of LidarPoint values. Useful for per-angle lookups:

// Nearest obstacle directly ahead
var ahead = group[0];   // angle = 0°
if (ahead != null)
    Console.WriteLine($"Obstacle at {ahead.Distance} mm");

Platform Notes

  • Windows: Use COMn port names (e.g. COM3). The USB-UART adapter appears in Device Manager.
  • Linux: Typically /dev/ttyUSB0. You may need to add your user to the dialout group:
    sudo usermod -aG dialout $USER
    
  • macOS: /dev/tty.usbserial-* or /dev/tty.SLAB_USBtoUART.

Building from Source

git clone https://github.com/asheesh1996/RpLidar.NET.git
cd RpLidar.NET
dotnet build

Creating a NuGet package

dotnet pack RpLidar.NET/RpLidar.NET.csproj -c Release -o ./nupkg

The .nupkg file will be in ./nupkg/.

Publishing to NuGet.org

dotnet nuget push ./nupkg/RpLidar.NET.*.nupkg \
  --api-key YOUR_API_KEY \
  --source https://api.nuget.org/v3/index.json

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 108 4/6/2026
1.0.1-alpha.0.7 52 4/8/2026
1.0.1-alpha.0.5 49 4/6/2026
1.0.1-alpha.0.4 51 4/6/2026
1.0.1-alpha.0.3 62 4/6/2026
1.0.1-alpha.0.2 50 4/6/2026
1.0.1-alpha.0.1 51 4/6/2026
1.0.0 101 4/6/2026