当前位置:   article > 正文

ROS2开发笔记之ROS2 Humble环境安装_/home/x/ros2_humble/build/ros2doctor/ros2doctor/ap

/home/x/ros2_humble/build/ros2doctor/ros2doctor/api/__init__.py: 154: userwa

Ubuntu22.04安装ROS2 Humble (LTS)

1. 设置编码

$ 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
  • 1
  • 2
  • 3
  • 4

2. 添加源

$ 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 
> 国内用户,在上一步骤若失败可采用如下指令来解决:
$ sudo curl -sSL https://gitee.com/JCxiaohu/rosdistro/blob/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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

3. 安装ROS2

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install ros-humble-desktop
  • 1
  • 2
  • 3

4. 设置环境变量

只在当前终端生效

$ source /opt/ros/humble/setup.bash 
  • 1

打开终端均生效

$ echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc   
$ source ~/.bashrc
  • 1
  • 2

5. 实例测试

$ ros2 run turtlesim turtlesim_node
  • 1
$ ros2 run turtlesim turtle_teleop_key
  • 1

6. 参考资料

  • https://book.guyuehome.com/ROS2/1.%E7%B3%BB%E7%BB%9F%E6%9E%B6%E6%9E%84/1.3_ROS2%E5%AE%89%E8%A3%85%E6%96%B9%E6%B3%95/#ros2_1

  • http://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html

7. rosdep tool 安装功能包依赖(国内版)

安装

$ sudo apt-get install python3-pip 
$ sudo pip3 install rosdepc

$ sudo rosdepc init
$ rosdepc update
  • 1
  • 2
  • 3
  • 4
  • 5

使用

cd <工作空间目录>
rosdepc install --from-paths src --ignore-src --rosdistro <ROS_DISTRO> -r -y
# <ROS_DISTRO> = kinetic / melodic / noetic / ...
# or
rosdepc install --from-paths src --ignore-src -r -y
  • 1
  • 2
  • 3
  • 4
  • 5
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号