基於[移動機器人運動規劃及運動模擬],詳見之前的部落格
參考連結
環境配置
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