基于[移动机器人运动规划及运动仿真],详见之前的博客
参考链接
环境配置
ubuntu 18.04
成果图
step1: 编写 launch 文件
mycar_ws/src/nav_demo/launch/nav01_slam_plus.launch
<launch>
<!-- 仿真环境下,将该参数设置为true -->
<param name="use_sim_time" value="true"/>
<!-- gmapping -->
<node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
<!-- 设置雷达话题 -->
<remap from="scan" to="scan"/>
<!-- 关键参数:坐标系 -->
<param name="base_frame" value="base_footprint"/><!--底盘坐标系-->
<param name="map_frame" value="map"/>
<param name="odom_frame" value="odom"/> <!--里程计坐标系-->
<param name="map_update_interval" value="5.0"/>
<param name="maxUrange" value="16.0"/>
<param name="sigma" value="0.05"/>
<param name="kernelSize" value="1"/>
<param name="lstep" value="0.05"/>
<param name="astep" value="0.05"/>
<param name="iterations" value="5"/>
<param name="lsigma" value="0.075"/>
<param name="ogain" value="3.0"/>
<param name="lskip" value="0"/>
<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="3.0"/>
<param name="resampleThreshold" value="0.5"/>
<param name="particles" value="30"/>
<param name="xmin" value="-50.0"/>
<param name="ymin" value="-50.0"/>
<param name="xmax" value="50.0"/>
<param name="ymax" value="50.0"/>
<param name="delta" value="0.05"/>
<param name="llsamplerange" value="0.01"/>
<param name="llsamplestep" value="0.01"/>
<param name="lasamplerange" value="0.005"/>
<param name="lasamplestep" value="0.005"/>
</node>
<node pkg="joint_state_publisher" name="joint_state_publisher" type="joint_state_publisher" />
<node pkg="robot_state_publisher" name="robot_state_publisher" type="robot_state_publisher" />
<node pkg="rviz" type="rviz" name="rviz" args="-d $(find nav_demo)/config/nav_test.rviz"/>
</launch>
mycar_ws/src/nav_demo/launch/nav07_slam_auto.launch
<!-- 集成SLAM与导航,实现机器人自主移动的地图 -->
<launch>
<!-- 启动SLAM节点 -->
<include file="$(find nav_demo)/launch/nav01_slam_plus.launch" />
<!-- 运行move_base节点 -->
<include file="$(find nav_demo)/launch/nav05_path.launch" />
</launch>
step2: 编译+启动 gazebo 仿真环境
source ./devel/setup.bash
roslaunch mycar environment.launch
step3: 编译+启动 rviz
source ./devel/setup.bash
roslaunch nav_demo nav06_test.launch