![]() |
ldrobot-lidar-ros2 repositoryscan ros2 ldlidar ld-air ld16 ld19 ldlidar ldlidar_component ldlidar_node |
Repository Summary
Description | ROS2 package for LDRobot lidar. Based on ROS2 Lifecycle nodes |
Checkout URI | https://github.com/myzhar/ldrobot-lidar-ros2.git |
VCS Type | git |
VCS Version | devel |
Last Updated | 2025-05-02 |
Dev Status | UNKNOWN |
Released | UNRELEASED |
Tags | scan ros2 ldlidar ld-air ld16 ld19 |
Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
Name | Version |
---|---|
ldlidar | 0.2.0 |
ldlidar_component | 0.2.0 |
ldlidar_node | 0.3.0 |
README
LD Lidar ROS 2 Package
ROS 2 package for LDRobot lidar - Based on Nav2 Lifecycle nodes
Get the Lidar • YouTube Videos • Install • Start the Node • Parameters • RViz2 • Robot Integration • Benchmarking
This package is designed to work with the DToF 2D Lidar sensors LD19 made by LDRobot.
It can work also with the LD06 model, but no tests have been performed with it. LD06 cannot work outdoor.
LD19 | LD06 |
---|---|
![]() |
![]() |
Get the lidar
My lidar (LD19) comes from the LDRobot kickstarter campaing ended in 2021.
LDRobot then created also an Indiegogo campaign for the LD19.
LDRobot today distributes the Lidar through third-party resellers:
- Waveshare: LD19
- Innomaker: LD06
- Other: Search on Google
The node in action
LD19 Lifecycle | LD19 outdoor |
---|---|
![]() |
![]() |
Install the node
The node is designed to work with
:pushpin: Note: ROS 2 Rolling is not yet supported because of the missing
nav2_utils
dependency
Clone the repository in your ROS2 workspace:
cd ~/ros2_ws/src/ #use your current ros2 workspace folder
git clone https://github.com/Myzhar/ldrobot-lidar-ros2.git
Add dependencies:
sudo apt install libudev-dev
Install the udev rules
cd ~/ros2_ws/src/ldrobot-lidar-ros2/scripts/
./create_udev_rules.sh
Build the packages:
cd ~/ros2_ws/
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release
Update the environment variables:
echo source $(pwd)/install/local_setup.bash >> ~/.bashrc
source ~/.bashrc
Start the node
Launch file with YAML parameters
The default values of the parameters of the node can be modified by editing the file ldlidar.yaml
.
Open a terminal console and enter the following command to start the node with customized parameters:
ros2 launch ldlidar_node ldlidar_bringup.launch.py
The ldlidar_bringup.launch.py
starts a ROS 2 Container, which loads the LDLidar Component as a plugin.
The ldlidar_bringup.launch.py
script also starts a robot_state_publisher
node that provides the static TF transform of the
LDLidar [ldlidar_base
->ldlidar_link
], and provides the ldlidar description in the /robot_description
.
Lifecycle
The ldlidar
node is based on the ROS2 lifecycle
architecture, hence it starts in the UNCONFIGURED
state.
To configure the node, load all the parameters, establish a connection, and activate the scan publisher, the lifecycle services must be called in sequence.
Open a new terminal console and enter the following command:
ros2 lifecycle set /ldlidar_node configure
If the node is correctly configured and the connection is established, Transitioning successful
is returned. If there are errors, Transitioning failed
is returned. Check the node log for details on any connection issues.
The node is now in the INACTIVE
state, enter the following command to activate:
ros2 lifecycle set /ldlidar_node activate
The node is now activated and the /ldlidar_node/scan
topic of type sensor_msgs/msg/LaserScan
is available to be subscribed.
File truncated at 100 lines see the full file
CONTRIBUTING
Submitting your code changes
Code contributions should be made via pull requests to the appropriate repository:
As a contributor please follow the practices explained in ROS2 documentation.
Before submitting a pull request please perform this list of tasks from the root of your ROS2 workspace:
-
Automatic code formatting:
$ ament_uncrustify --reformat src
-
Build the packages to check for compile errors:
$ colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release
-
Perform the automatic build tests:
$ colcon test
-
Analyze and solve eventually reported errors:
$ colcon test-result --verbose
-
Repeat steps (1) -> (4) until all reported formatting errors have been resolved.
License
Any contribution that you make to this repository will be under the Apache 2 License, as dictated by that license:
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
Contributors must sign-off each commit by adding a Signed-off-by: ...
line to commit messages to certify that they have the right to submit
the code they are contributing to the project according to the
Developer Certificate of Origin (DCO).