ROS2入门教程-在ubuntu20.04 apt安装ros2的foxy版本
ROS2入门教程-在ubuntu20.04下apt安装ros2的foxy版本
说明:
- 介绍如何在ubuntu20.04下apt安装ros2的foxy版本
步骤:
- 设置编码
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
- 添加key
sudo apt update && sudo apt install curl gnupg2 lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
- 添加ros源
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'
- 安装ros2
sudo apt update
sudo apt install ros-foxy-desktop
- 加载ros2
source /opt/ros/foxy/setup.bash
- 安装自动补全
sudo apt install python3-argcomplete
- 安装colcon和pip
sudo apt install python3-pip
sudo apt install python3-colcon-common-extensions
- 安装rmw-connext
sudo apt install ros-foxy-rmw-connext-cpp
- 安装ros1-bridge
sudo apt install ros-foxy-ros1-bridge
测试:
- 新开终端,发布话题
source /opt/ros/foxy/setup.bash
ros2 run demo_nodes_cpp talker
- 新开终端,订阅话题
source /opt/ros/foxy/setup.bash
ros2 run demo_nodes_py listener
删除:
- 命令:
sudo apt remove ros-foxy-* && sudo apt autoremove
- 或者命令:
sudo apt remove ros-foxy-desktop && sudo apt autoremove
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号