ROS Kinetic安装记录

首先是对ROS Kinetic的安装步骤

  1. 首先在“软件与更新”下,勾选"restricted," “universe,” and "multiverse.
    ROS Kinetic安装记录_第1张图片
  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'
  1. 添加密钥
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
  1. 安装ROS
sudo apt update
sudo apt install ros-kinetic-desktop-full
  1. 环境设置
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
  1. rosinstall 相关依赖
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
  1. 初始化rosdep
sudo rosdep init
rosdep update
	7.1 Error:
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.

在可以访问到该网址的电脑上打开,将网页内容保存到如下路径

/etc/ros/rosdep/sources.list.d/20-default.list
	7.2 rosdep update网络原因失败
  1. 首先将下面仓库的内容clone到本地:
git clone https://github.com/ros/rosdistro.git
  1. 修改/usr/lib/python2.7/dist-packages/rosdep2/rep3.py文件
    将REP3_TARGETS_URL = ‘https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml’ 替换成 REP3_TARGETS_URL = ‘file:///home/rosdistro/releases/targets.yaml’
  2. 修改/usr/lib/python2.7/dist-packages/rosdistro/init.py文件
    将原来文件中的 DEFAULT_INDEX_URL = ‘https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml’ 替换成 DEFAULT_INDEX_URL = ‘file:///home/rosdistro/index-v4.yaml’
  3. 配置20-default.list文件
sudo gedit /etc/ros/rosdep/sources.list.d/20-default.list
# os-specific listings first
yaml file:///home/LiFeiHong/rosdistro/rosdep/osx-homebrew.yaml osx

# generic
yaml file:///home/LiFeiHong/rosdistro/rosdep/base.yaml
yaml file:///home/LiFeiHong/rosdistro/rosdep/python.yaml
yaml file:///home/LiFeiHong/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/LiFeiHong/rosdistro/releases/fuerte.yaml fuerte

# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

最后执行rosdep update

  1. 创建工作空间
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace

编译工作空间

cd ~/catkin_ws
catkin_make install

设置环境变量

source devel/setup.bash

检查环境变量

echo $ROS_PACKAGE_PATH

顺便记录下VMware Tools重新安装方法

1.关闭虚拟机;
2.在虚拟机设置分别设置CD/DVD、CD/DVD2和软盘为自动检测三个步骤;
3.再重启虚拟机,灰色字即点亮。
ubuntu桌面出现一个光盘文件,VMware Tools,提取出来

sudo ./vmware-install.pl

重启虚拟机

ROS和python版本之间的关系

ROS kinetic需要python = python2的运行环境;
一般的,首先删除当前python的软连接:

sudo rm /usr/bin/python

然后建立新的python软连接:

sudo ln -s /usr/bin/python2.7 /usr/bin/python

python3同理。
如果ROS产生了python3的依赖,建议创建一个虚拟环境,设置对应的虚拟环境路径:
例如:

export PYTHONPATH="/home/robot/anaconda3/envs/CV/lib/python3.6/site-packages:$PYTHONPATH"

你可能感兴趣的:(ROS,自动驾驶,ubuntu,视觉检测)