ubuntu 18.04 ROS melodic 版本安装配置记录 | 您所在的位置:网站首页 › 如何查看卸载软件的记录内容 › ubuntu 18.04 ROS melodic 版本安装配置记录 |
跟着古月·ROS入门21讲 | 一学就会的ROS机器人入门教程(www.bilibili.com/video/BV1zt411G7Vn)安装了ROS,记录一下过程,不然重装又得坑自己一遍。 我是新装的系统(不是新装的试过装melodic包时提示依赖包装不了),先改软件源,软件->右键标签->软件和更新, 添加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
安装ros完成后,初始化rosdep: sudo rosdep init 我安装的时候提示command not found/找不到命令 如果前面没办法成功下载到文件(毕竟有些学校连GitHub都给屏蔽了呢),rosdep init 也应该是没办法成功的。只能到 /etc/ros/rosdep/sources.list.d/ 目录下新建一个文件20-default.list,将下面的内容复制进去(230621rosdep命令下载的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继续执行: rosdep update 这个命令也是要尝试多次才能成功,我试到最后是能成功的,但init那个命令是真的试了好久都没成功,最后是网上找的内容直接写的文件。 成功状态如下图: 设置环境变量(如果ros的命令和包没办法自动补全就是这里没有设置好): echo "source /opt/ros/melodic/setup.bash">>~/.bashrc source ~/.bashrc 这里设置完成应该就能测试小海龟了。 安装rosinstall: sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential 创建工作空间: mkdir -p ~/catkin_ws/src cd ~/catin_ws/src catkin_init_workspace 编译工作空间:(个人认为这里编译不出错的话自己写的c++文件应该就不会在编译环境上面出问题) cd ~/catkin_ws/ catkin_make 设置环境变量(可以像上面一样直接写到.bashrc 中,这样登录时就能自动添加) source devel/setup.bash 剩下就是建包写代码了。 最后还有一个问题就是编译有时候会出现缺少某个ros包的情况,安装相应包需要在包名前面加‘ros-melodic-’(ros+版本号)。 |
CopyRight 2018-2019 实验室设备网 版权所有 |