树莓派3B+ubuntu mate 18.04和ROS安装以及相关问题解决

树莓派3B+ubuntu mate 18.04和ROS安装以及相关问题解决(亲测有效)

安装Ubuntu mate 18.04

官方下载地址https://ubuntu-mate.org/download/

  • 一定要选择experimental,因为64位系统在树莓派3B+上运行比32位流畅,我之前用32位也一直安装不上ROS。树莓派3B+ubuntu mate 18.04和ROS安装以及相关问题解决_第1张图片
  • 插入TF卡进行格式化,用电脑自带的格式化也行树莓派3B+ubuntu mate 18.04和ROS安装以及相关问题解决_第2张图片
  • 将系统烧录到TF卡中,点击Write进行烧录。注意:这个软件只能烧录IMG镜像,如果要烧录ISO镜像可以考虑用Etcher-Portable-1.4.6-x64树莓派3B+ubuntu mate 18.04和ROS安装以及相关问题解决_第3张图片
  • 将烧录好的TF卡插入树莓派通电根据提示一步一步安装就好了,傻瓜式操作,如果其他问题可以参考这篇文章

安装ROS

从官网上查看Ubuntu mate 18.04支持的ROS版本是Melodic。

根据之前安装kinetic的经验,先更换了国内源

中科大源

deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

清华源

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

阿里源

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

163源

deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

更换源时可以直接用管理员身份打开/etc/apt/sources.list进行更改,也可以通过vim进行替换。

vim方式:

sudo vim /etc/apt/sources.list

如果显示sudo:vim command not found就是没有安装vim。

输入sudo apt-get install vim安装即可。

进入vim后:%s/ports.ubuntu.com/mirrors.aliyun.com/g
将文件中ports.ubuntu.com更换成mirrors.aliyun.com,如果想用其他源把对应网址更换即可。

保存退出:wq

安装ROS

更新软件列表sudo apt-get update
更新软件包:sudo apt-get upgrade

我在更新软件列表时提示arm64_packages错误,然后我从对应网址手动下载包,解压至/var/lib/apt/lists/解决,
参考:https://blog.csdn.net/u011118482/article/details/78977817?utm_source=blogxgwz5

添加ROS源库
国外sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

国内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'

添加密钥sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

若显示NO_PUBKEY F42ED6FBAB17C654

则需要更改密钥sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654

桌面完整安装:ROS,rqt,rviz,机器人通用库,2D / 3D模拟器,导航和2D / 3D感知
sudo apt-get install ros-melodic-desktop-full

桌面安装:ROS,rqt,rviz和机器人通用库
sudo apt-get install ros-melodic-desktop

ROS基础:ROS包,构建和通信库,没有GUI工具
sudo apt-get install ros-melodic-ros-base

若碰到ROS包无法下载,可以参照上面的网站进行手动下载
若是依赖问题参考
https://blog.csdn.net/zzyczzyc/article/details/93492559

初始化rosdepsudo rosdep init
rosdep update
如果rosdep update失败的话,用手机热点轻松解决
设置环境变量

echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc

你可能感兴趣的:(树莓派)