ROS从零开始快速搭建slam

1.安装ROS

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/$DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'

sudo apt-get update && sudo apt-get upgrade

sudo apt-get install ros-kinetic-desktop-full # Ubuntu 16.04

sudo apt-get install ros-kinetic-desktop

sudo rosdep init && rosdep update

echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc

sudo apt-get install python-rosinstall

2.安装gazebo7

sudo apt-get remove .*gazebo.* && sudo apt-get update && sudo apt-get install gazebo7 libgazebo7-dev
sudo apt-get install ros-kinetic-gazebo-ros-pkgs ros-kinetic-gazebo-ros-control

3.安装配置mooc示例代码

mkdir -p tutorial_ws/src
cd tutorial_ws/src
git clone https://gitee.com/Aistra/ROS-Academy-for-Beginners.git
cd ~/tutorial_ws
rosdep install --from-paths src --ignore-src --rosdistro=kinetic -y
cd ~/tutorial_ws
catkin_make
source ~/tutorial_ws/devel/setup.bash
echo "source ~/tutorial_ws/devel/setup.bash" >> ~/.bashrc
rospack profile

4.测试用例

roscore
roslaunch robot_sim_demo robot_spawn.launch
rosrun robot_sim_demo robot_keyboard_teleop.py

5.运行slam小车建图程序

roscore
roslaunch robot_sim_demo robot_spawn.launch
rosrun gmapping slam_gmapping
roslaunch slam_sim_demo view_slam.launch

 

你可能感兴趣的:(单片机,ROS)