UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决

问题1 Could not find a package configuration file

问题1.1 ur_client_library

UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决

  Could not find a package configuration file provided by "ur_client_library"
  with any of the following names:

    ur_client_libraryConfig.cmake
    ur_client_library-config.cmake

  Add the installation prefix of "ur_client_library" to CMAKE_PREFIX_PATH or
  set "ur_client_library_DIR" to a directory containing one of the above
  files.  If "ur_client_library" provides a separate development package or
  SDK, be sure it has been installed.

解决:

注意下划线改为小短线

sudo apt-get install ros-melodic-ur-client-library

问题1.2 industrial_robot_status_interface

UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决

Could not find a package configuration file provided by
  "industrial_robot_status_interface" with any of the following names:

    industrial_robot_status_interfaceConfig.cmake
    industrial_robot_status_interface-config.cmake

  Add the installation prefix of "industrial_robot_status_interface" to
  CMAKE_PREFIX_PATH or set "industrial_robot_status_interface_DIR" to a
  directory containing one of the above files.  If
  "industrial_robot_status_interface" provides a separate development package
  or SDK, be sure it has been installed.

解决:

sudo apt-get install ros-melodic-industrial-robot-status-interface

问题2 ‘ur_msgs::SetPayload

UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决

 error: ‘ur_msgs::SetPayload::Request {aka struct ur_msgs::SetPayloadRequest_<std::allocator<void> >}’ has no member named ‘mass’

解决:

# 在工作区ur_ws下执行
git clone https://github.com/ros-industrial/ur_msgs.git src/ur_msgs

UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决
会提示有两个ur_msgs,把在universal_robot里面的删了,然后把新的ur_msgs放到universal_robot文件夹里面

问题3 No such file “load_ur3”

UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决
这个问题是在启动ur3_bringup.launch时产生的,因为新版的ur_ros_driverrobot_description_file使用的是load_ur3,但是universal_robot里的description文件夹里的名字是ur3_upload.launch

如下面所示,第11行,说明了要启动的description文件

<?xml version="1.0"?>
<launch>
  <arg name="debug" default="false" doc="Debug flag that will get passed on to ur_common.launch"/>
  <arg name="robot_ip" doc="IP address by which the robot can be reached."/>
  <arg name="reverse_port" default="50001" doc="Port that will be opened by the driver to allow direct communication between the driver and the robot controller."/>
  <arg name="script_sender_port" default="50002" doc="The driver will offer an interface to receive the program's URScript on this port. If the robot cannot connect to this port, `External Control` will stop immediately."/>
  <arg name="tf_prefix" default="" doc="tf_prefix used for the robot."/>
  <arg name="controllers" default="joint_state_controller scaled_pos_joint_traj_controller speed_scaling_state_controller force_torque_sensor_controller" doc="Controllers that are activated by default."/>
  <arg name="stopped_controllers" default="pos_joint_traj_controller joint_group_vel_controller" doc="Controllers that are initally loaded, but not started."/>
  <arg name="controller_config_file" default="$(find ur_robot_driver)/config/ur3_controllers.yaml" doc="Config file used for defining the ROS-Control controllers."/>
  <arg name="robot_description_file" default="$(find ur_description)/launch/load_ur3.launch" doc="Robot description launch file."/>
  <arg name="kinematics_config" default="$(find ur_description)/config/ur3/default_kinematics.yaml" doc="Kinematics config file used for calibration correction. This will be used to verify the robot's calibration is matching the robot_description."/>
  <arg name="headless_mode" default="false" doc="Automatically send URScript to robot to execute. On e-Series this does require the robot to be in 'remote-control' mode. With this, the URCap is not needed on the robot."/>

  <include file="$(find ur_robot_driver)/launch/ur_common.launch" pass_all_args="true">
    <arg name="use_tool_communication" value="false"/>
  </include>
</launch>

