文章目录
- 一、ROS2(Galactic Geochelone)介绍
- 二、ROS2(Galactic Geochelone)安装
- 1. 设置语言环境
- 2. 配置ubuntu universe仓库
- 3. 配置ros2 apt仓库
- 4. 安装ros2
- 5. 安装情况测试
一、ROS2(Galactic Geochelone)介绍
官方文档
二、ROS2(Galactic Geochelone)安装
1. 设置语言环境
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仓库
sudo apt install software-properties-common
sudo add-apt-repository universe
3. 配置ros2 apt仓库
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
报错,用以下方式解决
在/etc/hosts里面加入
185.199.111.133 raw.githubusercontent.com
4. 安装ros2
sudo apt -y install ros-galactic-desktop ros-galactic-ros-base ros-dev-tools
sudo apt upgrade
sudo rosdep init
rosdep update
5. 安装情况测试
在Ubuntu系统里面开两个终端,分别运行以下两个指令
source /opt/ros/galactic/setup.bash
ros2 run demo_nodes_cpp talker
source /opt/ros/galactic/setup.bash
ros2 run demo_nodes_py listener
效果: