gazebo中配置robotiq

  • 1.下载功能包
    • 1.UR机器人功能包下载
    • 2.Robotiq功能包下载
      • 插件修改
  • 2.gazebo仿真所需代码
    • 1.修改urdf文件
    • 2.创建yaml文件
    • 3.创建launch文件
  • 3.UR5和robotiq85结合
    • 1.修改ur5的urdf文件
    • 2.修改launch文件
    • 3.运行launch文件查看效果

最原始的ros-industrial提供的robotiq夹爪的功能包,是不能用在gazebo中仿真的,只能在rviz中可视化,原因就是其urdf文件,或者说xacro文件中缺少在gazebo中需要的东西。下面就具体说一下应该修改哪些文件:

1.下载功能包

1.UR机器人功能包下载

github地址:https://github.com/ros-industrial/universal_robot/tree/melodic-devel
这个是Ubuntu18.04+ROS melodic版本的,如果需要其他版本请在分支中选择。
下载完成后记得编译工作空间。

2.Robotiq功能包下载

这里有两种版本的功能包
建议使用下面经过修改后的功能包。
这个是经过修改的:https://github.com/MetaMemoryT/robotiq_85_gripper-1
这个是ros-industrial的:https://github.com/ros-industrial/robotiq
我用的是修改过的,也就是第一个仓库中的,因为ros-industrial那个在使用robotiq_2f_85_gripper_visualization功能包时,其中的夹爪基座的dae文件是不正确的,在仓库的issue中也有人修改过,但是我还是没有修改成功,就用了另外一个仓库的功能包。而且这个包的好处就是支持在gazebo中仿真,因为作者已经修改好了xacro文件,添加了gazebo仿真必需的部分。

插件修改

由于在robotiq夹爪中有几个关节是被动关节(mimic joint),标准Gazebo不支持Mimic 关节仿真, 所以需要安装一个插件。第一个功能包中用到了这个插件,如果出问题就用下面这个仓库中的代码代替:https://github.com/roboticsgroup/roboticsgroup_gazebo_plugins
这个仓库含有的插件很全:https://github.com/JenniferBuehler/gazebo-pkgs
下载好之后记得编译。

2.gazebo仿真所需代码

下面来说一下如果下载的是最原始版本的代码,如何修改。(如果使用的是第一个经过修改的代码,这部分请略过)

1.修改urdf文件

找到robotiq_2f_140_gripper_visualization/urdf/robotiq_arg2f_transmission.xacro这个文件,修改为:

<?xml version="1.0"?>
<robot xmlns:xacro="http://ros.org/wiki/xacro"><xacro:macro name="robotiq_arg2f_transmission" params="prefix"><transmission name="${prefix}finger_joint_trans"><type>transmission_interface/SimpleTransmission</type><joint name="${prefix}finger_joint"><hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface></joint><actuator name="${prefix}finger_joint_motor"><mechanicalReduction>1</mechanicalReduction></actuator></transmission><gazebo><!-- loading plugin: mimic joints works in gazebo now--><plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="${prefix}mimic_robotiq_85_4"><joint>${prefix}finger_joint</joint><mimicJoint>${prefix}right_outer_knuckle_joint</mimicJoint><multiplier>1.0</multiplier></plugin><plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="${prefix}mimic_robotiq_85_2"><joint>${prefix}finger_joint</joint><mimicJoint>${prefix}left_inner_finger_joint</mimicJoint><multiplier>-1.0</multiplier><!--<offset>0.0</offset>--></plugin><plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="${prefix}mimic_robotiq_85_1"><joint>${prefix}finger_joint</joint><mimicJoint>${prefix}right_inner_finger_joint</mimicJoint><multiplier>-1.0</multiplier></plugin><plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="${prefix}mimic_robotiq_85_3"><joint>${prefix}finger_joint</joint><mimicJoint>${prefix}left_inner_knuckle_joint</mimicJoint><multiplier>1.0</multiplier></plugin><plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="${prefix}mimic_robotiq_85_5"><joint>${prefix}finger_joint</joint><mimicJoint>${prefix}right_inner_knuckle_joint</mimicJoint><multiplier>1.0</multiplier></plugin></gazebo></xacro:macro></robot>

如果运行时有报错Deprecated syntax, please prepend ‘hardware_interface/’ to ‘PositionJointInterface’ within the tag in joint ‘finger_joint’
就把上面文件中的

<hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>

改成

<hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>

单独仿真夹爪时,需要用到ros-control,在此文件中添加:

<gazebo> <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so"> <robotNamespace>/</robotNamespace> <legacyModeNS>true</legacyModeNS> </plugin></gazebo>)

