< >
Home » ROS2入门教程 » ROS2入门教程-linux下apt安装ROS2 Dashing

ROS2入门教程-linux下apt安装ROS2 Dashing

说明

  • 在Linux环境下使用apt方式安装ROS2 Dashing

  • 测试环境:Ubuntu 18.04 + ROS2 Dashing

安装步骤

  • 设置语言环境
$ 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
  • 添加密钥
$ sudo apt update && sudo apt install curl gnupg2 lsb-release
$ curl http://repo.ros2.org/repos.key | sudo apt-key add -
  • 然后将存储库添加到源列表:
$ sudo sh -c 'echo "deb [arch=amd64,arm64] 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-dashing-desktop
  • 安装argcomplete
$ sudo apt install python3-argcomplete
  • Sourcing the setup script in .bashrc
$ echo "source /opt/ros/dashing/setup.bash" >> ~/.bashrc
  • 安装额外的中间件
$ sudo apt update
$ sudo apt install ros-dashing-rmw-opensplice-cpp # for OpenSplice
$ sudo apt install ros-dashing-rmw-connext-cpp # for RTI Connext (requires license agreement)
  • By setting the environment variable RMW_IMPLEMENTATION=rmw_opensplice_cpp you can switch to use OpenSplice instead. For ROS 2 releases Bouncy and newer, RMW_IMPLEMENTATION=rmw_connext_cpp can also be selected to use RTI Connext.

  • If you want to install the Connext DDS-Security plugins please refer to this page.

  • University, purchase or evaluation options are also available for RTI Connext.

测试使用

  • 新终端,运行talker例子
$ ros2 run demo_nodes_cpp talker
  • 新终端,运行listener例子
$ ros2 run demo_nodes_py listener

请输入图片描述

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: ros2入门教程