包安装方法主要有两种:软件源安装和源码编译安装。软件源(Repository)为系统提供了一个庞大的应用程序仓库,只要通过简单的命令即可从仓库中找到需要安装的软件并完成下载安装。相反,源码编译安装相对来说比较复杂,需要手动解决软件的依赖关系。
Ubuntu系统允许restricted(不完全的自由软件)、universe(Ubuntu官方不提供支持与补丁,全靠社区支持)、multiverse(非自由软件,完全不提供支持和补丁)这三种软件源。
sources.list是Ubuntu系统保存软件源地址的文件,位于/etc/apt/目录下,在这一步中我们需要将 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 apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
确保包索引是最新的:
sudo apt update
检查cmake
的版本,尽量升级到最新版本
https://blog.csdn.net/RNG_uzi_/article/details/107016899
这里介绍桌面完整版(推荐): 包含 ROS、rqt、rviz、机器人通用库、2D/3D 模拟器、导航以及 2D/3D 感知包, 其他参考官方网站。
sudo apt install ros-melodic-desktop-full
sudo rosdep init
rosdep update
sudo rosdep init错误
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
解决办法1
打开hosts文件
sudo gedit /etc/hosts
#在文件末尾添加
151.101.84.133 raw.githubusercontent.com
#保存后退出再尝试
解决办法2
sudo c_rehash /etc/ssl/certs
sudo -E rosdep init
rosdep update
如果还是提示错误,请将源更更换为清华源,然后sudo apt update
(请将网络换成手机热点)
rosdep update出错
reading in sources list data from /etc/ros/rosdep/sources.list.d
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml]:
(https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml)
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
ERROR: error loading sources list:
The read operation timed out
运行:(网络换成手机热点,如果是time out,那就多尝试几次)
sudo apt-get update
sudo apt-get install python-rosdep
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
使用下面命令安装ROS插件(包括3D包围框)
sudo apt install ros-melodic-jsk-rviz-plugins
打开终端,输入roscore命令,可以看到ROS已经成功在ubuntu上运行起来。
sudo apt-get remove ros-melodic-*
致谢:
(原博客基础上添加问题报错解决措施)
https://blog.csdn.net/c417469898/article/details/106410305?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522159149658519195264521444%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=159149658519195264521444&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_ecpm_v3~pc_rank_v3-1-106410305.first_rank_ecpm_v3_pc_rank_v3&utm_term=ubuntu18.04+melodic%E5%AE%89%E8%A3%85%E4%B8%8E%E4%B8%8B%E8%BD%BD
https://www.cnblogs.com/wjundong/p/10701160.html