和ur机器人连接到一块时,一定要删掉这段!

2.创建yaml文件

在gazebo中仿真夹爪,要给它控制参数,即PID参数,在robotiq_2f_85_gripper_visualization下创建config文件夹,在config下创建gazebo_controller.yaml文件,把下面代码复制进去:

# Note: You MUST load these PID parameters for all joints that are using the
# PositionJointInterface, otherwise the arm + gripper will act like a giant
# parachute, counteracting gravity, and causing some of the wheels to lose
# contact with the ground, so the robot won't be able to properly navigate. See
# https://github.com/ros-simulation/gazebo_ros_pkgs/issues/612
gazebo_ros_control:pid_gains:# these gains are used by the gazebo_ros_control pluginfinger_joint:p: 20.0i: 0.1d: 0.0i_clamp: 0.2antiwindup: falsepublish_state: true# the following gains are used by the gazebo_mimic_joint pluginleft_inner_knuckle_joint:p: 20.0i: 0.1d: 0.0i_clamp: 0.2antiwindup: falsepublish_state: trueleft_inner_finger_joint:p: 20.0i: 0.1d: 0.0i_clamp: 0.2antiwindup: falsepublish_state: trueright_outer_knuckle_joint:p: 20.0i: 0.1d: 0.0i_clamp: 0.2antiwindup: falsepublish_state: trueright_inner_knuckle_joint:p: 20.0i: 0.1d: 0.0i_clamp: 0.2antiwindup: falsepublish_state: trueright_inner_finger_joint:p: 20.0i: 0.1d: 0.0i_clamp: 0.2antiwindup: falsepublish_state: true

继续在config下创建gripper_controller_robotiq.yaml文件:

gripper_controller:type: position_controllers/JointTrajectoryControllerjoints:- finger_jointconstraints:goal_time: 0.6stopped_velocity_tolerance: 0.05finger_joint: {trajectory: 0.01, goal: 0.01}stop_trajectory_duration: 0.5state_publish_rate:  25action_monitor_rate: 10

继续在config下创建joint_state_controller.yaml文件:

joint_state_controller:type: joint_state_controller/JointStateControllerpublish_rate: 50

3.创建launch文件

robotiq_2f_85_gripper_visualization/launch文件夹下创建gripper_gazebo.launch文件:

<?xml version="1.0" ?><launch><param name="robot_description" command="$(find xacro)/xacro --inorder $(find robotiq_2f_85_gripper_visualization)/urdf/robotiq_arg2f_85_model.xacro" /><!-- Load gazebo controller configurations --><!-- Note: You MUST load these PID parameters for all joints that are usingthe PositionJointInterface, otherwise the arm + gripper will act like agiant parachute, counteracting gravity, and causing some of the wheelsto lose contact with the ground, so the robot won't be able to properlynavigate. Seehttps://github.com/ros-simulation/gazebo_ros_pkgs/issues/612 --><rosparam file="$(find robotiq_2f_85_gripper_visualization)/config/gazebo_controller.yaml" command="load" /><!-- Gazebo --><include file="$(find gazebo_ros)/launch/empty_world.launch"><arg name="paused" value="false" /></include><!-- Spawn the robot into Gazebo --><node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -model robot -x 0 -y 0 -z 0.1" /><!-- Load ros_control controller configurations --><rosparam file="$(find robotiq_2f_85_gripper_visualization)/config/joint_state_controller.yaml" command="load" /><rosparam file="$(find robotiq_2f_85_gripper_visualization)/config/gripper_controller_robotiq.yaml" command="load" /><!-- Start the controllers --><node name="controller_spawner" pkg="controller_manager" type="spawner" output="screen" ns="/" args="joint_state_controller gripper_controller"/><!-- Robot state publisher --><node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" output="screen" />
<node name="gui_controller" pkg="rqt_joint_trajectory_controller" type="rqt_joint_trajectory_controller" />
</launch>

 其中最后调用的rqt_joint_trajectory_controller是一个工具,可以实时发布并控制机器人各关节的角度,如果没安装可以使用sudo apt-get install ros-melodic-joint-trajectory-controller来安装。
 编译之后, 用roslaunch robotiq_2f_85_gripper_visualization gripper_gazebo.launch命令就可以在gazebo中看到夹爪了(后面再放截图)。

3.UR5和robotiq85结合

这里需要修改ur5的描述文件

1.修改ur5的urdf文件

找到universial_robot/ur_description/urdf/文件夹,新建一个ur5_robot_robotiq85_gripper.urdf.xacro文件或直接复制ur5_robot.urdf.xacro,然后把名字改成这个也可以。这个文件中包含如下代码:
可以对比下和原来的文件相比增加了哪些代码。

