在ubuntu22.04上安装最新版的ros2,进入ros2官网:https://www.ros.org/blog/getting-started/
选择Humble Hawksbill进入安装说明。
一、安装必要的工具
sudo apt update && sudo apt install curl gnupg lsb-release
二、加入ros2的官方源
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)$(source /etc/os-release && echo $UBUNTU_CODENAME)| sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo update
三、开始安装
sudo apt install ros-humble-desktop
四、开始使用
1.
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_cpp talker
2.
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_py listener
最后,安装colcon编译工具
sudo apt install python3-colcon-common-extensions