ubuntu 18.04系统安装ROS Melodic的教程


系统Ubuntu 18.04

ROS版本 Melodic

 

1. 更改ROS源

  在清华TUNA的开源库中选择ROS

2. 按照教程开始进行操作

  http://wiki.ros.org/melodic/Installation/Ubuntu

 

  1.1不需要进行,apt源选择国内的镜像源,在/etc/apt/sources.list中修改成清华apt源即可

  1.2 点击Mirror链接,选择国内镜像

 

  选择USTC或者清华的都可以

  1.3-1.6按照指导进行即可,在1.6第一步安装完依赖条件后,进行初始化操作

  sudo apt install python-rosdep

  然后进行sudo rosdep init

  此时出现错误需要自行修改,详见:

  https://blog.csdn.net/super_sean/article/details/105433250?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase

  在/etc/ros/rosdep/sources.list.d/目录下新建20-default.list,直接添加下载好的内部路径

 

# os-specific listings first

#yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx

yaml file:///etc/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

 

yaml file:///etc/ros/rosdistro/master/rosdep/base.yaml

yaml file:///etc/ros/rosdistro/master/rosdep/python.yaml

yaml file:///etc/ros/rosdistro/master/rosdep/ruby.yaml

gbpdistro file:///etc/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

 

  此时再进入/usr/lib/python2.7/dist-packages/rosdistro/__init__.py,将下载网站链接修改为内部路径

#DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'

DEFAULT_INDEX_URL = 'file:///etc/ros/rosdistro/master/index-v4.yaml'

  需要的文件从下面云盘中直接下载,解压到/etc/ros目录下。需要超级权限。

    链接: https://pan.baidu.com/s/19OCXIUgZ1RNHV33noc1auw

    提取码: tnn9

  保存在/etc/ros/ 路径下(用sudo cp -r ~/rosdistro /etc/ros/)

  Ubuntu中的cp命令(https://blog.csdn.net/jiangyongy/article/details/78902966

  最后执行rosdep update,完成更新升级

 

3. 设置环境变量

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

  source ~/.bashrc

 

  将ros的启动文件添加到bash中,激活bash

 

4. ROS安装完成后运行小乌龟程序

  $roscore

  新开一个terminal,打开小乌龟窗口

  $rosrun turtlesim turtlesim_node

  新开一个terminal,打开小乌龟控制窗口,用方向键控制小乌龟运动

  $rosrun turtlesim turtle_teleop_key

  选中控制窗口按方向键即可看到小乌龟窗口中小乌龟运动

  再新开一个terminal,显示ROS图形化GUI,显示节点关系

  $rosrun rqt_graph rqt_graph

  如果正常运行,说明ROS安装成功

 

5. 其他参考

https://zhuanlan.zhihu.com/p/149707893


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM