ubuntu20.04安装ROS2记录
安装参考:
https://blog.csdn.net/hnuzcl/article/details/125025048
http://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html
一,更换镜像源
参考:https://blog.csdn.net/hnuzcl/article/details/125025048
二、开始安装
1.终端输入
locale
确定支持UTF-8
2.设置源
1)确保启用了Ubuntu Universe 存储库
apt-cache policy | grep universe
会输出这一行
如没有看到像上面那样的输出行,则输入启用 Universe 存储库
sudo apt install software-properties-common
sudo add-apt-repository universe
2)将 ROS 2 apt 存储库添加到系统
sudo apt update && sudo apt install curl gnupg2 lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
3)将存储库添加到源列表
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
3.安装ROS2包
1.更新apt
sudo apt update
sudo apt upgrade
2.桌面安装
sudo apt install ros-foxy-desktop
软连接出问题:
使用命令:
sudo ln -sf
sudo apt install ros-foxy-ros-base
source /opt/ros/foxy/setup.bash
三、测试
1.验证C++
终端输入
source /opt/ros/foxy/setup.bash
ros2 run demo_nodes_cpp talker
出现hello world就可以了
2.python验证
3.测试小乌龟
1)打开一个终端输入:
ros2 run turtlesim turtlesim_node
2)再开一个终端输入
source /opt/ros/foxy/setup.bash
ros2 run turtlesim turtle_teleop_key
鼠标点一下后面开的终端界面,然后就可以利用上下左右按键控制小乌龟运动了