站点建设方案,网络直播网站建设,做网站还得买域名吗,苏州 建设 公司 手机不同版本的Ubuntu都有对应的ROS版本#xff0c;不要强行安装不对应的版本#xff0c;否则遇到问题会很难找到解决方法。此教程也只是基于Ubuntu1604和kinetic版本的ROS。
一、基本流程
以下命令仅记录执行顺序#xff0c;不要无脑复制执行#xff0c;重在理解
#基本更新…不同版本的Ubuntu都有对应的ROS版本不要强行安装不对应的版本否则遇到问题会很难找到解决方法。此教程也只是基于Ubuntu1604和kinetic版本的ROS。
一、基本流程
以下命令仅记录执行顺序不要无脑复制执行重在理解
#基本更新
sudo apt update
sudo apt upgrade##添加ROS下载源
touch /etc/apt/sources.list.d/ros-latest.list
#阿里ros源将以下语句复制进ros-latest.list即可
deb https://mirrors.aliyun.com/ros/ubuntu/ xenial main#设置秘钥
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
#继续执行curl未安装的先安装curl
curl -sSL http://keyserver.ubuntu.com/pks/lookup?opgetsearch0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 | sudo apt-key add -安装ROS完整版,大概2G多需要等一会儿ros安装路径在/opt/ros/kinetic/
sudo apt install ros-kinetic-desktop-full二、rosdep
以上过程较为容易有不同之处百度下即可解决。下面要进行rosdep初始化可能会有一些问题但耐心仔细地跟着网上的教程走一般也能搞定。首先看问题
sudo rosdep init大概率会报以下错误 上面的命令其实就是从指定的地址下载一个文件如图中所示但由于国内科学上网的问题没法下载下来方法也很简单将需要的文件转移到一个能访问的地址就可以了或者更直接一点把文件及源码直接克隆到本地。
git clone https://github.com/ros/rosdistro.git如果这个也没法克隆就先利用码云从github导过来再克隆到本地克隆完成后,修改原来需要下载的文件因为那个文件作用也是指定其他文件地址很不幸也是几个访问不到的地址所以也要改为本地地址或能访问到的网络地址。
cd rosdistro/rosdep/sources.list.d/
vim 20-default.list20-default.list这个文件在执行完rosdep init后会被放到/etc/ros/rosdep/sources.list.d/下。 可以看到其内容是关于几个yaml文件网络位置的我们已经将整套源码包括这几个文件克隆到本地了所以可以改成本地地址只需要替换网络位置部分即可。修改前
# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead修改后不要无脑复制重在理解
# os-specific listings first rosdep update
yaml file:///home/lxh/rosdistro/rosdep/osx-homebrew.yaml osx# generic
yaml file:///home/lxh/rosdistro/rosdep/base.yaml
yaml file:///home/lxh/rosdistro/rosdep/python.yaml
yaml file:///home/lxh/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/lxh/rosdistro/releases/fuerte.yaml fuerte# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead根据以上经验只要涉及到无法访问的地址的文件都要改大概还有一下几个文件需要修改
/usr/lib/python2.7/dist-packages/rosdistro/__init__.py
/usr/lib/python2.7/dist-packages/rosdep2/rep3.py
/usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py需要修改的地方都包含一个我们无法访问的网络地址https://raw.githubusercontent.com直接搜索这个字符串就能找到修改的地方改后内容对应上述文件顺序
DEFAULT_INDEX_URL file:///home/lxh/rosdistro/index-v4.yaml
REP3_TARGETS_URL file:///home/lxh/rosdistro/releases/targets.yaml
FUERTE_GBPDISTRO_URL file:///home/lxh/rosdistro/releases/fuerte.yaml
DEFAULT_SOURCES_LIST_URL file:///home/lxh/rosdistro/rosdep/sources.list.d/20-default.list此时再执行
sudo rosdep init
rosdep update畅通无阻。
三、rosinstall
没什么难度了
##配置环境变量
echo source /opt/ros/kinetic/setup.bash ~/.bashrc
source ~/.bashrc##安装
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential四、测试小海龟
要打开窗口界面的所以需要在ubunutu16桌面打开终端执行需要三个终端
##相当于服务器给终端和控制端传递消息
roscore##小海龟终端
rosrun turtlesim turtlesim_node##小海龟控制端按下方向键控制小海龟
rosrun turtlesim turtle_teleop_key看到图像界面并且能进行控制说明测试通过安装完成。
博文参考1http://t.csdnimg.cn/I5F0D 博文参考2http://t.csdnimg.cn/bsZzU