Skip to content

guangyuan-ning/ydlidar_ros_driver

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English| 简体中文

Function Introduction

YDLIDAR ROS2 driver sends LiDAR data in ROS2 standard message format.

Inventory

For a comprehensive list of product models, please refer to YDLIDAR official website. Here we use YDLIDAR X3 as an example for demonstration.

YDLIDAR

Item Options List
RDK X3 Purchase Link
YDLIDAR X3 Purchase Link

Instructions

Preparation

  1. Horizon RDK has been pre-installed with the provided Ubuntu 20.04 system image.

  2. YDLIDAR is properly connected to RDK X3.

Installing YDLIDAR Driver

Connect to RDK X3 via terminal or VNC, and execute the following commands:

sudo apt update
sudo apt install -y tros-ydlidar-ros2-driver

Note: If YDLIDAR is connected to RDK X3 during the installation, it needs to be reconnected after installation

Running YDLIDAR

source /opt/tros/setup.bash
ros2 launch ydlidar_ros2_driver ydlidar_launch.py

Viewing LiDAR Data

Method 1: Command Line

Open a new terminal and input the following command to view LiDAR output data:

source /opt/tros/setup.bash
ros2 topic echo /scan
```### Method 2 RVIZ Method

Install ROS2 on a PC or environment supporting RVIZ. Here is an example using the foxy version, run the following commands:

```bash
source /opt/ros/foxy/setup.bash
ros2 run rviz2 rviz2

Add LaserScan and configure the Reliability Policy as System Default.

RVIZ

Set the Fixed Frame as base_link or laser_link to see the data collected by the LiDAR.

RVIZ

Interface Description

Topics

Published Topics

Topic Type Description
scan sensor_msgs/LaserScan Two-dimensional LaserScan data

Services

Subscribed Services

Service Type Description
stop_scan std_srvs::Empty Stop the LiDAR
start_scan std_srvs::Empty Start the LiDAR

Parameters

Parameter name Data Type detail
port string Set the port of the LiDAR device
Example: /dev/ttyUSB0 for serial port, 192.168.1.11 for ethernet port, default value: /dev/ydlidar
frame_id string Frame name, default value: laser_frame
ignore_array string Filter measurement points
eg: -90, -80, 30, 40
baudrate int Serial port baudrate
Default value: 230400
lidar_type int LiDAR model
0 -- TYPE_TOF
1 -- TYPE_TRIANGLE
2 -- TYPE_TOF_NET
Default value: 1
device_type int Device communication type
0 -- YDLIDAR_TYPE_SERIAL
1 -- YDLIDAR_TYPE_TCP
2 -- YDLIDAR_TYPE_UDP
Default value: 0
sample_rate int Sampling frequency.
Default value: 9
abnormal_check_count int Retry count when startup fails.
Default value: 4
fixed_resolution bool Enable correction of angular resolution.
Default value: true
reversion bool Change scan direction.
Default value: true
inverted bool Change scan direction, clockwise or counterclockwise.
false -- Clockwise.
true -- CounterClockwise
Default value: true
isSingleChannel bool Whether it is a single channel.
Default value: false
intensity bool Whether the LiDAR outputs measurement intensity.
true -- G2 LiDAR.
Default value: false
support_motor_dtr bool Whether the LiDAR can be started and stopped via serial DTR.
Default value: false
angle_min float Minimum measurement angle.
Default value: -180
angle_max float Maximum measurement angle.
Default value: 180
range_min float Minimum measurement range.
Default value: 0.1
range_max float Maximum measurement range.
Default value: 16.0
frequency float Scanning frequency.
Default value: 10.0
invalid_range_is_inf bool Invalid Range is inf.
true -- inf.
false -- 0.0.
Default value: false

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 49.0%
  • Python 32.1%
  • CMake 15.9%
  • Shell 3.0%