Skip to main content

Python wrapper for RPLIDAR SDK using nanobind

Project description

PyRPLIDARSDK

Python wrapper for the Slamtec RPLIDAR SDK using nanobind.

This package provides a high-performance Python interface to RPLIDAR series laser range scanners, supporting both serial and UDP connections.

Installation

From PyPI (coming soon)

pip install pyrplidarsdk

From Source

# Clone the repository with submodules
git clone --recursive https://github.com/dexmate-ai/pyrplidarsdk.git
cd pyrplidarsdk

# Install in development mode
pip install -e .

Quick Start

Serial Connection

import pyrplidarsdk
import time

# Create driver instance for serial connection
driver = pyrplidarsdk.RplidarDriver(port="/dev/ttyUSB0")

# Connect to the device
if not driver.connect():
    print("Failed to connect!")
    exit(1)

# Get device information
info = driver.get_device_info()
if info:
    print(f"Connected to RPLIDAR model {info.model}")
    print(f"Firmware: {info.firmware_version}")
    print(f"Hardware: {info.hardware_version}")
    print(f"Serial: {info.serial_number}")

# Check device health
health = driver.get_health()
if health:
    print(f"Device health: {health.status}")

# Start scanning
if driver.start_scan():
    print("Scanning started...")
    
    try:
        for i in range(10):  # Get 10 scans
            scan_data = driver.get_scan_data()
            if scan_data:
                angles, ranges, qualities = scan_data
                print(f"Scan {i+1}: {len(angles)} points")
            time.sleep(0.1)
    finally:
        driver.stop_scan()
        driver.disconnect()

UDP Connection

import pyrplidarsdk

# Create driver instance for UDP connection
driver = pyrplidarsdk.RplidarDriver(ip_address="192.168.1.100")

# Rest of the code is the same...

API Reference

RplidarDriver

Main class for controlling RPLIDAR devices.

Constructor

RplidarDriver(port=None, ip_address=None, baudrate=1000000, udp_port=8089)
  • port (str, optional): Serial port path (e.g., "/dev/ttyUSB0", "COM3")
  • ip_address (str, optional): IP address for UDP connection
  • baudrate (int): Serial baudrate (default: 1000000)
  • udp_port (int): UDP port (default: 8089)

Methods

  • connect() -> bool: Connect to the device
  • disconnect(): Disconnect from the device
  • get_device_info() -> DeviceInfo | None: Get device information
  • get_health() -> DeviceHealth | None: Get device health status
  • start_scan() -> bool: Start laser scanning
  • stop_scan(): Stop laser scanning
  • get_scan_data() -> tuple[list[float], list[float], list[int]] | None: Get scan data

DeviceInfo

Device information structure.

  • model (int): Device model number
  • firmware_version (int): Firmware version
  • hardware_version (int): Hardware version
  • serial_number (str): Device serial number (hex string)

DeviceHealth

Device health information.

  • status (int): Health status code
  • error_code (int): Error code if any

Utility Functions

The package includes utility functions in pyrplidarsdk.utils:

from pyrplidarsdk.utils import polar_to_cartesian, filter_by_range

# Convert polar to cartesian coordinates
x_coords, y_coords = polar_to_cartesian(angles, ranges)

# Filter by range
filtered_angles, filtered_ranges, filtered_qualities = filter_by_range(
    angles, ranges, qualities, min_range=0.1, max_range=5.0
)

Support

Acknowledgments

  • Slamtec for the RPLIDAR SDK
  • nanobind for the excellent Python-C++ binding framework

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyrplidarsdk-0.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (104.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyrplidarsdk-0.1.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (97.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

pyrplidarsdk-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (104.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyrplidarsdk-0.1.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (97.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

pyrplidarsdk-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (105.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyrplidarsdk-0.1.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (99.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

pyrplidarsdk-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (105.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyrplidarsdk-0.1.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (99.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

File details

Details for the file pyrplidarsdk-0.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyrplidarsdk-0.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 27939801af5945b8ae5f396e54ba0dadf9edb6a5a7624ab4cb3b64adbb9752bb
MD5 ac26feedb266cdb746d5e78e3289aac0
BLAKE2b-256 29f5ee2de7bf20641acf02cb2432e169a81407729435a748ab6fdb0e33075b37

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrplidarsdk-0.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on dexmate-ai/pyrplidarsdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyrplidarsdk-0.1.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pyrplidarsdk-0.1.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f4b7d1faa22c063c6d150c52753518cff2656e82d432b079a3c9e8f2fb09d43f
MD5 bab13aa63dbf0a9d284d2087e1a8c5c0
BLAKE2b-256 d0057d21ca49447558bc9fa8c3370aa8d2a798204b61db152c2e4416322f8803

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrplidarsdk-0.1.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl:

Publisher: pypi.yml on dexmate-ai/pyrplidarsdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyrplidarsdk-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyrplidarsdk-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 caacc0f8b3ae3e9f88e59a5bddfce67614440ad46a7161574e8dd1e36b458989
MD5 9d91e4750f70ab6680fced037a3dd7de
BLAKE2b-256 ac1ccb79d7c392a407b063fe422e489eb63db5faccde6889227bebbb9476a840

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrplidarsdk-0.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on dexmate-ai/pyrplidarsdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyrplidarsdk-0.1.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pyrplidarsdk-0.1.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 370c78f6a1979dc3f64526c3ab1f7d53ad293ec4c82cfb64f68a394cd48c7ab0
MD5 bb356aa2c4a184b7ec07ce982cbdfe13
BLAKE2b-256 d8084554006620455734f5b1fd3a4d20314c1df2bac7bb32ccf5862b77f2629d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrplidarsdk-0.1.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl:

Publisher: pypi.yml on dexmate-ai/pyrplidarsdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyrplidarsdk-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyrplidarsdk-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3d2d8e6f0390eee62153007155cc3fce742e4c4f370e30a37ef5cb110ed085a0
MD5 c075545c26993deabd9129bd5b54b2b3
BLAKE2b-256 71d3ea2f9cfb519f9c2f9206c77ce51463dc3d687666388d348867af45654b13

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrplidarsdk-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on dexmate-ai/pyrplidarsdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyrplidarsdk-0.1.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pyrplidarsdk-0.1.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 fe28aa165258df75769725aedf25726f32f8615dbabadff46a13af4ff1229048
MD5 ad15b98c8279e90cad5e1e5f1692fe18
BLAKE2b-256 c6b40fb62b582742e92e55fa765537283453db45187019bf0cafade6a1fac485

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrplidarsdk-0.1.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl:

Publisher: pypi.yml on dexmate-ai/pyrplidarsdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyrplidarsdk-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyrplidarsdk-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 644aad33a379a034a8b22023914811bb3a2159e61a515cef9f8eb84142564a66
MD5 2c47f3d941aa0540ecb1f896dc9174c9
BLAKE2b-256 f5dced246975d2dd16e35d6ad0a4008a82fe6bc7043838140f07765c902870bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrplidarsdk-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on dexmate-ai/pyrplidarsdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyrplidarsdk-0.1.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pyrplidarsdk-0.1.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d442c397991d2b4147c9d5a956089be8d3034ee2b7e69ee6d1f375fa58467b15
MD5 0012124f7d9fbc3021bc458b74fcf9b9
BLAKE2b-256 34e889ef28c801d7886cd921410cdfc830e22aacb97e104820696ffddb17f3ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrplidarsdk-0.1.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl:

Publisher: pypi.yml on dexmate-ai/pyrplidarsdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page