<?xml version="1.0"?>
<robot xmlns:xacro="http://wiki.ros.org/xacro" name="ur5" ><xacro:arg name="transmission_hw_interface" default="hardware_interface/PositionJointInterface"/><!-- common stuff --><xacro:include filename="$(find ur_description)/urdf/common.gazebo.xacro" /><!-- ur5_robotiq85_gripper --><xacro:include filename="$(find ur_description)/urdf/ur5.urdf.xacro" /><xacro:include filename="$(find robotiq_85_description)/urdf/robotiq_85_gripper.urdf.xacro" /><!-- arm --><xacro:ur5_robot prefix="" joint_limited="false"transmission_hw_interface="$(arg transmission_hw_interface)"/><!--robotiq_85_gripper--><xacro:robotiq_85_gripper prefix="" parent="ee_link"/><link name="world" /><joint name="world_joint" type="fixed"><parent link="world" /><child link = "base_link" /><origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" /></joint></robot>

2.修改launch文件

找到universial_robot/ur_description/launch/文件夹,下面有view_ur5.launchur5_upload.launch两个文件,可以分别复制一份,然后进行修改。新复制的view_ur5.launch可以命名为view_ur5_gripper.launch,其中的

<include file="$(find ur_description)/launch/ur5_upload.launch"/>

修改为

<include file="$(find ur_description)/launch/ur5_upload_gripper.launch"/>

新复制的ur5_upload.launch可以命名为ur5_upload_gripper.launch,其中的

<param unless="$(arg limited)" name="robot_description" command="$(find xacro)/xacro --inorder $(find ur_description)/urdf/ur5_robot.urdf.xacro transmission_hw_interface:=$(arg transmission_hw_interface)" />

改为

<param unless="$(arg limited)" name="robot_description" command="$(find xacro)/xacro --inorder $(find ur_description)/urdf/ur5_robot_robotiq85_gripper.urdf.xacro transmission_hw_interface:=$(arg transmission_hw_interface)" />

上边这些是在rviz中查看的launch文件,下面,说一下gazebo中如何修改:
找到universial_robot/ur_gazebo/launch/文件夹,下面的ur5.launch修改如下:
将其中的

<include file="$(find ur_description)/launch/ur5_upload.launch">

修改为

<include file="$(find ur_description)/launch/ur5_upload_robotiq85_gripper.launch">

添加下面这两行代码:

<rosparam file="$(find robotiq_85_gazebo)/controller/gripper_controller_robotiq.yaml" command="load"/>
<node name="gui_controller" pkg="rqt_joint_trajectory_controller" type="rqt_joint_trajectory_controller" />

这一行:

<node name="arm_controller_spawner" pkg="controller_manager" type="controller_manager" args="spawn arm_controller" respawn="false" output="screen"/>

修改为

<node name="arm_controller_spawner" pkg="controller_manager" type="controller_manager" args="spawn arm_controller gripper" respawn="false" output="screen"/>

这样做可以对夹爪进行控制。
至此,所有文件修改完毕。

3.运行launch文件查看效果

首先测试rviz中,运行roslaunch ur5_description view_ur5_gripper.launch,不出意外应该可以看到以下效果,在joint_state_publisher_gui中调整可以控制机械臂和夹爪。

测试gazebo中效果:
运行roslaunch ur_gazebo ur5.launch,可以看到以下效果:
通过滑动右边划块可以控制机械臂运动,controller选择gripper可以控制夹爪。

到上面应该就UR+robotiq85的配置全部完成了,所有涉及的代码我放到github上:UR5+robotiq85
我的仿真会出现夹爪一直在抖的问题,机械臂移动几下或者过一段时间,夹爪就散架了,没能找到解决方案,修改关节的effort也不行,希望有大佬如果可以解决这个问题,能够不吝赐教!
由于这个夹爪我没法使用,所以又换了dh_gripper,参考我的另一篇文章UR5+dh_ag95_gripper夹爪配置


现在问题解决啦,下一些插件就行了,参考另一篇博客:https://blog.csdn.net/qq_44642372/article/details/124462220
参考以下文章:
https://blog.csdn.net/Tepmoe/article/details/119455411
https://blog.csdn.net/weixin_42268975/article/details/106268506

