Ubuntu20.04安装ROS noetic 和 MoveIt

文章目录

  • 安装虚拟机
  • 20220125
  • 安装ROS
  • rosdep安装问题解决
    • 1.sudo rosdep init
      • 修改hosts
      • 手动添加20-default.list
    • 2.rosdep update一直timeout
      • 改时间
      • 改域名服务器
  • 安装MoveIt

安装虚拟机

VirtualBox安装Ubuntu 20.04.1 LTS

20220125

下面不需要看了,去这个链接看别人的

安装ROS

打开终端(Ctrl+Alt+T),安装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://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

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

source /opt/ros/noetic/setup.bash

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

接下来安装rosdep

sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential

sudo apt install python3-rosdep

sudo rosdep init
rosdep update

如需要看具体命令的作用看下方的链接。
官方文档:Ubuntu install of ROS Noetic
在Ubuntu20.04中安装ROS Noetic的方法

按照上述教程完成了那是最好的。。。
但是!哪有什么岁月静好。。。接下来我讲解一下我出现的问题。

rosdep安装问题解决

1.sudo rosdep init

sudo 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.

如果出现以上错误,可以看一下该链接rosdep init ROS安装问题解决方案
对于这里描述的四种方法,由于我使用的是台式电脑。。。所以方法一并没有尝试。

修改hosts

sudo gedit /etc/hosts

151.101.108.133 raw.githubusercontent.com

这里值得注意的是这个IP,由于这个IP是会改变的,所以不能完全按照教程来。按照你当前查找出来的IP换上去。
查IP地址
Ubuntu20.04安装ROS noetic 和 MoveIt_第1张图片
接下来,运行下面的来安装。如果没成功接着往下看。

sudo rosdep init
rosdep update

手动添加20-default.list

打开终端(Ctrl+Alt+T)

sudo passwd    # 接着提示输入UNIX密码,输入你的用户密码即可(第二次无需操作)
sudo su # 或者su root 然后输入密码切换至root用户
sudo mkdir -p /etc/ros/rosdep/sources.list.d # (第二次无需操作)
cd /etc/ros/rosdep/sources.list.d
sudo gedit 20-default.list

将以下内容复制进20-default.list文件中

# 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

然后

exit # 退出root用户
rosdep update

2.rosdep update一直timeout

改时间

打开终端(Ctrl+Alt+T)

sudo vim /usr/lib/python3/dist-packages/rosdep2/gbpdistro_support.py

这里需要了解一下vim

  1. 安装vim
sudo apt-get install vim-gtk
  1. vim命令
    搜索:/
    修改:i
    推出编辑:Esc
    保存并退出:wq
    锁定:Ctrl+S
    解锁:Ctrl+Q

利用vim的搜索功能输入/DOWNLOAD_TIMEOUT搜索,按i把数值修改为5000,然后保存并退出。
然后,如果还是报错接着往下看。

rosdep update

解决rosdep update一直timeout的问题

改域名服务器

如果根据上面的操作,出现类似如下错误的话。

bright@bright-VirtualBox:~$ rosdep update

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 [Errno 111] Connection refused> (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 [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml)

打开终端(Ctrl+Alt+T)

sudo gedit /etc/resolv.conf

将原有的nameserver这一行注释,并添加以下两行:

nameserver 8.8.8.8 # google域名服务器
nameserver 8.8.4.4 # google域名服务器

保存退出,执行

sudo  apt-get update
rosdep update

参考:ubuntu安装ROS进行到rosdep update时出现错误,如ERROR: unable to process source …

之后其实还是会报错的。所以不断的rosdep update直到完全安装,安装完如下。
也可以把那个DOWNLOAD_TIMEOUT再调大一点。
hahahahaha
Ubuntu20.04安装ROS noetic 和 MoveIt_第2张图片

如果会科学上网可能就没那么麻烦了哎。

安装MoveIt

安装

sudo apt-get install ros-noetic-moveit

启动验证

roslaunch moveit_setup_assistant setup_assistant.launch

你可能感兴趣的:(配置,ubuntu)