Skip to content

A heavily refactored, industrial-grade ROS 2 driver for Slamtec RPLIDAR. Features Lifecycle management, fault-tolerant FSM, and zero-copy optimization.

License

Notifications You must be signed in to change notification settings

frozenreboot/rplidar_ros2_driver

🛡️ Robust RPLIDAR ROS 2 Driver (Industrial-Grade)

ROS2 Jazzy C++17 License Build Status

"Because the official driver shouldn't crash just because you pulled the plug."

This is a heavily refactored, fault-tolerant ROS 2 driver for Slamtec RPLIDAR. Designed with a Lifecycle State Machine and Thread-Safe Architecture, ensuring your robot keeps running even under hardware disconnection or permission failures.


⚡ Why Use This? (Table of Shame)

Feature Official Slamtec ROS 2 This Driver (frozenreboot)
Hot-plug Recovery ❌ Crash / Hang ✅ Auto-reconnect via FSM
Permission Denied ❌ Silent Fail / Garbage Data ✅ Explicit Diagnostics
Dynamic Reconfigure ❌ Restart Required ✅ Runtime RPM/Mode Update
Zero-Copy Optimization ❌ N/A ✅ Smart Pointer & Move Semantics
Architecture ❌ Tight SDK Coupling ✅ Interface-based Abstraction

🧪 Call for Experiments: "Does it survive?"

I need your help to validate this driver on various robots! If you use this driver, please stress-test it (e.g., unplug USB while scanning, change RPM dynamically) and share your results.

📢 How to Submit a Report

Please open an issue with the title [Experiment] Your_Robot_Name and include:

  1. Lidar Model: (e.g., A1, A2, S1...)
  2. Recovery Log: (Copy paste the terminal output when you unplug/replug)
  3. Screenshot: rqt_graph or rviz2

👉 Submit your Experiment Report Here


🚀 Getting Started

1. Installation

cd ~/ros2_ws/src
git clone https://github.com/frozenreboot/rplidar_ros2_driver.git
cd ..

# Install dependencies
sudo apt update
rosdep update
rosdep install --from-paths src --ignore-src -r -y

# Build the workspace
colcon build --symlink-install

2. Quick Launch

ros2 launch rplidar_ros2_driver rplidar.launch.py serial_port:=/dev/ttyUSB0

3. Dynamic Reconfigure (Runtime)

You can change the motor speed without killing the node:

ros2 param set /rplidar_node rpm 1000
ros2 param set /rplidar_node scan_mode DenseBoost

🏗️ Architecture

This driver uses a 3-Layer Design to decouple ROS 2 logic from the vendor SDK.

  • Node Layer: Handles Lifecycle & Parameters.

  • Wrapper Layer: Handles Threading & Mutex.

  • SDK Layer: Raw data fetching.

Architecture Diagram


👤 Author & Maintainer

  • frozenreboot - Initial Refactoring & Architecture Design

  • Blog: Tech Log

Based on the original work by RoboPeak & Slamtec.


🤖 AI-Assisted Development Disclosure

In compliance with the OSRF Policy on the Use of Generative AI in Contributions (Effective May 2025), I explicitly disclose the use of Generative AI tools in the development of this driver.

  • Tools Used:
    • Google Gemini / ChatGPT (LLMs): Used for generating boilerplate code, formatting documentation, and initial refactoring suggestions.
  • Verification:
    • All AI-generated content has been manually reviewed, tested, and verified by the maintainer.
    • The logic, memory safety (C++17 standards), and ROS 2 lifecycle state transitions have been rigorously checked to ensure system stability.
  • Note:
    • Future contributions will strictly follow the Generated-by: tag convention in commit messages as per the OSRF guidelines.

About

A heavily refactored, industrial-grade ROS 2 driver for Slamtec RPLIDAR. Features Lifecycle management, fault-tolerant FSM, and zero-copy optimization.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •