ROS:UR10e配置Onrobot RG2夹爪(gazebo环境)

环境

ROS Noetic
Ubuntu 20.04
UR10e
Onrobot RG2 Gripper

之前在ROS:UR10e配置Onrobot RG2夹爪(rviz环境)已经配置好了rviz环境下的RG2夹爪,模拟真是物理环境还需要在gazebo中配置夹爪

配置过程

初步配置

在gazebo中打开rg2是通过以下命令roslaunch onrobot_rg_gazebo bringup_rg2_gazebo.launch,打开ur10e是通过roslaunch onrobot_rg_gazebo ur10e_bringup.launch,从ur10e_bringup.launch一步步来看如何改

ur10e_bringup.launch
load_ur10e.launch.xml

ur10e_bringup.launch
在这里插入图片描述

load_ur10e.launch.xml
load_ur10.launch.xml

load_ur10.launch.xml
在这里插入图片描述

load_ur10.launch.xml
ur_gazebo/urdf/ur.xacro

load_ur10.launch.xml
在这里插入图片描述

ur.xacro
ur_macro.xacro

ur.xacro中,用到了ur_macro.xacro的宏定义ur_robot_gazebo
在这里插入图片描述
所以最后指向ur_macro.xacro,在这个文件中调用了ur_description/urdf/inc/ur_macro.xacro中的宏函数来包含ur(ur10e)的描述文件,ur_gazebo/urdf/ur_macro.xacro里面加上了gazebo的一些配置,在加载完ur(ur10e)描述文件后面加上夹爪描述文件就可以了
在这里插入图片描述
整个的文件指向关系是:

ur10e_bringup.launch
load_ur10e.launch.xml
load_ur10.launch.xml
ur_gazebo/urdf/ur.xacro
ur_gazebo/urdf/ur_macro.xacro

完整的ur_gazebo/urdf/ur_macro.xacro文件内容:

<?xml version="1.0"?>
<robot xmlns:xacro="http://wiki.ros.org/xacro">
  <!--
    Main xacro macro definition of the "Gazebo robot" model.

    This wraps the model of the real robot and adds all elements and parameters
    required by Gazebo.

    It also adds the gazebo_ros_control plugin.

    NOTE: this is NOT a URDF. It cannot directly be loaded by consumers
    expecting a flattened '.urdf' file. See the top-level '.xacro' for that
    (but note: that .xacro must still be processed by the xacro command).

    For use in '.launch' files: use one of the 'load_urX.launch' convenience
    launch files.

    NOTE: this Gazebo model makes use of the same set of parameter files as the
    main xacro macro (in ur_description). It is therefor possible to use the
    kinematic calibration exported from a REAL UR robot. Please refer to the
    ur_macro.xacro in ur_description for more information about this.

    Main author of the migration to yaml configs: Ludovic Delval.

    Contributors to previous versions (in no particular order):

     - Felix Messmer
     - Kelsey Hawkins
     - Shaun Edwards
     - Alexander Bubeck
     - Nadia Hammoudeh Garcia
     - G. vd. Hoorn
     - Dave Niewinski
     - Andy Zelenak
     - Miguel Prada
     - Mathias Luedtke
     - Hans-Joachim Krauch
     - Felix Exner
  -->


  <!-- Definition of the main macro -->
  <xacro:macro name="ur_robot_gazebo" params="
   prefix
   joint_limits_parameters_file
   kinematics_parameters_file
   physical_parameters_file
   visual_parameters_file
   transmission_hw_interface:=hardware_interface/EffortJointInterface
   safety_limits:=false safety_pos_margin:=0.15 safety_k_position:=20"
  >
    <!--
      Import the xacro macro for the REAL robot (which we'll augment with Gazebo
      specific elements in the wrapper macro below).

      NOTE: this imports the '_macro.xacro' from ur_description, as that contains
      the definitions for the real robot.
    -->
  <xacro:include filename="$(find ur_description)/urdf/inc/ur_macro.xacro"/>


    <!-- Instantiate model for the REAL robot. -->
    <xacro:ur_robot
      prefix="${prefix}"
      joint_limits_parameters_file="${joint_limits_parameters_file}"
      kinematics_parameters_file="${kinematics_parameters_file}"
      physical_parameters_file="${physical_parameters_file}"
      visual_parameters_file="${visual_parameters_file}"
      transmission_hw_interface="${transmission_hw_interface}"
      safety_limits="${safety_limits}"
      safety_pos_margin="${safety_pos_margin}"
      safety_k_position="${safety_k_position}"
    />

    <!-- Configure self collision properties per link -->
    <gazebo reference="${prefix}shoulder_link">
      <selfCollide>true</selfCollide>
    </gazebo>
    <gazebo reference="${prefix}upper_arm_link">
      <selfCollide>true</selfCollide>
    </gazebo>
    <gazebo reference="${prefix}forearm_link">
      <selfCollide>true</selfCollide>
    </gazebo>
    <gazebo reference="${prefix}wrist_1_link">
      <selfCollide>true</selfCollide>
    </gazebo>
    <gazebo reference="${prefix}wrist_3_link">
      <selfCollide>true</selfCollide>
    </gazebo>
    <gazebo reference="${prefix}wrist_2_link">
      <selfCollide>true</selfCollide>
    </gazebo>
    <gazebo reference="${prefix}ee_link">
      <selfCollide>true</selfCollide>
    </gazebo>

    <!--
      Inject Gazebo ROS Control plugin, which allows us to use ros_control
      controllers to control the virtual robot hw.
    -->
    <gazebo>
      <plugin name="ros_control" filename="libgazebo_ros_control.so">
        <!--robotNamespace>/</robotNamespace-->
        <!--robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType-->
      </plugin>
    </gazebo>
  </xacro:macro>

  <!-- copy ur10e_rg2_d415.xacro here -->
  <!-- Gripper RG2 -->
  <xacro:include filename="$(find onrobot_rg_description)/urdf/onrobot_rg2_model_macro.xacro"/>
  <xacro:onrobot_rg2 prefix=""/>

  <!-- Attach the RG2 gripper to the UR10e tool0 link -->
  <joint name="rg2_joint" type="fixed">
    <parent link="tool0"/>
    <child link = "onrobot_rg2_base_link"/>
		<origin xyz="0 0 0" rpy="0 0 0"/> 
  </joint>  

</robot>

运行结果

cd ~/ur_ws
source devel/setup.bash
roslaunch ur_gazebo ur10e_bringup.launch

运行结果是已经在ur10e上装上rg2夹爪,但是会有抖动现象,具体解决方法可以看我的下一篇博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值