ROS MELODIC
首先更换为清华源,jetson nano与双系统的ubantu不同,双系统通过(设置 -软件和更新-下载自 )更改为国内清华源。jetsonnano通过修改source.list具体代码步骤如下:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo gedit /etc/apt/sources.list
将其中内容全部删除,修改为:
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
sudo apt-get update
至此jetson nano部分配置完毕,接下来进行ros安装。
将下面这条命令复制到ubuntu的终端执行
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'
将下面这条命令复制到ubuntu的终端执行
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
出现如下界面,则表示成功
将以下命令复制到ubuntu的终端执行(在这里顺便说一下,如果用wifi更新慢或者失败的话,切换至手机热点,再执行下面的命令试一下)
sudo apt update
如果成功会出现如下界面
sudo apt install ros-melodic-desktop-full
输入后会出现如下界面
下载完成后出现如下界面(图片下载自别处,有些许不同)
首先安装依赖:
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
基本可以确定,这一步很重要。原版出现问题的如下( sudo apt install python3-rosinstall python3-rosinstall-generator python3-wstool)后来发现存在依赖,无法进行安装。不理解可以参看官网教程melodic/Installation/Ubuntu - ROS Wiki新版如上。
依赖安装完毕,输入终端如下:
sudo rosdep init
错误1:找不到命令
输入:
sudo apt install python-rosdep
(如果还是一样的报错,试试sudo apt install python-rosdep2)
错误2:ERROR: cannot download default sources list from:https :
//raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.listWebsite may be down.
输入以下命令:
sudo gedit /etc/hosts
然后在打开的hosts文件中添加如下的内容,然后保存退出
199.232.28.133 raw.githubusercontent.com
其中橙色部分不固定,域名一直在变化,登陆IPAdress网站https://www.ipaddress.com/输入raw.githubusercontent.com查询到真实IP地址,替换橙色部分。
错误3:ERROR: default sources list file already exists:
/etc/ros /rosdep/sources.list.d/20-default.listPlease delete if you wish to re-initialize
输入以下命令:
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list
到这里如果再输入sudo rosdep init命令试试,应该就会出现了之前介绍的我们想要的界面了
终端输入:
rosdep update
**************************************************************************************************************
如果成功了跳步骤(10),大概率失败,连接网络超时,具体应该是github与国内连接不稳定等原因。默认连接时间是15s,曾经改过好几分钟,该不成功就是不会成功,具体成功方法如下,无视网络原因。
git clone https://ghproxy.com/https://github.com/IntelRealSense/librealsense.git
(1)修改rosdep下载资源的脚本文件:/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py
把以下行添加到脚本中的download_rosdep_data()函数中,以应用代理服务:
url="https://ghproxy.com/"+url
(2)用同样的方法修改/usr/lib/python2.7/dist-packages/rosdistro/__init__.py
sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py
里面的DEFAULT_INDEX_URL参数,如下:
DEFAULT_INDEX_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
(3)以下4个文件中也使用了“raw.githubusercontent.com”网址,同样的方法把“GitHub Proxy 代理加速”添加到网址前:
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py #36行
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py #72行
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py #39行
sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/manifest_provider/github.py #68行 119行
(4)在 /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
的第204行添加如下代码:
gbpdistro_url = "https://ghproxy.com/" + gbpdistro_url
接下来再试一次
rosdep update
不出意外应该就成功了。大概需要三五分钟时间,会下载一些东西。
*************************************************************************************************************
终端输入:
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
使编译环境生效。
输入:
roscore
如果可以正常运行那么就okk了,如果依旧报错,再输入一遍:
sudo apt install ros-melodic-desktop-full
可能是某些东西没下全的原因,应该还会下载点东西,需要你输入y确认。再roscore一下应该就有了。至此ROS下载成功。
LD_LIBRARY_PATH=/opt/ros/indigo/lib
LD_LIBRARY_PATH=/opt/ros/indigo/lib
文章摘自:CSDN的博主和古月居的公众号,原链接如下。图片也均采自链接。亲测成功。
(4条消息) rosdep update 超时失败2021最新解决方法_WGH无疆的博客-CSDN博客_rosdep update
详细介绍如何在ubuntu20.04中安装ROS系统
melodic/Installation/Ubuntu - ROS Wiki