已经不知道失败了多少次了,反正有两位数了,太难了这波。

  • Ubuntu18.04安装

这个已经没要再说了,这里给一个链接吧
Ubuntu18.04镜像


  • ROS Melodic 安装
    • 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'

配置密钥,输入下述指令

sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
  • 3、更新资源库
sudo apt update

  • 4、安装,在这里选择桌面完整版
sudo apt-get install ros-melodic-desktop-full

然后就是无尽的等待,基本上半小时起步,上不封顶。。。(趁机摸鱼,后面就没得摸了)

  • 5、最坑的地方到了

执行下面命令

sudo apt-get install ros-melodic-rqt*
sudo rosdep init

然后你就会发现 “sudo: rosdep:找不到命令”
执行以下命令

sudo apt-get install python-rosdep

再执行下面命令

sudo rosdep init
rosdep update

然后你有发现:rosdep init报错:
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.

这个时候有两个解决方法
1. 使用小飞机,再运行该命令,如果过了就直接过了
2. 使用小飞机还不行,就直接自行建立路径和文件
在/etc目录下新建/ros/rosdep/sources.list.d/20-default.list文件(/etc下并没有/ros目录,需要依次逐级新建),将下面的内容复制到文件中。

# 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

然后就再去执行上面的命令,就又会发现错误 (一当接一当,当当不一样)

reading in sources list data from /etc/ros/rosdep/sources.list.d
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml]:
    <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml)
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml]:
    <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml)
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml]:
    <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml)
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml]:
    <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml)
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml]:
    Failed to download target platform data for gbpdistro:
    <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
ERROR: error loading sources list:
    <urlopen error <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)> (https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml)>

这个就得用小飞机了,如果是用的 VMware 虚拟机,请看这个教程
利用主机进行 VMware Ubuntu18.04 小飞机设置(是个PDF,具体为什么大家都清楚😜)

或者参考下面的链接
ROS:sudo rosdep init出错常规方法都无效后解决办法记录

当它终于结束了,还有一些善后的工作

安装rosinstall

sudo apt-get install python-rosinstall

加载环境设置文件

source /opt/ros/melodic/setup.bash

创建并初始化工作目录
ROS使用一个名为catkin的ROS专用构建系统。为了使用它,用户需要创建并初始化catkin工作目录,如下所示。除非用户创建新的工作目录,否则此设置只需设置一次。

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace

目前,只有src目录和CMakeLists.txt文件在catkin工作目录中,使用catkin_make命令来构建

cd ~/catkin_ws/
catkin_make

设置环境变量

sudo apt install net-tools
gedit ~/.bashrc
# Set ROS melodic
source /opt/ros/melodic/setup.bash
# Set ROS Network
export ROS_HOSTNAME=localhost
export ROS_MASTER_URI=localhost:11311

测试
打开三个终端,分别执行

roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key

然后你会发现又双叒叕报错了

解决方法如下

在每个终端都先执行

export ROS_HOSTNAME=localhost
export ROS_MASTER_URI=localhost:11311

再运行,就可以了

分类: 算法集

0 条评论

发表评论

Avatar placeholder

邮箱地址不会被公开。 必填项已用*标注