Ubuntu20.04 ROS1和ROS2同时安装及使用

举报
Hermit_Rabbit 发表于 2022/09/21 20:26:52 2022/09/21
【摘要】 0. 前言系统要求:Ubuntu20.04ROS安装版本: Noetic清华源配置sudo gedit /etc/apt/sources.list#清华源deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiversedeb https://mirrors.tuna.tsi...

0. 前言

系统要求:Ubuntu20.04

ROS安装版本: Noetic

清华源配置

sudo gedit /etc/apt/sources.list

#清华源
deb 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 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 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

1. ROS1安装

添加 sources.list(设置你的电脑可以从 packages.ros.org 接收软件.)

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list' 

添加 keys

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

安装ROS1桌面完整版

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

环境测试

source /opt/ros/noetic/setup.bash

补全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

2. ROS2安装

确保系统要支持 UTF-8:

sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 export LANG=en_US.UTF-8

设置软件源

sudo apt update
sudo apt install curl gnupg2 lsb-release

# 下面这条语句,我的输出错误: gpg: no valid OpenPGP data found
# curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
# 解决上面的问题,可以换成下面这条语句:
$ curl http://repo.ros2.org/repos.key | sudo apt-key add - 

# 之后再添加源:
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'

安装ROS2桌面完整版

sudo apt update
sudo apt install ros-foxy-desktop
sudo apt install python3-colcon-common-extensions

环境测试

source /opt/ros/foxy/setup.bash

自动补全工具

sudo apt update
sudo apt install python3-argcomplete
sudo apt update
sudo apt install ros-foxy-rmw-connext-cpp

安装ros1转换bridge

sudo apt update
sudo apt install ros-foxy-ros1-bridge

ROS1和ROS2混合配置

…详情请参照古月居

【声明】本内容来自华为云开发者社区博主,不代表华为云及华为云开发者社区的观点和立场。转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。