自动驾驶系列之(7)ubuntu14.04(16.04)安装配置ROS indigo(kinetic)

一、安装ROS

1.配置Ubuntu仓库

打开Software&Updates,设置如下,选择清华源(tuna.tsinghua)或其他的国内源

自动驾驶系列之(7)ubuntu14.04(16.04)安装配置ROS indigo(kinetic)_第1张图片

2.添加ros源:

ubuntu14.04(ros indigo)

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list'

ubuntu16.04(ros kinetic)

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

3.设置密钥(key):

ubuntu14.04(ros indigo)

wget http://packages.ros.org/ros.key -O - | sudo apt-key add -

ubuntu16.04(ros kinetic)

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

4.更新源:

sudo apt-get update

5.安装ros完整版:

ubuntu14.04(ros indigo)

sudo apt-get install ros-indigo-desktop-full

ubuntu16.04(ros kinetic)

sudo apt-get install ros-kinetic-desktop-full

安装完成后,可以用下面的命令来查看可使用的包:

ubuntu14.04(ros indigo):

apt-cache search ros-indigo

 ubuntu16.04(ros kinetic)

apt-cache search ros-kinetic

 6.初始化rosdep,解决依赖:

sudo rosdep init
rosdep update

 7.初始化环境变量:

 ubuntu14.04(ros indigo)

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

ubuntu16.04(ros kinetic) 

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

 使环境变量设置立即生效:

source ~/.bashrc

8.安装一个非常常用的插件rosinstall:

sudo apt-get install python-rosinstall

查看ROS相關環境變量是否設置成功:

export | grep ROS

9.测试ROS是否安装成功:

roscore

二、创建ROS工作空间

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace(可不用)
cd ~/catkin_ws/
catkin_make
source devel/setup.bash

运行工作空间中的ROS节点要频繁使用source devel/setup.bash,将该命令加到.bashrc中,永久修改环境变量

echo "source ~/catkin_ws/devel/setup.sh" >> ~/.bashrc
source ~/.bashrc

 查看工作空间是否配置正确:

echo $ROS_PACKAGE_PATH

应输出:

ubuntu14.04(ros indigo):

/home/youruser/catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks

ubuntu16.04(ros kinetic) :

/home/alan/catkin_ws/src:/opt/ros/kinetic/share

#------------------------#

三、卸载Indigo

用apt-get方式安装indigo的,卸载使用如下命令:

sudo apt-get remove ros-indigo-*

卸载成功的效果:就是/opt下的ROS文件夹indigo被删除

 

参考:

http://www.jianshu.com/p/04be841e2293

http://www.ncnynl.com/archives/201608/497.html

 

问题:

key新旧问题导致sudo apt-get update失败

解决:https://answers.ros.org/question/325039/apt-update-fails-cannot-install-pkgs-key-not-working/

 

你可能感兴趣的:(自动驾驶)