本文主要是介绍Ubuntu22.04 + ROS2 Humble的环境配置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Ubuntu22.04 + ROS2 Humble的环境配置
文章目录
- Ubuntu22.04 + ROS2 Humble的环境配置
- (1) Set locale
- (2) Setup Sources
- (3)安装ROS2
- (4)检查是否成功安装
参考官方网站ROS2-Installation
ROS2的各种版本及维护计划,可以参考ROS2-List of Distributions
(1) Set locale
首先检查UTF-8
的支持情况
locale # check for UTF-8sudo 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-8locale # verify settings
(2) Setup Sources
然后添加apt
源,
sudo apt install software-properties-common
sudo add-apt-repository universe
同时添加GPG-key
sudo apt update && sudo apt install curl -y
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 $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
(3)安装ROS2
首先进行upgrade
确保是最新的环境,
sudo apt update
sudo apt upgrade
然后,选择是否部分安装,这边建议安装desktop
版本,这就包含一些常用工具的安装比如RViz, Gazebo
等,这里就保留官方的解释:
Desktop Install (Recommended): ROS, RViz, demos, tutorials.
sudo apt install ros-humble-desktop
ROS-Base Install (Bare Bones): Communication libraries, message packages, command line tools. No GUI tools.
sudo apt install ros-humble-ros-base
Development tools: Compilers and other tools to build ROS packages
sudo apt install ros-dev-tools
经过漫长的等待,终于安装成功了。然后添加环境变量,这样就避免了每次都手动source
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
(4)检查是否成功安装
启动那个经典的turtle_sim
海龟模拟器,
ros2 run turtlesim turtlesim_node
然后新建另一个终端,
ros2 run turtlesim turtle_teleop_key
在这个终端里就能够用键盘的方向键来控制海龟的移动了。
这篇关于Ubuntu22.04 + ROS2 Humble的环境配置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!