ROS2 Galactic安装
- ROS2 Galactic安装
- 字体编码检查
- 添加ros2仓库到本机
- 安装ROS2系统
- 测试ROS
- 卸载ros2
ROS2 Galactic安装
字体编码检查
安装需要设置本级为UTF-8字体,使用如下指令检查:
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
检查如下
添加ros2仓库到本机
执行如下指令添加ros2仓库到本机:
sudo apt install software-properties-common
sudo add-apt-repository universe
sudo apt update && sudo apt install curl
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 $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
安装ROS2系统
sudo apt update
sudo apt upgrade
sudo apt install ros-galactic-desktop
sudo apt install ros-galactic-ros-base
sudo apt install ros-dev-tools
其中 ros-galactic-desktop 是完全体,包含ROS, RViz, demos, tutorials.
测试ROS
- 运行talker程序
source /opt/ros/galactic/setup.bash
ros2 run demo_nodes_cpp talker
- 运行listener程序
source /opt/ros/galactic/setup.bash
ros2 run demo_nodes_py listener
如下图所示,通信正常
卸载ros2
sudo apt remove ~nros-galactic-* && sudo apt autoremove
sudo rm /etc/apt/sources.list.d/ros2.list
sudo apt update
sudo apt autoremove
# Consider upgrading for packages previously shadowed.
sudo apt upgrade
参考官方文档:
https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html