1、官方代码包配置过程
官方地址:https://github.com/UniversalRobots/Universal_Robots_ROS_Driver?tab=readme-ov-file
1.1 目录
该存储库包含新的 ur_robot_driver 和几个帮助程序包,例如:
- ur_calibration:提取和转换机器人出厂校准信息的包,使其可用于 robot_description。
- ur_dashboard_msgs:用于与仪表板节点交互的消息定义。
- ur_robot_driver:实际驱动包;
1.2 前提条件
此驱动程序需要一个设置了ROS的系统。建议使用安装了ROS Noetic的Ubuntu 20.04。
为了确保机器人控制不受系统延迟的影响,强烈建议在系统中使用实时内核。有关设置实时内核的信息,请参阅实时设置指南。
1.3 从二进制包安装
- 安装ROS。该包仅支持ROS Noetic。如果你想在ROS 2中使用UR机械臂,请参阅ROS 2驱动程序。
- 使用
sudo apt install ros-melodic-ur-robot-driver
安装驱动;
1.4 源码安装
在从源代码构建之前,请确保你确实需要这样做。我们建议你从二进制包中安装驱动程序,除非你想参与开发并提交更改。
注意:该驱动程序由一个抽象机器人接口的C++库和一个基于该库的ROS驱动程序组成。由于该库可以在没有ROS支持的情况下构建,因此它不是一个catkin包,因此在工作区内构建时需要不同的处理方法。如果你想从源代码构建该库,请参阅下面的替代构建方法。
# source global ros
$ source /opt/ros/<your_ros_version>/setup.bash
# create a catkin workspace
$ mkdir -p catkin_ws/src && cd catkin_ws
# clone the driver
$ git clone https://github.com/UniversalRobots/Universal_Robots_ROS_Driver.git src/Universal_Robots_ROS_Driver
# clone the description. Currently, it is necessary to use the melodic-devel branch.
$ git clone -b melodic-devel https://github.com/ros-industrial/universal_robot.git src/universal_robot
# install dependencies
$ sudo apt update -qq
$ rosdep update
$ rosdep install --from-paths src --ignore-src -y
# build the workspace
$ catkin_make
# activate the workspace (ie: source it)
$ source devel/setup.bash
替代方案:全源构建【我个人采用全源代码构建的方式】
如果您还想从源代码构建库,请将库克隆到您的工作区中,并使用 catkin_make_isolated
或 catkin build
来构建它。
$ source /opt/ros/<your_ros_version>/setup.bash
$ mkdir -p catkin_ws/src && cd catkin_ws
$ git clone 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 melodic-devel https://github.com/ros-industrial/universal_robot.git src/universal_robot
$ sudo apt update -qq
$ rosdep update
$ rosdep install --from-paths src --ignore-src -y
$ catkin_make_isolated
$ source devel_isolated/setup.bash
2、为 ur_robot_driver 设置 UR 机器人
2.1 准备机器人
为了在实际机器人上使用 ur_robot_driver,您需要安装 externalcontrol-x.x.x.urcap,可以在这里找到。
有关安装必要的 URCap 并创建程序的详细信息,请参阅设置 CB3 机器人或设置 e-Series 机器人的相关教程。
要设置 e-Series 机器人上的工具通信,请参考工具通信设置指南。