官方文档
Iron Irwini版本支持的平台如下:
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
sudo apt install software-properties-common
sudo add-apt-repository universe
现在用apt添加带ROS 2 GPG关键字
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
将存储库添加到源列表中
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update
sudo apt upgrade
sudo apt install ros-iron-desktop ros-iron-ros-base ros-dev-tools
在terminal 1 运行下面的指令:
source /opt/ros/iron/setup.bash
ros2 run demo_nodes_cpp talker
在terminal 2 运行下面的指令:
source /opt/ros/iron/setup.bash
ros2 run demo_nodes_py listener
sudo apt remove ~nros-iron-* && sudo apt autoremove
删除ROS2库:
sudo rm /etc/apt/sources.list.d/ros2.list
sudo apt update
sudo apt autoremove
# Consider upgrading for packages previously shadowed.
sudo apt upgrade