Ubuntu18.04.6安装ROS(melodic)


melodic:wiki:>"http://wiki.ros.org/melodic/installation/ubuntu"
1.  添加ROS软件源:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
2.  添加密钥:
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
3.  安装ROS:
sudo apt update
sudo apt install ros-melodic-desktop-full
4.  初始化rosdep:
sudo rosdep init
rosdep update
如果失败:#打开hosts文件 sudo gedit /etc/hosts #在文件末尾添加151.101.84.133 raw.githubusercontent.com
国内网络>>>你懂的..最后面是解决办法.
5.  设置环境变量:
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
6.  安装rosinstall:
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential


现在是2023年4月28:修改sudo nano /etc/hosts >>151.101.84.133 raw.githubusercontent.com的方法已经不适用.
OS:>Ubuntu18.04.6.  ROS:>ros-melodic-desktop-full.
下面是解决办法:
参考下面文章
(
https://blog.csdn.net/zbw1185/article/details/123807654
文章是python3,我是python2
别问为啥是python2,不知道,感觉跟Ubuntu和ROS版本有关吧.
根据上面文章在python3里面找不到对应文件,在python2文件夹里面找到了.
修改后可以执行初始化rosdepde两条命令.
注意(吃过大亏了,能避坑,尽量避坑 懂python2的可能明白啥原因:这里不深究):
    1.路径千万别出现中文
    2.python2 里面也别出现任何中文 注释也不行..
)
1.  从github上下载rosdistro文件夹到本地.
我是打开/home文件夹在home新建 ROSDEP 在ROSDEP打开命令行:::
git clone https://github.com/ros/rosdistro
克隆后的地址(pwd):
/home/ROSDEP/rosdistro
2.  修改20-default.list文件,/home/xxx对应上面rosdistro下载到的目录,后面的步骤指的均是此目录
/home/ROSDEP/rosdistro/rosdep/sources.list.d/20-default.list
# os-specific listings first
yaml file:///home/ROSDEP/rosdistro/rosdep/osx-homebrew.yaml osx
# generic
yaml file:///home/ROSDEP/rosdistro/rosdep/base.yaml
yaml file:///home/ROSDEP/rosdistro/rosdep/python.yaml
yaml file:///home/ROSDEP/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/ROSDEP/rosdistro/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
3.  /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py
DEFAULT_SOURCES_LIST_URL = 'file:///home/ROSDEP/rosdistro/rosdep/sources.list.d/20-default.list'
4.  /usr/lib/python2.7/dist-packages/rosdep2/rep3.py
REP3_TARGETS_URL = 'file:///home/ROSDEP/rosdistro/releases/targets.yaml'
5.  /usr/lib/python2.7/dist-packages/rosdistro/__init__.py
DEFAULT_INDEX_URL = 'file:///home/ROSDEP/rosdistro/master/index-v4.yaml'
6.  执行rosdep update:
sudo rosdep init
rosdep update

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值