1、设置用户的串口读取权限
$ sudo usermod -a -G dialout your_user_name // your_user_name替换为实际用户名.
2、安装ROS依赖包
$sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
$sudo apt-get update
$sudo apt-get install ros-indigo-serial ros-indigo-turtlebot-rviz-launchers ros-indigo-move-base-msgs libghc-sdl-image-dev libsdl-image1.2-dev ros-indigo-navigation ros-indigo-slam-gmapping ros-indigo-teb-local-planner
$ sudo apt-get install git python-serial ros-indigo-serial g++
3、若还没有搭建Dashgo运行环境,便可直接执行以下操作:
$ mkdir -p ~/dashgo_ws/src
$ cd ~/dashgo_ws/src
4、下载 Dashgo SLAM 版本
$ git clone https://github.com/EAIBOT/dashgo.git
$ cd dashgo
$ git checkout slam_02
5、下载LMS100激光雷达驱动
$ cd ~/dashgo_ws/src
$ git clone https://github.com/ncnynl/LMS1xx.git
6、下载建图依赖包
$ git clone https://github.com/ros-perception/slam_gmapping.git
$ git clone https://github.com/ros-perception/openslam_gmapping.git
$ git clone -b indigo-devel https://github.com/ros-planning/navigation.git
7、复制gmapping_demo.launch文件来生成gmapping_lms100.launch文件
cp dashgo/dashgo_nav/launch/gmapping_demo.launch dashgo/dashgo_nav/launch/gmapping_lms100.launch
8、使用下面命令
$ gedit dashgo/dashgo_nav/launch/gmapping_lms100.launch
修改gmapping_lms100.launch文件内容如下
<launch>
<node name="arduino" pkg="dashgo_bringup" type="dashgo_driver.py" output="screen">
<rosparam file="$(find dashgo_bringup)/config/my_dashgo_params.yaml" command="load" />
</node>
<arg name="host" default="192.168.0.1" />
<node name="lms1xx" pkg="lms1xx" type="LMS1xx_node">
<param name="host" value="$(arg host)" />
</node>
<include file="$(find dashgo_description)/launch/dashgo_description.launch"/>
<node pkg="tf" type="static_transform_publisher" name="base_link_to_laser4" args="0.0 0.0 0.2 0.0 3.1415926 0.0 /base_link /laser_lms100 40" />
<include file="$(find dashgo_nav)/launch/gmapping.launch"/>
<include file="$(find dashgo_nav)/launch/move_base.launch"/>
</launch>
9、然后编译
$ cd ~/dashgo_ws/
$rosdep install --from-paths src --ignore-src -r -y
$ catkin_make
10、echo "source ~/dashgo_ws/devel/setup.bash" >> ~/.bashrc
11、创建串口
$ cd ~/dashgo_ws/src/dashgo/dashgo_bringup/startup
$sudo sh create_dashgo_udev.sh
12、使用下面命令来建图
建图指令:roslaunch dashgo_nav gmapping_lms100.launch
键盘控制:rosrun teleop_twist_keyboard teleop_twist_keyboard.py
开启rviz观察:roslaunch turtlebot_rviz_launchers view_navigation.launch
地图保存: roscd dashgo_nav/maps
mkdir ~/map
rosrun map_server map_saver -f ~/map/my_map