ROS(1)安装

12 篇文章 5 订阅

1. ros安装

1.1. 添加源

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'

1.2. 添加私钥

wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -
打不开则:
sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116

1.3. 更新软件列表

sudo apt-get update,会报GPG错误,解决办法是添加公钥:sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654

1.4. 安装ros

sudo apt-get install ros-melodic-desktop-full
安装目录在/opt/ros下。

1.5. 初始化

sudo rosdep init
rosdep update

1.5.1. 问题1

提示:sudo rosdep:找不到命令提示,执行下面指令:
sudo apt install python-rosdep

1.5.2. 问题2

提示:ERROR: cannot download default sources list from: https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list Website may be down.

  • 根本解决办法:(国产镜像)https://blog.csdn.net/qq_44938606/article/details/120968180
  • 解决办法1:
    打开https://site.ip138.com/raw.Githubusercontent.com/,输入raw.githubusercontent.com查询出一个可用的ip地址,然后在/etc/hosts文件最后添加:
    199.232.28.133 raw.githubusercontent.com
    151.101.228.133 raw.github.com
    结果可能不行,此时参考方法2.
  • 解决办法2:
    a.利用FQ特殊手段(可以直接拷贝此处的链接),打开链接https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list,拷贝其中的内容:
    #os-specific listings first
    yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
    # generic
    yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
    yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
    yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
    gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte
    # newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
    b.创建目录,新建文件20-default.list,将内容拷贝到文件中
    sudo mkdir -p /etc/ros/rosdep/sources.list.d
    touch /etc/ros/rosdep/sources.list.d/20-default.list
    c.执行rosdep update

1.6. 环境变量配置

放到~/.bashrc文件最后
source /opt/ros/melodic/setup.bash
然后执行source ~/.bashrc

1.7. 安装rosinstall

sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
安装ros插件sudo apt install ros-melodic-jsk-rviz-plugins

1.8. 测试小乌龟

  • 启动roscore roscore &
  • rosrun turtlesim turtlesim_node

1.9. 测试rviz

rosrun rviz rviz,发现报段错误,需要将export LIBGL_ALWAYS_INDIRECT=添加到.bashrc文件最后。

1.10. 卸载ros

sudo apt-get remove ros-melodic-*

1.11. 注意注意

建议启动新的节点时,将roscore重启一下,防止莫名其妙的错误!!

为了在Ubuntu 20.04上安装ROS1,您可以按照以下步骤进行操作: 1. 打开终端并执行以下命令以添加ROS软件仓库的公钥: ``` sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 ``` 2. 添加ROS软件仓库。执行以下命令将ROS软件仓库添加到系统源: ``` sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list' ``` 3. 更新系统软件包列表。执行以下命令以更新已添加的软件仓库: ``` sudo apt update ``` 4. 安装ROS。在Ubuntu 20.04上,可以通过以下命令安装ROS Noetic版本(ROS1的最新稳定版本): ``` sudo apt install ros-noetic-desktop-full ``` 5. 配置ROS依赖项。执行以下命令以初始化rosdep并更新其数据库: ``` sudo rosdep init && rosdep update ``` 现在,您已经成功地在Ubuntu 20.04上安装ROS1。您可以使用ROS命令行工具和库来开发和运行ROS应用程序。请确保按照您的需求和Ubuntu版本选择正确的ROS版本进行安装。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [【ROS】在 Ubuntu 20.04 安装 ROS 的详细教程](https://blog.csdn.net/PlutooRx/article/details/127558240)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [【ROS】Ubuntu20.04安装ROS1](https://blog.csdn.net/u010168781/article/details/131180874)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值