gazebo+rviz中配置UR+robotiq_gripper夹爪,最详细操作过程相关推荐

  1. VScode中配置 C/C++ 环境,超级详细,问题分析全面,绝对好用

    VScode中配置 C/C++ 环境,超级详细,问题分析全面,绝对好用 VScode中配置 C/C++ 环境 你好! 这是你第一次使用 Markdown编辑器 所展示的欢迎页.如果你想学习如何使用Ma ...

  2. 在windows中配置jsp环境(超详细)

    在windowsserver服务器中配置jsp的运行环境 首先,你要拥有一台windows server的服务器,这里推荐腾讯云,不仅仅有学生试用一个月,而且更加方便.腾讯云跳转:https://cl ...

  3. PROBOT_G603双臂GAZEBO+MoveIt!仿真中配置手眼相机和夹爪

    PROBOT_G603双臂GAZEBO+MoveIt!仿真中配置手眼相机和夹爪 问题描述 安装双臂模型 修改urdf文件 Gripper文件修改 Gripper添加到机械臂上 配置MoveIt! 配置 ...

  4. sw模型转urdf,并在gazebo和rviz中显示

    sw模型转urdf,并在gazebo和rviz中显示 1.sw模型转urdf 1.1建立机器人的三维模型 1.2机器人三维模型预处理 1.3装配 1.4建立坐标系 2.显示 2.1.在gazebo中显 ...

  5. robotiq 2f 140安装在UR3机械臂后面在gazebo仿真中散架、抖动

    robotiq 2f 140安装在UR3机械臂后面在gazebo仿真中散架.抖动 搭建环境: ubuntu: 20.04 ros: Nonetic sensor: robotiq_ft300 grip ...

  6. ROS入门(八)——仿真机器人四(Gazebo+Rviz+雷达、摄像头、kinet仿真显示)

    所用的学习链接: [奥特学园]ROS机器人入门课程<ROS理论与实践>零基础教程P278-288 [以上视频笔记见http://www.autolabor.com.cn/book/ROST ...

  7. 在ROS Kinetic和Gazebo 8中使用智能汽车仿真演示

    在ROS Kinetic和Gazebo 8中使用智能汽车仿真演示 智能车无人驾驶技术是目前人工智能和机器人技术的研究热点,有许多开源平台可以使我们零基础零成本入门无人驾驶技术.本文分享一下目前ROS官 ...

  8. 机器人xacro设计+gazebo/rviz启动

    机器人xacro设计+gazebo/rviz启动 项目需求 方案 机器人的本体设计 机器人本体集成car_gazebo.xacro inertial惯性矩阵 head.xacro 小车底盘base.x ...

  9. 在ROS中配置使用Robotiq 抓手(一)

    前言 印象中Robotiq系列产品已经成为了UR机器人的隐形标配,但是没想到在想要结合ROS使用竟然这么麻烦.. 1. 利用URScript通过UR控制器调用抓手 在使用试教器控制Robotiq抓手时 ...

最新文章

  1. Linux快速复制T级数据或删除大量小文件
  2. 第三讲 一阶线性ODE
  3. java 判断 中文字符_java中判断字符串中是否有中文字符
  4. python网络套接字_Python网络编程 Python套接字编程
  5. Github(2)-本地配置git
  6. Appium+Python移动端(Android)自动化测试环境搭建原来没有那么难!+ 带你实战去
  7. vue 同步加载_2019 前端面试题汇总(主要为 Vue)
  8. basler相机的触发线是那两脚_探究机器视觉领域线扫相机和面阵相机的区别
  9. 临牌过期保险能理赔吗?
  10. 『Python基础』第三节:变量和基础数据类型
  11. 两堆草前饿死的驴——选择永远是件痛苦的事
  12. 【图像融合】基于matlab遗传算法图像融合【含Matlab源码 1624期】
  13. AlphaGo Zero算法讲解
  14. CImage不失真缩放显示图片
  15. 苹果cms如何添加广告代码
  16. 操作系统——信号量机制(PV操作)
  17. python对json的操作及实例解析
  18. 丁磊一份隔着万水千山的爱情
  19. excel表格打印每页都有表头_分享|1分钟学会,让打印的表格每页自带标题行
  20. 2022山东省安全员C证操作证考试题及答案

热门文章

  1. 在前端开发中,页面渲染指什么
  2. 更换openstack虚拟机ip
  3. 小学教师资格证计算机知识,小学老师教师资格证复习内容是什么 小学教师资格证考试笔试必备知识点...
  4. 苹果手机打不开html,苹果手机打不开app是怎么回事(苹果app异常解决方法)
  5. error 1044 mysql_mysql ERROR 1044 (42000): Access denied for user ''@'localhost' to database
  6. 我们不再是冷暖自知的个体
  7. 关于Paxos的历史
  8. 《只是为了好玩:Linux之父林纳斯自传》
  9. SAP BPC-通过Input Schedul输入与DM运行Logic计算两种情况下的LEQ/INC科目的正负号问题...
  10. 投资即修行,千里之行始于足下