如何在Ubuntu22.04中安装ROS2-Humble

如何在Ubuntu22.04中安装ROS2-Humble

1、首先先确认自己的Ubuntu版本

bash 复制代码
vm@vm:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.5 LTS
Release:	22.04
Codename:	jammy

2、设置语言环境

bash 复制代码
locale  # 检查是否支持 UTF-8
​
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
​
locale  # 验证设置是否成果

3、设置软件源

启动Ubuntu universe存储库

bash 复制代码
sudo apt install software-properties-common
sudo add-apt-repository universe

将ROS 2 apt存储库添加到系统,用apt授权我们的GPG密钥

bash 复制代码
sudo apt update && sudo apt install curl gnupg lsb-release -y
## 使用国内镜像(更快更稳定,推荐)
sudo curl -sSL https://mirrors.tuna.tsinghua.edu.cn/rosdistro/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg

将存储库添加到源列表

bash 复制代码
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

4、安装Humble

首先更新apt存储库缓存:

bash 复制代码
sudo apt update

然后升级已安装的软件(ROS2软件包建立在经常更新的Ubuntu系统上,在安装新软件包之前请确保您的系统是最新的):

bash 复制代码
sudo apt upgrade

安装桌面版ROS2(建议),包含:ROS、RViz、示例与教程,安装命令如下,如果需要安装其他版本,将下面命令中的humble替换对应的版本号:

bash 复制代码
sudo apt install ros-humble-desktop python3-argcomplete

安装colcon构建工具

bash 复制代码
sudo apt install python3-colcon-common-extensions

5、加载ROS2环境

永久加载(推荐,一劳永逸)

bash 复制代码
## 将初始化命令添加到您的 ~/.bashrc文件中,这样每次打开终端都会自动设置好 ROS 2 环境。
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
## 然后,让更改立即生效:
source ~/.bashrc

6、安装cartographer进行SLAM(额外的)

bash 复制代码
sudo apt install ros-humble-cartographer ros-humble-cartographer-ros
相关推荐
qq59184068534 分钟前
uiautomator2自动化安卓手机操作
python
80s7771 小时前
动态代理和静态代理的区别,动态代理怎么提高网络安全性
python
GG-_-Bond2 小时前
9.1 kv存储resp协议模拟面试
c++
niucloud-admin3 小时前
JAVA V6 多商户商城 开发文档——job 计划任务开发
java·python·github
米糕闯编程3 小时前
鱼香ros2(五)用C++编写节点
c++·ros2·cmakelists·鱼香
小叶肥辉3 小时前
LangChain链和LangGraph图的学习笔记【三】——分别用langchain_openai库和langchain_community库调用大模型
笔记·python·langchain
2401_873479403 小时前
IP属地为什么有时显示外省?用IP查询工具核查动态分配、运营商出口与GeoIP库
python·tcp/ip·ip
xiangyun614 小时前
【408数据结构 08】队列:循环队列判空判满,408年年考,一次讲清
c语言·开发语言·数据结构·c++·算法
xiangyun614 小时前
【408数据结构 06】双链表、循环链表、静态链表
c语言·开发语言·数据结构·c++·算法
OKkankan6 小时前
LangChain 能力详解!:输出解析、RAG、向量数据库与 Retriever 检索器
数据结构·python·langchain·ai应用