目前UR驱动真实机械臂的官网最新的驱动只适应ubuntu20.04,用ubuntu18.04编译会出现代码中一些函数报错的问题,报错结果如下图所示:
想要在melodic上正常运行,得找到之前的版本,具体流程如下:
# source global ros
source /opt/ros/melodic/setup.bash
# create a catkin workspace
mkdir -p catkin_ws/src && cd catkin_ws
# clone the driver
git clone -b debugging_tool https://github.com/UniversalRobots/Universal_Robots_ROS_Driver.git src/Universal_Robots_ROS_Driver
# clone fork of the description. This is currently necessary, until the changes are merged upstream.
git clone -b calibration_devel https://github.com/fmauch/universal_robot.git src/fmauch_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
其中,这句话
git clone -b debugging_tool https://github.com/UniversalRobots/Universal_Robots_ROS_Driver.git src/Universal_Robots_ROS_Driver
中的debugging_tool版本则是适用于melodic的。至此驱动包下载编译完成,此部分的参考文献:
如果在运行rosdep install --from-paths src --ignore-src -y时,遇到这样的问题:
ur_robot_driver: Cannot locate rosdep definition for [cartesian_trajectory_controller]
那么可执行sudo apt-get install ros-melodic-cartesian-trajectory-controller,即以sudo apt-get install ros-melodic-xx-xx的命令解决。
之后还需要在示教器上进行操作。此部分参考文献:
UR机械臂学习(5-1):驱动真实机械臂准备工作——示教器配置_ur示教盒操作指南-CSDN博客
这两篇文章都讲的挺详细的,但我建议最好还是去看github上的官方说明,那个更为可靠。
上面两个操作完成后,便可以对机械臂进行矫正和运行:
roslaunch ur_calibration calibration_correction.launch robot_ip:=192.168.x.x target_filename:="/home/xiongyi/Learning_Code/RobotGrasp/catkin_ws/my_robot_calibration.yaml"
roslaunch ur_robot_driver ur5e_bringup.launch robot_ip:=192.168.x.x kinematics_config:=/home/xiongyi/Learning_Code/RobotGrasp/catkin_ws/my_robot_calibration.yaml
roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch limited:=true
roslaunch ur5_moveit_config moveit_rviz.launch config:=true