使用的ubuntu18.04+ROS-melodic
官网找到L2系列的产品
SDK下载:下载中心 L2 - 宇树科技
激光雷达使用
下载unilidar_sdk2-2.0.4.zip,解压只用到unitree_lidar_sdk+unitree_lidar_ros(ROS1)。
L2有两个工作模式:网口模式(work_mode=0)、串口模式(work_mode=8)
我使用的是串口模式:
一、先根据README_CN.md中将unitree_lidar_sdk编译,测试输出../bin/example_lidar_serial中间如果报错,查看电脑,终端命令行ll /dev是否识别串口ttyACM0
[unitree_lidar_ros_node-3] restarting process
process[unitree_lidar_ros_node-3]: started with pid [13322]
initialize_type_ = 1
terminate called after throwing an instance of 'serial::IOException'
what(): IO Exception (13): Permission denied, file /home/mlb/ut_workspace/202207_unitree_selfmade_lidar/unilidar_sdk2_dev/unitree_lidar_sdk/src/serial/impl/unix.cc, line 151.
[rviz-2] process has finished cleanly
log file: /home/ncu408/.ros/log/2465253a-ffbc-11ef-90c6-00e01e4403bc/rviz-2*.log
[unitree_lidar_ros_node-3] process has died [pid 13322, exit code -6, cmd /home/ncu408/unilidar_sdk2-2.0.4/unitree_lidar_ros/devel/lib/unitree_lidar_ros/unitree_lidar_ros_node __name:=unitree_lidar_ros_node __log:=/home/ncu408/.ros/log/2465253a-ffbc-11ef-90c6-00e01e4403bc/unitree_lidar_ros_node-3.log].
log file: /home/ncu408/.ros/log/2465253a-ffbc-11ef-90c6-00e01e4403bc/unitree_lidar_ros_node-3*.log
报错原因解析:串口权限不足;查看权限:ls -l /dev/ttyACM0
输出ls -l /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 3月 13 13:36 /dev/ttyACM0修改权限sudo chmod 777 /dev/ttyACM0
注意查看终端输出的work_mode是否显示的是8(串口模式)
二、将unitree_lidar_ros 中的README_CN.md中4.2配置工作路径的work_mode改为8
编译unitree_lidar_ros
如果未正常显示点云信息,将雷达重新插拔一下。
三、至此RVIZ应该正确显示点云信息