{"id":25193300,"url":"https://github.com/ldrobotSensorTeam/ldlidar_sl_ros2","last_synced_at":"2025-10-24T20:31:13.180Z","repository":{"id":150589574,"uuid":"468585984","full_name":"ldrobotSensorTeam/ldlidar_sl_ros2","owner":"ldrobotSensorTeam","description":"LDROBOT Triangle LiDAR ROS2 Package","archived":false,"fork":false,"pushed_at":"2023-04-10T09:35:56.000Z","size":116,"stargazers_count":7,"open_issues_count":2,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T22:33:23.404Z","etag":null,"topics":["ld14","ros2"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ldrobotSensorTeam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-11T02:51:35.000Z","updated_at":"2024-11-08T05:56:53.000Z","dependencies_parsed_at":"2023-06-11T14:15:26.487Z","dependency_job_id":null,"html_url":"https://github.com/ldrobotSensorTeam/ldlidar_sl_ros2","commit_stats":{"total_commits":12,"total_committers":2,"mean_commits":6.0,"dds":0.08333333333333337,"last_synced_commit":"d70802ac5d46e4e02c8318b2769f508f0f86172e"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ldrobotSensorTeam%2Fldlidar_sl_ros2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ldrobotSensorTeam%2Fldlidar_sl_ros2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ldrobotSensorTeam%2Fldlidar_sl_ros2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ldrobotSensorTeam%2Fldlidar_sl_ros2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ldrobotSensorTeam","download_url":"https://codeload.github.com/ldrobotSensorTeam/ldlidar_sl_ros2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238030233,"owners_count":19404860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ld14","ros2"],"created_at":"2025-02-09T23:01:09.764Z","updated_at":"2025-10-24T20:31:12.801Z","avatar_url":"https://github.com/ldrobotSensorTeam.png","language":"C++","funding_links":[],"categories":["LDROBOT"],"sub_categories":["LDROBOT LD14P"],"readme":"# Instructions\n\n\u003e This SDK is only applicable to the LiDAR products sold by Shenzhen LDROBOT Co., LTD. The product models are :\n\u003e - LDROBOT LiDAR LD14\n\u003e - LDROBOT LiDAR LD14P\n\n## step 0: get LiDAR ROS2 Package\n```bash\ncd ~\n\nmkdir -p ldlidar_ros2_ws/src\n\ncd ldlidar_ros2_ws/src\n\ngit clone  https://github.com/ldrobotSensorTeam/ldlidar_sl_ros2.git\n```\n## step 1: system setup\n- Connect the LiDAR to your system motherboard via an onboard serial port or usB-to-serial module (for example, CP2102 module).\n\n- Set the -x permission for the serial port device mounted by the radar in the system (for example, /dev/ttyUSB0)\n\n  - In actual use, the LiDAR can be set according to the actual mounted status of your system, you can use 'ls -l /dev' command to view.\n\n``` bash\ncd ~/ldlidar_ros2_ws\n\nsudo chmod 777 /dev/ttyUSB0\n```\n- Modify the `port_name` value in the Lanuch file corresponding to the radar product model under `launch/`, using `ld14.launch.py` as an example, as shown below.\n\n```py\n#!/usr/bin/env python3\nfrom launch import LaunchDescription\nfrom launch_ros.actions import Node\n\n'''\nParameter Description:\n---\n- Set laser scan directon: \n  1. Set counterclockwise, example: {'laser_scan_dir': True}\n  2. Set clockwise,        example: {'laser_scan_dir': False}\n- Angle crop setting, Mask data within the set angle range:\n  1. Enable angle crop fuction:\n    1.1. enable angle crop,  example: {'enable_angle_crop_func': True}\n    1.2. disable angle crop, example: {'enable_angle_crop_func': False}\n  2. Angle cropping interval setting:\n  - The distance and intensity data within the set angle range will be set to 0.\n  - angle \u003e= 'angle_crop_min' and angle \u003c= 'angle_crop_max' which is [angle_crop_min, angle_crop_max], unit is degress.\n    example:\n      {'angle_crop_min': 135.0}\n      {'angle_crop_max': 225.0}\n      which is [135.0, 225.0], angle unit is degress.\n'''\n\ndef generate_launch_description():\n  # LDROBOT LiDAR publisher node\n  ldlidar_node = Node(\n      package='ldlidar_sl_ros2',\n      executable='ldlidar_sl_ros2_node',\n      name='ldlidar_publisher_ld14',\n      output='screen',\n      parameters=[\n        {'product_name': 'LDLiDAR_LD14'},\n        {'laser_scan_topic_name': 'scan'},\n        {'point_cloud_2d_topic_name': 'pointcloud2d'},\n        {'frame_id': 'base_laser'},\n        {'port_name': '/dev/ttyUSB0'},\n        {'serial_baudrate' : 115200},\n        {'laser_scan_dir': True},\n        {'enable_angle_crop_func': False},\n        {'angle_crop_min': 135.0},\n        {'angle_crop_max': 225.0}\n      ]\n  )\n\n  # base_link to base_laser tf node\n  base_link_to_laser_tf_node = Node(\n    package='tf2_ros',\n    executable='static_transform_publisher',\n    name='base_link_to_base_laser_ld14',\n    arguments=['0','0','0.18','0','0','0','base_link','base_laser']\n  )\n\n\n  # Define LaunchDescription variable\n  ld = LaunchDescription()\n\n  ld.add_action(ldlidar_node)\n  ld.add_action(base_link_to_laser_tf_node)\n\n  return ld\n```\n\n## step 2: build\n\nRun the following command.\n\n```bash\ncd ~/ldlidar_ros2_ws\n\ncolcon build\n```\n## step 3: run\n\n### step3.1: package environment variable settings\n\n- After the compilation is completed, you need to add the relevant files generated by the compilation to the environment variables, so that the ROS environment can recognize them. The execution command is as follows. This command is to temporarily add environment variables to the terminal, which means that if you reopen a new terminal, you also need to re-execute it. The following command.\n  \n  ```bash\n  cd ~/ldlidar_ros2_ws\n  \n  source install/local_setup.bash\n  ```\n  \n- In order to never need to execute the above command to add environment variables after reopening the terminal, you can do the following.\n\n  ```bash\n  echo \"source ~/ldlidar_ros2_ws/install/local_setup.bash\" \u003e\u003e ~/.bashrc\n  \n  source ~/.bashrc\n  ```\n### step3.2: start LiDAR node\n\n- The product is LDROBOT LiDAR LD14\n  - start ld14 lidar node:\n  ``` bash\n  ros2 launch ldlidar_sl_ros2 ld14.launch.py\n  ```\n  - start ld14 lidar node and show on the Rviz2:\n  ``` bash\n  ros2 launch ldlidar_sl_ros2 viewer_ld14.launch.py\n  ```\n\n- The product is LDROBOT LiDAR LD14P\n  - start ld14p lidar node:\n  ``` bash\n  ros2 launch ldlidar_sl_ros2 ld14p.launch.py\n  ```\n  - start ld14p lidar node and show on the Rviz2:\n  ``` bash\n  ros2 launch ldlidar_sl_ros2 viewer_ld14p.launch.py\n  ```\n\n## step 4: test\n\n\u003e The code supports ubuntu 20.04 ros2 foxy version and above, using rviz2 visualization.\n\n- new a terminal (Ctrl + Alt + T) and use Rviz2 tool(run command: `rviz2`) ,open the `ldlidar.rviz` file below the rviz2 folder of the readme file directory\n```bash\nrviz2\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FldrobotSensorTeam%2Fldlidar_sl_ros2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FldrobotSensorTeam%2Fldlidar_sl_ros2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FldrobotSensorTeam%2Fldlidar_sl_ros2/lists"}