English| 简体中文
LDLIDAR ROS2 driver sends laser radar data in ROS2 standard message format.
For detailed product models, please refer to LDLIDAR official website using LDLIDAR X3 as an example.
| Item Option | Inventory |
|---|---|
| RDK X3 | Purchase Link |
| LDLIDAR X3 | Purchase Link |
-
The Horizon RDK has been flashed with the Ubuntu 20.04 system image provided by Horizon.
-
LDLIDAR correctly connected to RDK X3.
Connect to RDK X3 via terminal or VNC, and execute the following commands:
tros foxy:
sudo apt update
sudo apt install -y tros-ldlidar_ros2tros humble:
sudo apt update
sudo apt install -y tros-humble-ldlidar_ros2Note: If LDLIDAR is connected to RDK X3 during installation, it needs to be plugged in again after installation.
tros foxy:
source /opt/tros/setup.bash
ros2 launch ldlidar_ros2 ld06.launch.pytros humble:
source /opt/tros/humble/setup.bash
ros2 launch ldlidar_ros2 ld06.launch.pyOpen a new terminal and enter the following command to view laser radar output data:
tros foxy:
source /opt/tros/setup.bash
ros2 topic echo /scantros humble:
source /opt/tros/humble/setup.bash
ros2 topic echo /scanNote: The device running Foxglove Studio should be on the same network segment as the RDK device.
-
Go to the Foxglove official website to download Foxglove Studio and install it on your PC.
-
Open a new terminal on RDK and enter the following command to install rosbridge:
tros foxy:
sudo apt update sudo apt install ros-foxy-rosbridge-suite
tros humble:
sudo apt update sudo apt install ros-humble-rosbridge-suite
-
Run the following command to start rosbridge:
tros foxy:
source /opt/tros/setup.bash ros2 launch rosbridge_server rosbridge_websocket_launch.xmltros humble:
source /opt/tros/humble/setup.bash ros2 launch rosbridge_server rosbridge_websocket_launch.xml -
Open Foxglove Studio, select "Open Connection," choose rosbridge as the connection method in the subsequent dialog, and enter the RDK's IP address instead of localhost.
5.In Foxglove Studio, click the "Settings" button in the upper right corner, and in the panel that pops up on the left, configure the radar topic to be "visible." At this point, the studio will display the radar point cloud in real-time.
Install ROS2 on a PC or an environment that supports RVIZ. Here, we take the foxy version as an example, run:
tros foxy:
source /opt/ros/foxy/setup.bash
ros2 run rviz2 rviz2tros humble:
source /opt/ros/humble/setup.bash
ros2 run rviz2 rviz2Add LaserScan and configure the Reliability Policy as System Default.
Set Fixed Frame to base_link or laser_link to see the laser radar collected data.
| Topic | Type | Description |
|---|---|---|
scan |
sensor_msgs/LaserScan | Two-dimensional laser radar scan data |
pointcloud2d |
sensor_msgs/PointCloud | Two-dimensional laser radar 2D point cloud data |
| Parameter name | Data Type | Detail |
|---|---|---|
| frame_id | string | Default value for frame name: laser_frame |
| product_name | string | Radar type names: LDLiDAR_LD14,M10_P,M10_PLUS,M10_GPS,N10,L10,N10_P |
| port_name | string | Set the port number of the laser radar device For example, serial port /dev/ttyUSB0 |
| serial_baudrate | int | Serial port baud rate. Default value: 115200 |
| enable_angle_crop_func | bool | Enable angle cropping function. Default value: False |
| angle_crop_min | float | Starting angle for cropping. Default value: 135.0 |
| angle_crop_max | float | Ending angle for cropping. Default value: 225.0 |
| range_min | float | Minimum distance received by radar. Default value: 0.02 |
| range_max | float | Maximum distance received by radar. Default value: 8.0 |
| scan_topic | string | Set the topic name for laser data: /scan |
| point_cloud_2d_topic_name | string | Set the topic name for laser data: /pointcloud2d |




