ubuntu18.04安装ros-melodic

1.更新本地软件

sudo apt-get update

2.

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

3.

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

4.第二段代码后输入  Y,时间较长耐心等待。

sudo apt update
sudo apt install ros-melodic-desktop-full

5.

sudo rosdep init

发现如图所示错误

输入

sudo apt install python-rosdep2

再次输入sudo rosdep init


更新时可能出现以下问题

 可按下述方法解决,建议直接复制文中代码


github.com/ros/rosdistro网站下载压缩包,并且把文件名改为rosdistro,放到主目录下。

(1)修改这个包中rosdep/source.list.d/下的文件20-default.list 

把xxx改为自己的电脑名称,建议直接复制过去替换原文件。

# os-specific listings first
yaml file:///home/xxx/rosdistro/rosdep/osx-homebrew.yaml osx

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

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

(2)修改  /usr/lib/python2.7/dist-packages/rosdep2该文件夹下面的sources_list.py文件,把xxx改为自己的电脑名称。

# default file to download with 'init' command in order to bootstrap
# rosdep
DEFAULT_SOURCES_LIST_URL = 'file:///home/xxx/rosdistro/rosdep/sources.list.d/20-default.list'

# seconds to wait before aborting download of rosdep data

(3)修改以下两个文件里面的代码:

/usr/lib/python2.7/dist-packages/rosdep2/rep3.py
/usr/lib/python2.7/dist-packages/rosdistro/__init__.py

 样例如下:

/usr/lib/python2.7/dist-packages/rosdep2/rep3.py文件:
# location of targets file for processing gbpdistro files
REP3_TARGETS_URL = 'file:///home/xxx/rosdistro/releases/targets.yaml'

# seconds to wait before aborting download of gbpdistro data
/usr/lib/python2.7/dist-packages/rosdistro/__init__.py的文件:
# index information

DEFAULT_INDEX_URL = 'file:///home/xxx/rosdistro/index-v4.yaml'

def get_index_url():

修改完后就可以回到第5步继续安装了

6

rosdep update

7.

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

8.

sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential

9.验证是否安装成功,输入

roscore

发现如下错误

输入以下命令

sudo apt-get install ros-melodic-desktop
source ~/.bashrc

最后输入roscore发现成功,如下所示

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值