目录
安装ur5e的驱动
参考:
博客:https://blog.csdn.net/bornfree5511/article/details/106546516
推荐查看官方的安装教程:https://github.com/UniversalRobots/Universal_Robots_ROS_Driver
Alternative: All-source build部分
第一步:
$ source /opt/ros/$ROS_DISTRO/setup.bash
source命令通常用于重新执行刚修改的初始化文件,使之立即生效,而不必注销并重新登录
改成:
$ source /opt/ros/kinetic/setup.bash
第二步:
$ mkdir -p catkin_ws/src && cd catkin_ws
-p用来创建多层不存在的路径
cd到工作空间下
第三步:
$ git clone -b boost https://github.com/UniversalRobots/Universal_Robots_Client_Library.git src/Universal_Robots_Client_Library
$ git clone https://github.com/UniversalRobots/Universal_Robots_ROS_Driver.git src/Universal_Robots_ROS_Driver
$ git clone -b calibration_devel https://github.com/fmauch/universal_robot.git src/fmauch_universal_robot
第四步:
$ ubuntu sudo apt update -qq
sudo update: 只检查, 不更新
sudo upgrade: 更新
第五步(问题较多):
$ rosdep update
这一步是出现问题的重灾区
运行rosdep update
和rosdep init
时会出现各种报错, 绝大多数情况下是因为网络的问题, 我尝试了下面几种办法解决掉,一定要有耐心, 多在网上找集中方法, 一个一个试下来肯定是可以的
解决1. 换源
首先可以尝试手动换源,我这里换成了阿里云的源
具体的方法看这篇博客
解决2:改变IP
改变raw.githubusercontent.com的IP地址
使用IP查询网站查询raw.githubusercontent.com的IP
命令行输入:
$ sudo gedit /etc/hosts
然后将原有的IP地址注释掉,然后改成查询到的IP地址
香港的最近不好使(2021年05月18日22:08:21)
美国的地址最近好使(2021年05月18日22:10:23)
解决3:(非常好用!)
如果以上方法还是不好用
可以尝试这篇博客里面的方法, 里面提供了一个百度云链接, 将里面的内容直接下载并解压到/etc/ros目录下;然后在更改/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
我进行到这里就已经成功了, 其他方法这篇博客里还有, 不过我没有尝试
此外我在网上还看到了其他的办法:
番外: 如何使用vim修改有权限的文件
无法打开并写入文件:
查看博客
: w ! sudo tee %
:wq
tee 用于读取输入文件,同时保存
%表示当前编辑文件
获取超级权限:su
然后复制至etc/ros 文件下
查看博客
没有权限修改制度文件怎么办呢?(20-default.list)
su进root权限
然后使用vim修改, 保存使用如上方法
解决n?
网上我还看到有两个方法:使用http5代理和使用一些奇怪的方法(博客1 && 博客2)
但是不建议使用, 需要绕很多的路, 挺麻烦的, 如果感兴趣可以单独抽出时间搞搞
但是有一个简单的办法:在火狐浏览器中搜索扩展程序可以解决一些网络问题, dddd,不知道会不会对这个问题有帮助
第六步
$ rosdep install --from-paths src --ignore-src -y
安装依赖的时候会出现
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
rbx1_speech: Cannot locate rosdep definition for [pocketsphinx]
解决办法查看这篇博客
这里改成:
$ rosdep install --from-paths ~/catkin_ws/src/Universal_Robots_ROS_Driver --ignore-src -r
第七步
$ catkin_make_isolated
注意不是catkin_make
第八步(安装成功)
$ source devel_isolated/setup.bash
一般没什么问题
进行到这里, UR的driver已经安装完成了!
总结
一套下来所有的命令如下(针对UR5e):
$ source /opt/ros/kinetic/setup.bash
$ mkdir -p catkin_ws/src && cd catkin_ws
$ git clone -b boost https://github.com/UniversalRobots/Universal_Robots_Client_Library.git src/Universal_Robots_Client_Library
$ git clone https://github.com/UniversalRobots/Universal_Robots_ROS_Driver.git src/Universal_Robots_ROS_Driver
$ git clone -b calibration_devel https://github.com/fmauch/universal_robot.git src/fmauch_universal_robot
$ ubuntu sudo apt update -qq
$ rosdep update
$ rosdep install --from-paths ~/catkin_ws/src/Universal_Robots_ROS_Driver --ignore-src -r
$ catkin_make_isolated
$ source devel_isolated/setup.bash
接下来配置示教器和PC的网络。