ROS与UR5机械臂建立通讯(附上遇到的坑)

系统环境:Ubuntu 14.04系统

need: 1. ros-indigo(Ubuntu16.04请安装ros-kinetic)

            2. ros包:universal_robot、 ur_modern_driver、 ros_control

1. ros-indigo安装

1. 安装方法参考创客智造,若出现unmet depend等等依赖的问题,使用一下命令:

sudo apt-get upgrade

2. 若出现一下错误:

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.

需输入以下命令,先安装python-rosdep和python-wstool

sudo apt-get install python-rosdep python-wstool

3. 使用catkin方式创建工作空间。

4. 教程走完后,使用gedit打开.bashrc文件:

sudo gedit ~/.bashrc

在文件末尾添加一行:

source /home/tx/catkin_ws/devel/setup.bash

2. universal_robot安装

universal_robot是ros的第三方包,其安装方法参考ros.org中的第三节来,注意选择合适ros版本分支clone。

注:若git clone速度过慢,可参考这篇博客。

3. ur_modern_driver安装

在终端输入以下指令

cd ~/catkin_ws/src/universal_robot/
git clone https://github.com/ros-industrial/ur_modern_driver.git
cd ..
catkin_make

4. ros_control安装

在终端输入以下指令

cd ~/catkin_ws/src
git clone -b indigo-devel https://github.com/ros-controls/ros_control.git
cd ..
catkin_make

5. 测试

电脑与机器人通过网线连接。确认机器人的IP,实验室机器人静态IP是192.168.1.102。

在终端输入以下命令

roslaunch ur_modern_driver ur5_bringup.launch limited:=true robot_ip:=192.168.1.102

若无报错,连接成功。输入以下命令在rviz中仿真并控制机器人:

roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch limited:=true
roslaunch ur5_moveit_config moveit_rviz.launch config:=true

 

你可能感兴趣的:(机器人)