< >
Home » ROS2入门教程 » ROS2入门教程-在ubuntu24.04下apt安装ros2版本jazzy

ROS2入门教程-在ubuntu24.04下apt安装ros2版本jazzy

说明:

  • 介绍如何在ubuntu24.04下安装ros2版本jazzy
  • 测试环境:VMware workstation pro 15.5 系统:ubuntu24.04

方法一:RCM安装方法(推荐)

  • 安装RCM
curl https://www.ncnynl.com/rcm.sh | bash -
  • 执行命令:
rcm -si  install_ros2_now
  • 根据提示安装即可

方法二:分步步骤

  • 支持utf字符
    locale  # check for UTF-8
    
    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
    
    locale  # verify settings
  • 更新APT源
    rm superupdate.sh ; wget https://gitee.com/ncnynl/linux-scripts/raw/master/superupdate.sh ; sudo chmod +x ./superupdate.sh; sudo ./superupdate.sh aliyun
  • 增加key
  • 下载密钥
    sudo apt update && sudo apt install curl gnupg lsb-release
    sudo curl -sSL https://mirrors.tuna.tsinghua.edu.cn/rosdistro/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
  • 增加ros源到源列表
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] https://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
  • 安装ros包
  • 更新软件列表
    sudo apt update
  • 安装jazzy桌面版本
sudo apt install ros-jazzy-desktop
  • 加载环境
    source /opt/ros/jazzy/setup.bash
  • 安装自动补全
    sudo apt install python3-argcomplete
  • 安装colcon和pip
    sudo apt install python3-pip
    sudo apt install python3-colcon-common-extensions
  • 安装开发相关的包
sudo apt install ros-dev-tools

测试:

  • 新开终端,运行发布话题
    source /opt/ros/jazzy/setup.bash
    ros2 run demo_nodes_cpp talker
  • 新开终端,运行订阅话题
    source /opt/ros/jazzy/setup.bash
    ros2 run demo_nodes_py listener

删除:

  • 命令:
    sudo apt remove ~nros-jazzy-* && sudo apt autoremove 
  • 删除配置
    sudo rm /etc/apt/sources.list.d/ros2.list
    sudo apt update
    sudo apt autoremove

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

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


标签: ros2入门教程