使⽤思岚A1激光雷达数据跑GMapping算法(实测可⽤)
仅⽤激光雷达数据跑GMapping算法
1.缘起
  实体机器⼈是GMapping算法的必需品,必须要有⾥程计的输⼊数据。然⽽,ROS中提供了Laser_scan_matcher包可以被⽤于⾥程计估计器,因此可以⽐较好的胜任所需要的任务:使⽤激光数据构建⼀个⾥程计供GMapping使⽤。
2.软硬件条件
软件:Ubuntu 18.04,ROS Melodic
硬件:RPLidar A1.
3.如何实现?
3.1 laser_scan_matche 源码安装及测试
  可能时本⼈菜,没有到laser_scan_matche的ROS安装⽅式,只能采⽤源码安装⽅式。
cd catkin_ws/src
git clone github/ccny-ros-pkg/scan_tools.git
cd ..
catkin_make // 会发现 fail, 此时进⼊到scan_tools/ ⽬录下把除laser_scan_matcher ⽬录之外的所有⽂件(夹)都删掉。
catkin_make //  此时⼜报错,如:CMake Error at /usr/share/cmake-3.10/ake:415
若是第9⾏报错,请参考“在编译laser_scan_matcher相关软件包,出现CMake Error at …” 解决。
安装完成后,输⼊下⾯的命令进⾏测试
roslaunch laser_scan_matcher demo.launch
3.2 运⾏Demo
  在~/turtlebot_ws/src/laser_scan_matcher/demo⽂件夹下,有launch⽂件demo_gmapping.launch,运
⾏该launch⽂件,会出现⽤bag数据的GMapping运⾏结果,我们对其进⾏修改,⽤激光数据替代bag数据,代码如下(可以直接替换)。
<!--
Example launch file: uses laser_scan_matcher together with
slam_gmapping
-->
<launch>
#### set up data playback from bag >>>>>####
<!--此处,⽤激光数据替换掉bag数据-->
<!--<param name="/use_sim_time" value="true"/>-->
<!--<node pkg="rosbag" type="play" name="play"
args="$(find laser_scan_matcher)/demo/demo.bag delay=5 clock"/>-->
<include file="$(find rplidar_ros)/launch/rplidar.launch"/>
#### publish an example base_link -> laser transform >>#
<node pkg="tf" type="static_transform_publisher" name="base_link_to_laser"
<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"/>
#### start rviz >>>>>>>>>###
<node pkg="rviz" type="rviz" name="rviz"
args="-d $(find laser_scan_matcher)/demo/demo_gmapping.rviz"/>
#### start the laser scan_matcher >>>>>>
cmake如何使用<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>
#### start gmapping >>>>>>>>####
<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>
[转载](blog.csdn/zhangkkit/article/details/109783934?
spm=1001.2101.3001.6650.1&utm_medium=distribute.-task-blog-2~default~_search_link&depth_1-utm_source=distribute.-task-blog-2~default~CTRLIST~default-
<_search_link&utm_relevant_index=2)

发表评论