文章目录
-
-
- [一、ROS2(Galactic Geochelone)介绍](#一、ROS2(Galactic Geochelone)介绍)
- [二、ROS2(Galactic Geochelone)安装](#二、ROS2(Galactic Geochelone)安装)
-
- [1. 设置语言环境](#1. 设置语言环境)
- [2. 配置ubuntu universe仓库](#2. 配置ubuntu universe仓库)
- [3. 配置ros2 apt仓库](#3. 配置ros2 apt仓库)
- [4. 安装ros2](#4. 安装ros2)
- [5. 安装情况测试](#5. 安装情况测试)
-
一、ROS2(Galactic Geochelone)介绍
二、ROS2(Galactic Geochelone)安装
1. 设置语言环境
bash
locale # check for 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 # verify settings
2. 配置ubuntu universe仓库
bash
sudo apt install software-properties-common
sudo add-apt-repository universe
3. 配置ros2 apt仓库
bash
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
sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'
sudo apt update && sudo apt upgrade
如果遇到 curl: (35) OpenSSL SSL_connect: Connection reset by peer in connection to raw.githubusercontent.com:443
报错,用以下方式解决
bash
在/etc/hosts里面加入
185.199.111.133 raw.githubusercontent.com
4. 安装ros2
bash
sudo apt -y install ros-galactic-desktop ros-galactic-ros-base ros-dev-tools
sudo apt upgrade
sudo rosdep init
rosdep update
5. 安装情况测试
在Ubuntu系统里面开两个终端,分别运行以下两个指令
bash
source /opt/ros/galactic/setup.bash
ros2 run demo_nodes_cpp talker
bash
source /opt/ros/galactic/setup.bash
ros2 run demo_nodes_py listener
效果: