ROS2安装

1、版本选择

UbuntuROS1.0ROS2.0Gazebo
ROS2Go 1.016.04 LSTKinetic LTSArdent7.+
ROS2Go 2.018.04 LSTMelodic LTSDashing LST9.+
ROS2Go 3.020.04 LSTNoetic LTSFoxy LTS11.+

2、安装

ubuntu20.04-------------------------ROS2---------------------------------安装Foxy LST

2.1 安装ROS2

sudo apt update
sudo apt install ros-foxy-desktop

2.2 设置环境变量

source /opt/ros/foxy/setup.bash

出现警告:ROS_DISTRO was set to ‘noetic’ before. Please make sure that the environment does not mix paths from different distributions.

原因:安装了ROS1的noetic
解决方法:找到bashrc文件,注释noetic环境即可
在这里插入图片描述

2.3 安装自动补全工具

sudo apt install python3-argcomplete

2.4 测试安装结果

运行talke如下:

source /opt/ros/foxy/setup.bash
ros2 run demo_nodes_cpp talker

在这里插入图片描述

再打开一个终端运行listener如下:

source /opt/ros/foxy/setup.bash
ros2 run demo_nodes_cpp listener

在这里插入图片描述

回头看,轻舟已过万重山!