ROS2学习(一):Ubuntu 22.04 安装 ROS2(Iron Irwini)

文章目录

      • 一、ROS2(Iron Irwini)介绍
      • 二、ROS2(Iron Irwini)安装
        • 1.设置编码
        • 2.使能代码库
        • 3.安装ROS2 Iron
      • 三、ROS2测试
      • 四、ROS2卸载

一、ROS2(Iron Irwini)介绍

官方文档
Iron Irwini版本支持的平台如下:
ROS2学习(一):Ubuntu 22.04 安装 ROS2(Iron Irwini)_第1张图片

二、ROS2(Iron Irwini)安装

1.设置编码

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

2.使能代码库

sudo apt install software-properties-common
sudo add-apt-repository universe

现在用apt添加带ROS 2 GPG关键字

sudo apt update && sudo apt install curl gnupg lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg

将存储库添加到源列表中

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

3.安装ROS2 Iron

sudo apt update
sudo apt upgrade
sudo apt install ros-iron-desktop   ros-iron-ros-base   ros-dev-tools

三、ROS2测试

在terminal 1 运行下面的指令:

source /opt/ros/iron/setup.bash
ros2 run demo_nodes_cpp talker

在terminal 2 运行下面的指令:

source /opt/ros/iron/setup.bash
ros2 run demo_nodes_py listener

ROS2学习(一):Ubuntu 22.04 安装 ROS2(Iron Irwini)_第2张图片

四、ROS2卸载

sudo apt remove ~nros-iron-* && sudo apt autoremove

删除ROS2库:

sudo rm /etc/apt/sources.list.d/ros2.list
sudo apt update
sudo apt autoremove
# Consider upgrading for packages previously shadowed.
sudo apt upgrade

你可能感兴趣的:(ros2,linux)