成都网站定制开发,建设销售网站的意义,佛山百度网站快速排名,陕西服装网站建设Ubuntu20.04安装ROS2 Foxy
实操安装
安装ROS2的教程在网上很多#xff0c;但是我操作之后都有问题#xff0c;大部分的问题是在 sudo apt update 时访问packages.ros.org无法成功#xff0c;主要的原因是没有外网#xff0c;而自己整一个外网代理又非常麻烦#xff0c;所…Ubuntu20.04安装ROS2 Foxy
实操安装
安装ROS2的教程在网上很多但是我操作之后都有问题大部分的问题是在 sudo apt update 时访问packages.ros.org无法成功主要的原因是没有外网而自己整一个外网代理又非常麻烦所以一般是通过设置国内源来实现
设置sources.list为国内源
修改 /etc/apt/sources.list里面的源为国内的
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo vim /etc/apt/sources.list如清华大学的源https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu-ports/ 注意一定要选择跟自己ubuntu版本匹配的源我的是ubuntu20.04对应的源是
# 默认注释了源码镜像以提高 apt update 速度如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiversedeb http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse
# deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse# 预发布软件源不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-proposed main restricted universe multiverse设置编码为UTF-8
locale
sudo apt update sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALLen_US.UTF-8 LANGen_US.UTF-8
export LANGen_US.UTF-8
locale添加ROS2的apt仓库到自己的系统
sudo apt install software-properties-common
sudo add-apt-repository universeapt-cache policy | grep universe更新并安装curl 、gnupg2 、lsb-release等软件
sudo apt update sudo apt install curl gnupg2 lsb-release与apt授权GPG密钥
sudo curl -verbose -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg如果这一步有问题参考https://blog.searchinfogo.com/2021/01/27/github-connection-refused/
添加ROS2仓库到自己的source.list
如果设置了科学上网可以执行如下命令
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如果无法科学上网需要将域名packages.ros.org替换为国内的镜像源的域名这里我替换为清华大学源域名mirrors.tuna.tsinghua.edu.cn建议最好替换一下
echo deb [arch$(dpkg --print-architecture) signed-by/usr/share/keyrings/ros-archive-keyring.gpg] http://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更新
sudo apt update
sudo apt upgrade安装ROS2-Foxy带ROS, RViz, demos, tutorials等
sudo apt install ros-foxy-desktop如果指向安装基础包执行以下指令
sudo apt install ros-foxy-ros-base默认情况下每次打开新shell终端时都必source安装文件执行
source /opt/ros/foxy/setup.bash可以将命令添加到shell启动脚本中后面就不需要再输入source /opt/ros/foxy/setup.bash
echo source /opt/ros/foxy/setup.bash ~/.bashrc测试安装结果
1、测试talker和listener
启动talker
ros2 run demo_nodes_cpp talker启动listener
ros2 run demo_nodes_py listener2、测试小海龟
打开终端创建海龟
ros2 run turtlesim turtlesim_node打开新终端创建鼠标控制
ros2 run turtlesim turtle_teleop_key参考
https://github.com/ya77ya/Installation-ROS-2-on-Jetson-Nano