1. ros安装相应包
1.1 安装相应包
- 采用纯源码编译方式
source /opt/ros/<your_ros_version>/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
sudo apt update -qq
rosdep update
rosdep install --from-paths src --ignore-src -y
catkin_make_isolated
source devel_isolated/setup.bash
注意:在执行rosdep相关指令时,可能会报错,可采用科学上网方式+proxychains。
1.2 修改控制器参数
- 找到/ur5_moveit_config/config/controllers.yaml 文件,name: 后添加 scaled_pos_joint_traj_controller
注意是ur5而不是ur5_e
1.3 设置电脑端的IP等
- PC与UR5示教器通过网线连接之后,设置如图的相关内容:
2. UR5端的设置
2.1 在UR5上安装urcap
该urcap位于Universal_Robots_ROS_Driver/ur_robot_driver的resources文件夹内。要安装此URCap,要求PolyScope的版本不得低于3.7。
- 步骤:
- externalcontrol-1.0.urcap拷贝到U盘中;
- U盘插入示教器中;
- 在ployscope的设置机器人中,点开URCap,找到externalcontrol-1.x.urcap,选中,然后点击重启。
编写程序
- 利用示教器编写程序:
- 安装完urcap,需要在“安装设置”中设置External Control的参数,hostip和hostname都是ros端设备的IP和name,端口号:50002.
- 之后新建一个程序,程序中加入该urcap,当需要与ros连接时,需要运行该程序。
网络设置
- 需要与ros的PC设置一致,但有所不同的是IP地址不一样
3. 操控真实机器人
3.1 使用Moveit进行控制
- 运行指令:
# 启动ur5驱动
roslaunch ur_robot_driver ur5_bringup.launch limited:=true robot_ip:=192.168.56.101
# 启动moveit
roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch limited:=true
# 启动rviz
roslaunch ur5_moveit_config moveit_rviz.launch config:=true