1.安装slam_gmapping
$ cd ~/catkin_ws/src/
$ git clone https://github.com/ros-perception/slam_gmapping.git
$ git clone https://github.com/ros-perception/openslam_gmapping
$ cd ~/catkin_ws
$ catkin_make
$ source ~/catkin_ws/devel/setup.bash
2.启动turtlebot2和xbox手柄
$ roslaunch turtlebot_bringup minimal.launch
$ rosparam set /joystick/dev "/dev/input/js0" (默认js0)
$ roslaunch turtlebot_teleop xbox360_teleop.launch
3.启动slam_gmapping
$ rosrun tf static_transform_publisher 0 0 0 0 0 0 base_link laser 100
$ rosrun gmapping slam_gmapping
$ rosrun rviz rviz
4.rviz出图效果