Ubuntu22.04搭建ros2 humble运行环境
区域语言设置
设置区域语言为US
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 update
sudo apt-get install -y libyaml-cpp-dev
sudo apt-get install -y libpcap-dev
sudo apt install -y curl gnupg lsb-release
更新远程仓库源
更新/etc/hosts
文件,防止raw.githubusercontent.com
被墙,可以通过nslookup
命令查看域名服务器地址
185.199.110.133 raw.githubusercontent.com
185.199.110.133 user-images.githubusercontent.com
185.199.110.133 avatars2.githubusercontent.com
185.199.100.133 avatars1.githubusercontent.com
20.205.243.166 github.com
如果已经添加过源,这一步也可以跳过
sudo curl -sSL http://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
安装humble
桌面版和基础版二选一
sudo apt install ros-humble-desktop # 桌面版
sudo apt install ros-humble-ros-base # 基础版
安装软件包
colcon和libbackward-ros都安装一下
sudo apt-get install python3-colcon-common-extensions
sudo apt-get install -y ros-humble-backward-ros
借用小乌龟来验证是否成功
source /opt/ros/humble/setup.bash
ros2 run turtlesim turtlesim_node
ros2 run turtlesim turtle_teleop_key
运行效果
完全卸载
如果你不想用humble这个版本,请用以下命令卸载干净
sudo apt-get autoremove --purge ros-humble-desktop
阅读剩余
版权声明:
作者:hywing
链接:https://iotstuff.cn/ubuntu2204-install-ros2-humble/
文章版权归作者所有,未经允许请勿转载。
THE END