Including another robot part via xacro

asked 2017-11-28 07:49:15 -0600

Fiddle gravatar image

Hi, I've been trying to attach a gripper to my manipulator and I've decided it would be best for my project if it was in another file. The problem is that I can't seem to do this correctly, when running the gazebo simulation I get the message

Error [parser_urdf.cc:3474] Unable to call parseURDF on robot model
Error [parser.cc:342] parse as old deprecated model file failed.
[INFO] [1511876200.859116, 10.141000]: Spawn status: SpawnModel: Entity pushed to spawn queue, but spawn service timed out waiting for entity to appear in simulation under the name Kuka_kr3

And the robot will not spawn. Below I attach the codes for robot and gripper. Another question that I have, is that I've made these files in similar fashion, but I don't know if I can use the macros defined in the manipulator file in gripper definition? So far, I've written it as a standard urdf file.

Manipulator file

<?xml version="1.0" ?>
<robot name="Kuka_kr3" xmlns:xacro="http://www.ros.org/wiki/xacro" >
  <gazebo>
    <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
      <robotNamespace>/kuka_kr3</robotNamespace>
    </plugin>
  </gazebo>

  <xacro:include filename="gripper.urdf.xacro" ns="gripper"/>

  <xacro:macro name="gazebo_reference" params="link_name color">
    <gazebo reference="${link_name}">
      <mu1>0.5</mu1>
      <mu2>0.5</mu2>
      <material>Gazebo/${color}</material>
    </gazebo>
  </xacro:macro>

  <xacro:gazebo_reference link_name="link0" color="Yellow"/>
  <xacro:gazebo_reference link_name="link1" color="Orange"/>
  <xacro:gazebo_reference link_name="link2" color="White"/>
  <xacro:gazebo_reference link_name="link3" color="Orange"/>
  <xacro:gazebo_reference link_name="link4" color="White"/>
  <xacro:gazebo_reference link_name="link5" color="Blue"/>
  <xacro:gazebo_reference link_name="link6" color="Red"/>

  <xacro:macro name="robot_joint" params="name type parent child *origin *axis effort_limit lower_effort_limit 
                                          upper_effort_limit transmission_name actuator_name">
    <joint name="${name}" type="${type}">
    <parent link="${parent}"/>
    <child link="${child}"/>
    <xacro:insert_block name="origin"/>
    <xacro:insert_block name="axis"/>
    <limit effort="${effort_limit}" lower="${lower_effort_limit}" upper="${upper_effort_limit}" velocity="1.0"/>
    <dynamics damping="0.2"/>
  </joint>
  <transmission name="${transmission_name}">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="${name}">
      <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="${actuator_name}">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>
  </xacro:macro>

  <joint name="dummy" type="fixed">
    <parent link="dummy"/>
    <child link="link0"/>
    <origin rpy="0  0  0" xyz="0   0   0"/>
    <axis xyz="0  0  0"/>
    <limit effort="1.0" lower="-2.96705973" upper="2.96705973" velocity="1.0"/>
  </joint>

  <xacro:robot_joint name="joint0" 
                     type="revolute" parent="link0" child="link1" 
                     effort_limit="1.0" lower_effort_limit="-2.96705973" 
                     upper_effort_limit="2.96705973" transmission_name="trans0" 
                     actuator_name="motor0">
    <origin rpy="0  0  0" xyz="0   0   0.2"/>
    <axis xyz="0  0  1"/>
  </xacro:robot_joint>

  <xacro:robot_joint name="joint1" 
                     type="revolute" parent="link1" child="link2" 
                     effort_limit="500.0" lower_effort_limit="-1.3962634" 
                     upper_effort_limit="2.44346095" transmission_name="trans1" 
                     actuator_name="motor1">
    <origin rpy="0  0  0" xyz="0.02    0    0.15"/>
    <axis xyz="0  1  0"/>
  </xacro:robot_joint>

  <xacro:robot_joint name="joint2" 
                     type="revolute" parent="link2" child="link3" 
                     effort_limit="500.0" lower_effort_limit="-1.91986218" 
                     upper_effort_limit="2.70526034" transmission_name="trans2" 
                     actuator_name="motor2">
    <origin rpy="0  0  0" xyz="0     0     0.265"/>
    <axis xyz="0  1 ...
(more)
edit retag flag offensive close merge delete

Comments

It looks like the gripper is a distinct entity, either splitting it out more completely (instead of including it in the other xacro, spawn it separately) or integrating it more fully (it shouldn't have its own robot name or namespace for instance) will resolve all or part of the problem.

lucasw gravatar image lucasw  ( 2017-11-28 11:21:53 -0600 )edit

On the integration route, making it so the gripper xacro is just providing a macro that is used in the higher level xacro is probably better.

lucasw gravatar image lucasw  ( 2017-11-28 11:23:05 -0600 )edit

So do I need to put all of the grippers code into a macro? What would be in the parameters?

Fiddle gravatar image Fiddle  ( 2017-11-29 04:25:41 -0600 )edit

Ok, so i put everything in the macro, and it works in gazebo, but i have problem with the moveit package, since it was set to point to the urdf file, how do I connect it to the xacro without generating urdf by hand?

Fiddle gravatar image Fiddle  ( 2017-11-29 05:47:20 -0600 )edit