ROS安装YDLidar X2L激光雷达驱动并连接

  • NVIDIA Jetson TX1
  • JetPack: 4.6
  • ros-melodic

YDLidar-SDK驱动安装

安装cmake

$ sudo apt install cmake pkg-config

编译YDLidar-SDK驱动包

$ git clone https://github.com/YDLIDAR/YDLidar-SDK.git
$ mkdir -p ~/YDLidar-SDK/build
$ cd YDLidar-SDK/build
$ cmake ..
$ make
$ sudo make install

包装

$ cd ~/YDLidar-SDK/build
$ cpack

安装完成后,USB插上雷达进行测试

$ cd ~/YDLidar-SDK/build
$ ./tri_test

会提示要输入雷达参数,YDLIDAR X2L参数如下,其他型号查询:https://github.com/YDLIDAR/YDLidar-SDK/blob/master/doc/Dataset.md

Baudrate:
0.115200
1.128000
2.153600
3.230400
4.460800
5.512000
Please select the lidar baudrate:0
whether the Lidar is one-way communication[yes/no]:no
Please enter the lidar scan frequency[5-12]:5

成功连接雷达会持续打印出信息

[YDLIDAR INFO] NOW YDLIDAR is scanning ..
can received at [1658223784687] 507 points is [5.367081]HZ

YDLidar-ros功能包安装

确保ROS已安装,创建一个ydlidar_ws的工作空间,下载功能包进行编译

$ mkdir -p ~/ydlidar_ws/src
$ cd ~/ydlidar_ws/src
$ catkin_init_workspace
$ git clone https://github.com/YDLIDAR/ydlidar_ros_driver.git 
$ cd ydlidar_ws
$ catkin_make
$ echo "source ~/ydlidar_ws/devel/setup.bash" >> ~/.bashrc
$ source ~/.bashrc

重新插入雷达,修改lidar_view.launch将雷达型号设置为X2L,其他型号同理

$ roslaunch ydlidar_ros_driver lidar_view.launch

成功启动后会自动打开rviz,显示扫描图像


评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注