Ubuntu 22.04 系统中 ROS2安装

Ubuntu 22.04 系统中 ROS2安装

ROS2安装

bash 复制代码
# 多窗口终端工具
sudo apt update
sudo apt install tilix
  • 打开软件,点击右上角图标进入设置 -> General -> size120, columns:48
  • Command -> 勾选第一个 Run command as login shell
  • Color -> Theme Color 选择 Monokai Dark
bash 复制代码
sudo apt install python3-pip
bash 复制代码
# 设置地区语言:en-US
sudo apt update && sudo apt install locales
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
bash 复制代码
# 添加 universe 仓库
sudo apt install software-properties-common
sudo add-apt-repository universe
bash 复制代码
# 安装资源下载(curl)与密钥转换(gnupg2)依赖包
sudo apt update && sudo apt install curl gnupg2 -y
bash 复制代码
# 下载公钥,可能需要手动添加到系统
sudo curl -sSL https://gitee.com/tyx6/rosdistro/raw/master/ros.key -o /etc/apt/trusted.gpg.d/ros.gpg
  • 通过 Import Key File 手动添加
bash 复制代码
# 添加ros2安装包源
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/trusted.gpg.d/ros.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
bash 复制代码
# 如果安装出错,提示缺少python 的qt库,可以执行这一步试试
sudo apt --fix-broken install
bash 复制代码
# (可选项)安装ros开发工具
sudo apt update && sudo apt install ros-dev-tools
bash 复制代码
# 安装开发工具ros2软件
sudo apt update && sudo apt upgrade
# sudo apt install ros-<ros-distro>-desktop, 例如 iron
sudo apt install ros-iron-desktop
bash 复制代码
# 配置环境
echo """
# Replace ".bash" with your shell if you're not using bash
# Possible values are: setup.bash, setup.sh, setup.zsh
source /opt/ros/iron/setup.bash
""" >> ~/.bashrc

测试

bash 复制代码
source /opt/ros/iron/setup.bash
ros2 run demo_nodes_cpp talker
bash 复制代码
source /opt/ros/iron/setup.bash
ros2 run demo_nodes_py listener

卸载

bash 复制代码
# 查看环境
printenv | grep -i ROS
bash 复制代码
sudo apt remove ~nros-iron-* && sudo apt autoremove
bash 复制代码
sudo rm /etc/apt/sources.list.d/ros2.list
sudo apt update
sudo apt autoremove
# Consider upgrading for packages previously shadowed.
sudo apt upgrade
相关推荐
老秦包你会11 分钟前
Linux课程五课---Linux进程认识1
linux·运维·服务器
浩浩测试一下29 分钟前
网络安全实战指南:从安全巡检到权限维持的应急响应与木马查杀全(命令查收表)
linux·安全·web安全·ubuntu·网络安全·负载均衡·安全架构
我想吃余1 小时前
Linux学习笔记(一):Linux下的基本指令
linux·笔记·学习
刘某的Cloud1 小时前
openstack迁移虚机rbd报错,删除异常rbd
linux·运维·openstack·nova·rbd
啊吧怪不啊吧1 小时前
Linux权限概念讲解
linux·运维·服务器
跳跳糖炒酸奶2 小时前
第二章、Isaaclab强化学习包装器(1)
人工智能·python·算法·ubuntu·机器人
努力努力再努力wz2 小时前
【Linux实践系列】:进程间通信:万字详解命名管道实现通信
android·linux·运维·服务器·c++·c
Zfox_2 小时前
【Shell 脚本入门】轻松上手的实战指南
linux·服务器·运维开发·shell脚本
共享家95273 小时前
Linux调试器 - gdb使用指南
linux
华青水上3 小时前
第一节:Linux系统简介
linux·运维·服务器