TK1入门教程硬件篇-外接RPlidar A2
TK1入门教程硬件篇-外接RPlidar A2
说明:
- 介绍如何接入RPlidar A2,并使用ROS测试。
驱动安装:
- 创建工作空间,并安装驱动:
cd ~/turtlebt_ws/src #这里我在之前的教程,已经创建就不重复
git clone https://github.com/robopeak/rplidar_ros.git
- 单独对软件包编译:
cd ..
catkin_make --pkg rplidar_ros
- 生成 rplidarNode 和 rplidarNodeClient 节点
测试使用:
- 因为挂载多个USB设备,需要检查雷达使用的端口号
dmesg | grep ttyUSB*
- 效果:
$ dmesg | grep ttyUSB*
[ 11.224077] usb 2-1.3: FTDI USB Serial Device converter now attached to ttyUSB0
[ 11.290702] usb 2-1.4: cp210x converter now attached to ttyUSB1
查看cp210x对应的USB,为ttyUSB1。
创建别名:
cd ~/turtlebot_ws/src/rplidar_ros/
./scripts/create_udev_rules.sh
- 会创建雷达ttyUSB*与别名之间的链接,这里是/dev/rplidar->/dev/ttyUSB1
- 这样只要连接雷达会自动创建别名,就不需要在频繁修改端口号了。
- 注意:不要忘记创建别名后,要重插一次让别名生效。
- 打开rplidar.launch,更换端口号:
vim launch/rplidar.launch
- 修改/dev/ttyUSB0为/dev/rplidar,如下:
<param name="serial_port" type="string" value="/dev/rplidar"/>
- 在RVIZ中打开:
roslaunch rplidar_ros view_rplidar.launch
- 可在RVIZ查看到具体的激光效果:
- 查看扫描结果:
roslaunch rplidar_ros rplidar.launch
rosrun rplidar_ros rplidarNodeClient
- 效果:
started roslaunch server http://192.168.0.103:34685/
SUMMARY
========
PARAMETERS
* /rosdistro: indigo
* /rosversion: 1.11.21
* /rplidarNode/angle_compensate: True
* /rplidarNode/frame_id: laser
* /rplidarNode/inverted: False
* /rplidarNode/serial_baudrate: 115200
* /rplidarNode/serial_port: /dev/rplidar
NODES
/
rplidarNode (rplidar_ros/rplidarNode)
rplidarNodeClient (rplidar_ros/rplidarNodeClient)
auto-starting new master
process[master]: started with pid [3721]
ROS_MASTER_URI=http://192.168.0.103:11311
setting /run_id to d2561108-290b-11e7-bdbf-00044b7090db
process[rosout-1]: started with pid [3734]
started core service [/rosout]
process[rplidarNode-2]: started with pid [3737]
process[rplidarNodeClient-3]: started with pid [3738]
RPLIDAR running on ROS package rplidar_ros
SDK Version: 1.5.7
^C[rplidarNodeClient-3] killing on exit
[rplidarNode-2] killing on exit
RPLIDAR S/N: CCD292C1E9839EF5C8E49BF61D673C03
Firmware Ver: 1.20
Hardware Rev: 3
RPLidar health status : 0
参考:
- http://wiki.ros.org/rplidar
- http://www.slamtec.com/download/lidar/documents/zh-cn/LR001_SLAMTEC_rplidar_protocol_v0.2_cn.pdf
- http://www.slamtec.com/download/lidar/documents/zh-cn/LR002_SLAMTEC_rplidar_sdk_v0.1_cn.pdf
- rplidar roswiki: http://wiki.ros.org/rplidar
- rplidar HomePage: http://www.slamtec.com/en/Lidar
- rplidar Tutorial: https://github.com/robopeak/rplidar_ros/wiki
- rplidar github : https://github.com/robopeak/rplidar_ros
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号