改/home/guyue/ur_ws/src/universal_robot/Universal_Robots_ROS_Driver/ur_robot_driver/launch的ur3_bringup.launch文件
load_ur3改为ur3_upload.launch

解决:
解决这个问题最正确的方法是删了现在的文件夹,建新的工作区,然后按照我下面这篇文章去重新下载一遍

还有一种方式是就在现有的这个文件夹内更新ur_description文件夹
下载地址:https://github.com/fmauch/universal_robot/tree/calibration_devel
注意分支是calibration_devel

只更新ur_description文件夹我不知道可不可以,我是把全部分支都git下来了
然后catkin_make的时候会报错,我把提示重复的文件夹删除了

问题4 could not have their rosdep keys resolved

to system dependencies
UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决

在运行rosdep install --from-paths src --ignore-src -y之后

ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies (ROS distro is not set. Make sure `ROS_DISTRO` environment variable is set, or use `--rosdistro` option to specify the distro, e.g. `--rosdistro indigo`):

解决:
在最开始说明ros版本

source /opt/ros/melodic/setup.bash

问题5 Action client not connected: scaled_pos_traj_controller/follow_joint_trajectory

UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决

[ WARN] [1624863539.203489625, 57.864000000]: Waiting for scaled_pos_joint_traj_controller/follow_joint_trajectory to come up
[ WARN] [1624863545.212986404, 63.864000000]: Waiting for scaled_pos_joint_traj_controller/follow_joint_trajectory to come up
[ERROR] [1624863551.221038108, 69.865000000]: Action client not connected: scaled_pos_joint_traj_controller/follow_joint_trajectory

解决:
这个是个很大的坑,首先要确定的是在/home/guyue/ur_ws/src/fmauch_universal_robot/ur3_moveit_config/config下的ros_controllers.yaml
name需要为scaled_pos_traj_controller,因为如果不是这个名字,是无法驱动实物机械臂的
看下面这张图,bringup启动的时候,他启动的是scaled_pos_traj_controller控制器
UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决

然后再回来说为什么启动gazebo,然后再启动moveit的时候会报这个错

看下面这张图
UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决
/home/guyue/ur_ws/src/fmauch_universal_robot/ur3_moveit_config/config下的ros_controllers.yaml

/home/guyue/ur_ws/src/fmauch_universal_robot/ur_gazebo/config下的ur3_controllers.yaml

这两个文件夹对这个控制器的名字不一样

如果把moveit下面的ros_controllers.yaml里的scaled_pos_traj_controller改为pos_traj_controller

gazebo和所有仿真都正常,但在驱动实物时又会出现问题,因为ur_ros_driver驱动里面所有控制器的名字都是scaled_pos_traj_controller

所以,最后应该是修改/home/guyue/ur_ws/src/fmauch_universal_robot/ur3_moveit_config/launch下的ur3_moveit_planning_execution.launchl
UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决因为gazebo和moveit里的分别是

# moveit
controller_list:
- name: "scaled_pos_joint_traj_controller"
  action_ns: follow_joint_trajectory
  type: FollowJointTrajectory
  joints:
    - shoulder_pan_joint
    - shoulder_lift_joint
    - elbow_joint
    - wrist_1_joint
    - wrist_2_joint
    - wrist_3_joint

# gazebo
pos_joint_traj_controller:
  type: position_controllers/JointTrajectoryController
  joints: &robot_joints
    - shoulder_pan_joint
    - shoulder_lift_joint
    - elbow_joint
    - wrist_1_joint
    - wrist_2_joint
    - wrist_3_joint

所以修改ur3_moveit_planning_execution.launchl

<remap if="$(arg sim)" from="/scaled_pos_joint_traj_controller/follow_joint_trajectory" to="/pos_joint_traj_controller/follow_joint_trajectory"/>

