ROS+UR机械臂+Moveit+ 仿真与实体机械臂的使用+realsense相机+eye_handeye手眼标定(亲测有效)上

12 篇文章 4 订阅

Universal Robots(优傲机器人)公司是一家引领协作机器人全新细分市场的先驱企业,该公司成立于2005年,关注机器人的用户可操作性和灵活度,总部位于丹麦的欧登塞市,主要的机器人产品有:UR3、UR5和UR10,分别针对不同的负载级别。
Universal Robots早在2009年便推出了第一款协作机器人——UR5,自重18公斤,负载高达5公斤,工作半径85cm,不仅颠覆了人们对于传统工业机器人的认识,还自此定义了“协作机器人”的真正意义。除了安全度高、无需安全围栏等特点外,协作机器人还应该具备编程简单和灵活度高等特点,才能实现真正的人机和谐共事。

2015年3月推出的UR3是现今市场上最灵活轻便、并且可与工人一起肩并肩工作的台式机器人。它自重仅为11公斤,但是有效负载却高达3公斤,所有腕关节均可360度旋转,而末端关节可作无限旋转。UR 10的有效负载为10公斤,工作半径130cm。三款机器人均以编程的简易性、高度灵活性以及与人一起工作的安全可靠性而享誉业内。

一:安装ROS机器人操作系统

二:建立ros工作区

几个参考的网址(1) https://github.com/ros-industrial/universal_robot universal_robot
(2) https://github.com/ros-industrial/ur_modern_driver ur_modern_driver
installation
在此存储库中安装软件包有两种不同的方法。以下各节详细介绍了如何使用二进制发行版安装包,以及如何在Catkin工作区中从源代码构建包。
2.1方法以源码安装UR支持包
ROS中同样集成了Universal Robots机器人的功能包,使用如下命令即可安装,其中包含UR3、UR5、UR10三款机器人的相关功能:
sudo apt-get install ros-kinetic-universal-robots
(随不同的版本kinetic可以改变replace $ROS_DISTRO with hydro, indigo or kinetic, depending on which ROS version you have installed.

)
2.2方法二以源码的方式安装-建立ros_ur工作空间

In all other cases the packages will have to be build from sources in a Catkin workspace:

(1)cd $HOME/catkin_ws/src

#retrieve the sources (replace ‘$ROS_DISTRO’ with the ROS version you are using)
(2)git clone -b $ROS_DISTRO-devel https://github.com/ros-industrial/universal_robot.git

(3)cd $HOME/catkin_ws

#checking dependencies (again: replace ‘$ROS_DISTRO’ with the ROS version you are using)
(4)rosdep update
(5)rosdep install --rosdistro $ROS_DISTRO --ignore-src --from-paths src

#building
(6)catkin_make

#activate this workspace
(7)source $HOME/catkin_ws/devel/setup.bash
**(8)**在第六步前由于版本的原因需要更改universal_robot github的ur_driver驱动.将ur_modern_driver github下的驱动下在功能包下.然后重新编译…
在编译中会出现错误 参考链接 csdn链接描述 github链接描述
具体为/home/xxx/catkin_ws/src/ur_modern_driver/src/ur_hardware_interface.cpp:180:22: error: ‘const struct hardware_interface::ControllerInfo’ has no member named ‘hardware_interface’

将src/ur_hardware_interface.cpp中的

controller_it->hardware_interface (大概12处)
全部改为

controller_it->type
参考链接

三 运行真正的机器人UR

首先上命令行
真实UR
roslaunch ur_bringup ur5_bringup.launch robot_ip:=IP_OF_THE_ROBOT [reverse_port:=REVERSE_PORT]
roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch
roslaunch ur5_moveit_config moveit_rviz.launch config:=true

真实带有关节限制的UR
启动驱动
roslaunch ur_bringup ur5_bringup.launch limited:=true robot_ip:=IP_OF_THE_ROBOT [reverse_port:=REVERSE_PORT]
启动moveit规划
roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch limited:=true
启动rviz可视化界面
roslaunch ur5_moveit_config moveit_rviz.launch config:=true

要启动真正的机器人,请运行:
roslaunch ur_bringup ur5_bringup.launch robot_ip:=IP_OF_THE_ROBOT [reverse_port:=REVERSE_PORT]

MoveIt! with real Hardware
此外,您还可以使用MoveIt!控制机器人。
有它!两个机器人的配置包。
用于设置MoveIt!允许运行运动规划的节点:
roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch
用于使用包含MoveIt的配置启动RViz!运动规划插件运行:
roslaunch ur5_moveit_config moveit_rviz.launch config:=true

NOTE:
As MoveIt!!似乎很难找到具有所有关节限制[-2pi,2pi]的UR路径规划,有一个联合限制版本使用限制为[-pi,pi]的联合限制。要使用此联合受限版本,只需使用启动文件参数“limited”,即:
roslaunch ur_bringup ur5_bringup.launch limited:=true robot_ip:=IP_OF_THE_ROBOT [reverse_port:=REVERSE_PORT]

roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch limited:=true

roslaunch ur5_moveit_config moveit_rviz.launch config:=true

三Gazebo Rviz 中的UR机械臂仿真

首先上命令行

在gazebo中的仿真UR
启动gazebo中的UR
roslaunch ur_gazebo ur5.launch
启动moveit控制
roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch sim:=true
启动rviz可视化
roslaunch ur5_moveit_config moveit_rviz.launch config:=true

带有关节限制的,在gazebo中的仿真UR

roslaunch ur_gazebo ur5.launch limited:=true
roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch sim:=true limited:=true
roslaunch ur5_moveit_config moveit_rviz.launch config:=true

查看链接ros wiki
Usage with Gazebo Simulation
There are launch files available to bringup a simulated robot - either UR5 or UR10.
In the following the commands for the UR5 are given. For the UR10, simply replace the prefix accordingly.

Don’t forget to source the correct setup shell files and use a new terminal for each command!

To bring up the simulated robot in Gazebo, run:

roslaunch ur_gazebo ur5.launch

MoveIt! with a simulated robot
Again, you can use MoveIt! to control the simulated robot.

For setting up the MoveIt! nodes to allow motion planning run:

roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch sim:=true

For starting up RViz with a configuration including the MoveIt! Motion Planning plugin run:

roslaunch ur5_moveit_config moveit_rviz.launch config:=true

NOTE:
As MoveIt! seems to have difficulties with finding plans for the UR with full joint limits [-2pi, 2pi], there is a joint_limited version using joint limits restricted to [-pi,pi]. In order to use this joint limited version, simply use the launch file arguments ‘limited’, i.e.:

roslaunch ur_gazebo ur5.launch limited:=true

roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch sim:=true limited:=true

roslaunch ur5_moveit_config moveit_rviz.launch config:=true

使用以下命令启动UR5机器人的gazebo仿真环境:
$ roslaunch ur_gazebo ur5.launch
查看当前系统中的话题列表。

在这里插入图片描述
follow_joint_trajectory是MoveIt!最终规划发布的action消息,由机器人控制器端接收该消息后控制机器人完成运动。从上边的话题列表中,可以找到follow_joint_trajectory,由仿真机器人的控制器插件订阅。
打开启动的ur5.launch文件,可以看到以下代码段:

  <!-- start this controller -->
  <rosparam file="$(find ur_gazebo)/controller/arm_controller_ur5.yaml" command="load"/>
  <node name="arm_controller_spawner" pkg="controller_manager" type="controller_manager" args="spawn arm_controller" respawn="false" output="screen"/>

控制器管理节点controller_manager启动了一个arm_controller插件,该插件的配置可以查看arm_controller_ur5.yaml文件:

arm_controller:
 type:position_controllers/JointTrajectoryController
 joints:
    -shoulder_pan_joint
    -shoulder_lift_joint
    -elbow_joint
    -wrist_1_joint
    -wrist_2_joint
    - wrist_3_joint
constraints:
    goal_time: 0.6
    stopped_velocity_tolerance: 0.05
    shoulder_pan_joint: {trajectory: 0.1, goal: 0.1}
    shoulder_lift_joint: {trajectory: 0.1, goal: 0.1}
    elbow_joint: {trajectory: 0.1, goal: 0.1}
    wrist_1_joint: {trajectory: 0.1, goal: 0.1}
    wrist_2_joint: {trajectory: 0.1, goal: 0.1}
    wrist_3_joint: {trajectory: 0.1, goal: 0.1}
stop_trajectory_duration: 0.5
state_publish_rate:  25
action_monitor_rate: 10

从上边的配置信息中可以看到,arm_controller是一个JointTrajectory类型的控制器,接收follow_joint_trajectory中的轨迹信息后,完成机器人的运动控制。

使用MoveIt!控制UR机器人
ROS中类似于UR5这样的机械臂控制当然离不开MoveIt!,接下来我们就使用MoveIt!实现对gazebo中UR5的控制。

UR5的控制需要通过follow_joint_trajectory这个action接口实现,这就需要在MoveIt!端配置一个控制器插件,实现该接口的功能。该插件的配置在ur5_moveit_config中已经实现,可以查看ur5_moveit_config功能包中的controllers.yaml文件:

controller_list:
  - name: ""
    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

所以我们并不需要进行任何修改,使用如下命令启动MoveIt!和rviz,启动过程会包含所需要的控制器插件:

$ roslaunch ur5_moveit_config ur5_moveit_planning_execution.launch sim:=true
$ roslaunch ur5_moveit_config moveit_rviz.launch config:=true

realsense相机和 手眼标定
标定链接:https://blog.csdn.net/weixin_43735353/article/details/106128655

  • 1
    点赞
  • 34
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值