文章目录
- 软硬件条件
- laser_scan_matcher通过源码安装
- rplidar_ros通过源码安装
- 设置参数
- 启动
- 效果预览
软硬件条件
软件:Ubuntu 20.04,ROS noetic
硬件:RPLidar A1.
laser_scan_matcher通过源码安装
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
git clone https://github.com/ccny-ros-pkg/scan_tools.git
cd ..
catkin_make
PS:遇到报错“No package ''csm” found,使用sudo apt-get install ros-noetic-csm
rplidar_ros通过源码安装
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
git clone https://github.com/Slamtec/rplidar_ros.git
cd ..
catkin_make
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
设置参数
在./rplidar_ros/launch文件夹中设置a1_gmapping.launch
<!--
Example launch file: uses laser_scan_matcher together with
slam_gmapping
-->
<launch>
<include file="$(find rplidar_ros)/launch/rplidar.launch"/>
<node pkg="tf" type="static_transform_publisher" name="base_link_to_laser"
args="0.0 0.0 0.0 0.0 0.0 0.0 /base_link /laser 40" />
<node pkg="laser_scan_matcher" type="laser_scan_matcher_node"
name="laser_scan_matcher_node" output="screen">
<param name="fixed_frame" value = "odom"/>
<param name="max_iterations" value="10"/>
</node>
<node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
<param name="map_udpate_interval" value="1.0"/>
<param name="maxUrange" value="12.0"/>
<param name="sigma" value="0.1"/>
<param name="kernelSize" value="1"/>
<param name="lstep" value="0.15"/>
<param name="astep" value="0.15"/>
<param name="iterations" value="1"/>
<param name="lsigma" value="0.1"/>
<param name="ogain" value="3.0"/>
<param name="lskip" value="1"/>
<param name="srr" value="0.1"/>
<param name="srt" value="0.2"/>
<param name="str" value="0.1"/>
<param name="stt" value="0.2"/>
<param name="linearUpdate" value="1.0"/>
<param name="angularUpdate" value="0.5"/>
<param name="temporalUpdate" value="0.4"/>
<param name="resampleThreshold" value="0.5"/>
<param name="particles" value="10"/>
<param name="xmin" value="-10.0"/>
<param name="ymin" value="-10.0"/>
<param name="xmax" value="10.0"/>
<param name="ymax" value="10.0"/>
<param name="delta" value="0.02"/>
<param name="llsamplerange" value="0.01"/>
<param name="llsamplestep" value="0.05"/>
<param name="lasamplerange" value="0.05"/>
<param name="lasamplestep" value="0.05"/>
</node>
</launch>
启动
检查端口权限
ls -l /dev |grep ttyUSB
设置端口权限
sudo chmod 666 /dev/ttyUSB0
启动a1_gmapping.launch
roslaunch rplidar_ros a1_gmapping.launch