最后,因为ur的安装包和驱动一直在更新,所以注意下面几个文件里控制器的名称是否一致

  • gazebo里的文件

    • /home/guyue/ur_ws/src/fmauch_universal_robot/ur_gazebo/config文件夹下的ur3_controllers.yaml
    • /home/guyue/ur_ws/src/fmauch_universal_robot/ur_gazebo/launch文件夹下的ur3_bringup.launch
  • moveit的文件

    • /home/guyue/ur_ws/src/fmauch_universal_robot/ur3_moveit_config/config文件夹下的ros_controllers.yaml
    • /home/guyue/ur_ws/src/fmauch_universal_robot/ur3_moveit_config/launch文件夹下的ur3_moveit_planning_execution.launch
      最后的最后,2021年6月下载的fmauch版,moveit的部分不需要修改,只需要修改gazebo部分
      也就是说,只驱动真实机械臂,不仿真,是没有任何问题的

问题6 could not load controller

UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决参考:https://blog.csdn.net/weixin_43455581/article/details/106331325

sudo apt-get install ros-melodic-ros-control ros-melodic-ros-controllers

sudo apt-get install ros-melodic-force-torque-sensor-controller

问题7 打开的rviz没有画面

问题7.1 rviz没有画面

打开的rviz没有画面
UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决
解决:
https://github.com/UniversalRobots/Universal_Robots_ROS_Driver/issues/403

运行

roslaunch ur3_moveit_config moveit_rviz.launch rviz_config:=$(rospack find ur3_moveit_config)/launch/moveit.rviz

问题7.2 终端不能移动

接下来会发现终端不能移动
UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决
解决:
在下方选择manipilator而不是endeffector
UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决

问题7.3 一直循环动作

然后会发现点击execute后会一直循环动作

解决:
取消动作循环
UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决

问题8 Error in REST request或 Parser error

在运行gazebo时提示[Err] [REST.cc:205] Error in REST request
或者[Err] [ClientConfig.cc:270] Parser error [3]

UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决

UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决
解决:

  • 对于[Err] [ClientConfig.cc:270] Parser error [3](这个删除了,重新运行会再次生成的)
rm .ignition/fuel/config.yaml
  • 对于[Err] [REST.cc:205] Error in REST request
gedit .ignition/fuel/config.yaml

url: https://api.ignitionfuel.org改为 url: https://api.ignitionrobotics.org

问题9 Can’t accept new action goals. Controller is not running.

在规划路径后excu执行时报错
UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决

Can't accept new action goals. Controller is not running.

解决:
这一般应该是示教器的问题
参考<bots/Universal_Robots_ROS_Driver/issues/4>
如果示教器正常运行,会出现

[ INFO] [1624885305.373017515]: Robot requested program
[ INFO] [1624885305.373077772]: Sent program to robot
[ INFO] [1624885305.839015623]: Robot connected to reverse interface. Ready to receive control commands.

但是我示教器没有问题,是我在问题4那里把moveit下面的ros_controllers.yaml里的scaled_pos_traj_controller改为了pos_traj_controller
改回来就好了

问题10 ‘rqt_joint_trajectory_controller’ not found

UR机械臂学习(5-3):驱动ur机械臂实物——问题及解决

[rospack] Error: package 'rqt_joint_trajectory_controller' not found

解决:
安装

sudo apt-get install ros-melodic-rqt-joint-trajectory-controller ros-melodic-control-msgs ros-melodic-controller-manager-msgs ros-melodic-rospy ros-melodic-rqt-gui ros-melodic-rqt-gui-py ros-melodic-trajectory-msgs

先运行roscore,然后rosrun检查rqt中是否已经存在rqt_joint_trajectory_controller,如果找不到,输入以下代码:

rosrun rqt_joint_trajectory_controller rqt_joint_trajectory_controller --force-discover

然后就可以看到rqt_joint_trajectory_controller界面显示在桌面上。重新打开仿真系统(我正在用的是RViz),呼出rqt,即可以在Plugins->RobotTools上找到轨迹控制器。

上一篇:STM32F103RCT6移植到STM32F103C8T6注意事项


下一篇:UOJ632. 【UR #21】挑战最大团