0
$\begingroup$

Rosanswers logo

Hi!

I'm currently struggling with URDF. The model of the robot is a Kuka KR3 CR. I used a Collada file (from OpenRAVE's collection of robots - Rosen Diankov actually created this model for a previous project of mine :)). There were a couple of problems with it (including partially flipped normals of some of the faces and some of the links (you can see that in the image below - a screenshot from OpenRAVE's visualization tool) have some weird geometry issues:

image description

That's why I used Blender and Meshlab to fix the issues. In order to obtain the separate links I used the collada_to_urdf tool. It extracted an URDF file along with the links (one Collada file per link which I converted to OBJ format). It seems however that the tool doesn't work properly and some of the links are now not where they are supposed to be:

image description

I tried changing those but moveit setup assistant doesn't show the changes for some reason...

The original URDF can be seen below (I replaced values such as 6.1342423e-33 with 0 since those are obviously rounding errors):

 <?xml version="1.0"?>
  <robot name="KR3CR"
     xmlns:xi="http://www.w3.org/2001/XInclude"
     xmlns:gazebo="http://playerstage.sourceforge.net/gazebo/xmlschema/#gz"
     xmlns:model="http://playerstage.sourceforge.net/gazebo/xmlschema/#model"
     xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
     xmlns:body="http://playerstage.sourceforge.net/gazebo/xmlschema/#body"
     xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom"
     xmlns:joint="http://playerstage.sourceforge.net/gazebo/xmlschema/#joint"
     xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
     xmlns:rendering="http://playerstage.sourceforge.net/gazebo/xmlschema/#rendering"
     xmlns:renderable="http://playerstage.sourceforge.net/gazebo/xmlschema/#renderable"
     xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
     xmlns:physics="http://playerstage.sourceforge.net/gazebo/xmlschema/#physics">

  <link name="link1">
    <visual>
      <origin xyz="0 0 0" rpy="0 -0 0"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_1.obj" scale="1 1 1" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_1.obj" scale="1 1 1" />
      </geometry>
    </collision>
    <inertial>
      <mass value="1" />
      <origin xyz="0 0 0" rpy="0 -0 0"/>
      <inertia ixx="0.4" ixy="0" ixz="0" iyy="0.4" iyz="0" izz="0.4"/>
    </inertial>
  </link>

  <link name="link2">
    <visual>
      <origin xyz="0 0 0" rpy="3.14159 0 0"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_2.obj" scale="1 1 1" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0 0 0" rpy="3.14159 0 0"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_2.obj" scale="1 1 1" />
      </geometry>
    </collision>
    <inertial>
      <mass value="1" />
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="0.4" ixy="0" ixz="0" iyy="0.4" iyz="0" izz="0.4"/>
    </inertial>
  </link>

  <link name="link3">
    <visual>
      <origin xyz="0.1 0 -0.35" rpy="1.5708 -0 0"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_3.obj" scale="1 1 1" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0.1 0 -0.35" rpy="1.5708 -0 0"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_3.obj" scale="1 1 1" />
      </geometry>
    </collision>
    <inertial>
      <mass value="1" />
      <origin xyz="0 0 0" rpy="0 -0 0"/>
      <inertia ixx="0.4" ixy="0" ixz="0" iyy="0.4" iyz="0" izz="0.4"/>
    </inertial>
  </link>

<!-- BAD POSITIONED LINKS START FROM HERE -->
  <link name="link4">
    <visual>
      <origin xyz="0 -0.265 0" rpy="0 -0 0"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_4_new.obj" scale="1 1 1" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0 -0.265 0" rpy="0 -0 0"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_4_new.obj" scale="1 1 1" />
      </geometry>
    </collision>
    <inertial>
      <mass value="1" />
      <origin xyz="0 0 0" rpy="0 -0 0"/>
      <inertia ixx="0.4" ixy="0" ixz="0" iyy="0.4" iyz="0" izz="0.4"/>
    </inertial>
  </link>

  <link name="link5">
    <visual>
      <origin xyz="0 0 0" rpy="1.5708 0 -1.5708"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_5.obj" scale="1 1 1" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0 0 0" rpy="1.5708 0 -1.5708"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_5.obj" scale="1 1 1" />
      </geometry>
    </collision>
    <inertial>
      <mass value="1" />
      <origin xyz="0 0 0" rpy="0 -0 0"/>
      <inertia ixx="0.4" ixy="0" ixz="0" iyy="0.4" iyz="0" izz="0.4"/>
    </inertial>
  </link>

<!-- LINK5 AND LINK6 ARE POSITION CORRECTLY (RELATIVE TO EACH OTHER) BUT NOT TO THE REST OF THE ROBOT -->
  <link name="link6">
    <visual>
      <origin xyz="0 0 -0.27" rpy="-1.83705 1.5708 -0.266252"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_6.obj" scale="1 1 1" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0 0 -0.27" rpy="-1.83705 1.5708 -0.266252"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_6.obj" scale="1 1 1" />
      </geometry>
    </collision>
    <inertial>
      <mass value="1" />
      <origin xyz="0 0 0" rpy="0 -0 0"/>
      <inertia ixx="0.4" ixy="0" ixz="0" iyy="0.4" iyz="0" izz="0.4"/>
    </inertial>
  </link>

  <link name="link7">
    <visual>
      <origin xyz="0 0 0" rpy="1.5708 0 -1.5708"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_7.obj" scale="1 1 1" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0 0 0" rpy="1.5708 0 -1.5708"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_7.obj" scale="1 1 1" />
      </geometry>
    </collision>
    <inertial>
      <mass value="1" />
      <origin xyz="0 0 0" rpy="0 -0 0"/>
      <inertia ixx="0.4" ixy="0" ixz="0" iyy="0.4" iyz="0" izz="0.4"/>
    </inertial>
  </link>

  <joint name="j1" type="revolute">
    <parent link="link1"/>
    <child  link="link2"/>
    <origin xyz="0 0 0" rpy="3.14159 -0 0 "/>
    <axis   xyz="0 0 1"/>
    <limit lower="-3.14159" upper="3.14159" effort="50" velocity="4.18879" />
    <dynamics damping="0.2" friction="0" />
  </joint>

  <joint name="j2" type="revolute">
    <parent link="link2"/>
    <child  link="link3"/>
    <origin xyz="0.1 0 -0.35" rpy="1.5708 -0 0 "/>
    <axis   xyz="0 0 1"/>
    <limit lower="-0.785398" upper="2.35619" effort="50" velocity="3.66519" />
    <dynamics damping="0.2" friction="0" />
  </joint>

  <joint name="j3" type="revolute">
    <parent link="link3"/>
    <child  link="link4"/>
    <origin xyz="0 -0.265 0" rpy="0 -0 0 "/>
    <axis   xyz="0 0 1"/>
    <limit lower="-2.35619" upper="2.35619" effort="50" velocity="4.18879" />
    <dynamics damping="0.2" friction="0" />
  </joint>

  <joint name="j4" type="revolute">
    <parent link="link4"/>
    <child  link="link5"/>
    <origin xyz="0 0 0" rpy="1.5708 0 -1.5708 "/>
    <axis   xyz="0 0 1"/>
    <limit lower="-3.14159" upper="3.14159" effort="50" velocity="6.54498" />
    <dynamics damping="0.2" friction="0" />
  </joint>

  <joint name="j5" type="revolute">
    <parent link="link5"/>
    <child  link="link6"/>
    <origin xyz="0 0 -0.27" rpy="-1.83705 1.5708 -0.266252 "/>
    <axis   xyz="0 0 1"/>
    <limit lower="-2.35619" upper="2.35619" effort="50" velocity="5.23599" />
    <dynamics damping="0.2" friction="0" />
  </joint>

  <joint name="j6" type="continuous">
    <parent link="link6"/>
    <child  link="link7"/>
    <origin xyz="0 0 0" rpy="1.5708 0 -1.5708 "/>
    <axis   xyz="0 0 1"/>
    <limit lower="-3.14159" upper="3.14159" effort="50" velocity="6.54498" />
    <dynamics damping="0.2" friction="0" />
  </joint>
</robot>

Below is the file that I'm currently working on. No matter what numbers I set in the <visual/> as the origin (x, y and y) nothing changes. It's also weird that even when I add a color the change is not appearing. The visualization of the model is done with the moveit setup assistant. Currently I have concentrated my efforts on link 4 (the rotated one on the right of the second image at the beginning of my question):

<?xml version="1.0"?>
<robot name="KR3CR"
       xmlns:xi="http://www.w3.org/2001/XInclude"
       xmlns:gazebo="http://playerstage.sourceforge.net/gazebo/xmlschema/#gz"
       xmlns:model="http://playerstage.sourceforge.net/gazebo/xmlschema/#model"
       xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
       xmlns:body="http://playerstage.sourceforge.net/gazebo/xmlschema/#body"
       xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom"
       xmlns:joint="http://playerstage.sourceforge.net/gazebo/xmlschema/#joint"
       xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
       xmlns:rendering="http://playerstage.sourceforge.net/gazebo/xmlschema/#rendering"
       xmlns:renderable="http://playerstage.sourceforge.net/gazebo/xmlschema/#renderable"
       xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
       xmlns:physics="http://playerstage.sourceforge.net/gazebo/xmlschema/#physics">

<link name="link1">
   <visual>
   <origin xyz="0 0 0" rpy="0 -0 0"/>
     <geometry>
       <mesh filename="package://urdf_collection/meshes/kr3cr/link_1.obj" scale="1 1 1" />
     </geometry>
   </visual>
   <collision>
     <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
         <mesh filename="package://urdf_collection/meshes/kr3cr/link_1.obj" scale="1 1 1" />
      </geometry>
   </collision>
   <inertial>
      <mass value="1" />
      <origin xyz="0 0 0" rpy="0 -0 0"/>
      <inertia ixx="0.4" ixy="0" ixz="0" iyy="0.4" iyz="0" izz="0.4"/>
    </inertial>
  </link>

  <link name="link2">
    <visual>
      <origin xyz="0 0 0" rpy="3.14159 0 0"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_2.obj" scale="1 1 1" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0 0 0" rpy="3.14159 0 0"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_2.obj" scale="1 1 1" />
      </geometry>
    </collision>
    <inertial>
      <mass value="1" />
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="0.4" ixy="0" ixz="0" iyy="0.4" iyz="0" izz="0.4"/>
    </inertial>
  </link>

  <link name="link3">
    <visual>
      <origin xyz="0.1 0 -0.35" rpy="1.5708 0 0"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_3.obj" scale="1 1 1" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0.1 0 -0.35" rpy="1.5708 0 0"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_3.obj" scale="1 1 1" />
      </geometry>
    </collision>
    <inertial>
      <mass value="1" />
      <origin xyz="0.1 0 -0.35" rpy="0 0 0"/>
      <inertia ixx="0.4" ixy="0" ixz="0" iyy="0.4" iyz="0" izz="0.4"/>
    </inertial>
  </link>

<!-- BAD POSITIONED LINKS START FROM HERE -->
  <link name="link4">
    <visual>
      <origin xyz="0.1 0 -0.615" rpy="0 0 0"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_4_new.obj" scale="1 1 1" />
      </geometry>
      <material name="default_material">
        <color rgba="0.79 0.82 0.93 1"/>
      </material>
    </visual>
    <collision>
      <origin xyz="0.1 0 -0.615" rpy="0 0 0"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_4_new.obj" scale="1 1 1" />
      </geometry>
    </collision>
    <inertial>
      <mass value="1" />
      <origin xyz="0.1 0 -0.615" rpy="0 0 0"/>
      <inertia ixx="0.4" ixy="0" ixz="0" iyy="0.4" iyz="0" izz="0.4"/>
    </inertial>
  </link>

  <link name="link5">
    <visual>
      <origin xyz="0 0 0" rpy="1.5708 0 -1.5708"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_5.obj" scale="1 1 1" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0 0 0" rpy="1.5708 0 -1.5708"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_5.obj" scale="1 1 1" />
      </geometry>
    </collision>
    <inertial>
      <mass value="1" />
      <origin xyz="0 0 0" rpy="0 -0 0"/>
      <inertia ixx="0.4" ixy="0" ixz="0" iyy="0.4" iyz="0" izz="0.4"/>
    </inertial>
  </link>

<!-- LINK5 AND LINK6 ARE POSITION CORRECTLY (RELATIVE TO EACH OTHER) BUT NOT TO THE REST OF THE ROBOT -->
  <link name="link6">
    <visual>
      <origin xyz="0.399 0 -0.615" rpy="-1.83705 1.5708 -0.266252"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_6.obj" scale="1 1 1" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0.399 0 -0.615" rpy="-1.83705 1.5708 -0.266252"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_6.obj" scale="1 1 1" />
      </geometry>
    </collision>
    <inertial>
      <mass value="1" />
      <origin xyz="0.399 0 -0.615" rpy="0 -0 0"/>
      <inertia ixx="0.4" ixy="0" ixz="0" iyy="0.4" iyz="0" izz="0.4"/>
    </inertial>
  </link>

  <link name="link7">
    <visual>
      <origin xyz="0.474 0 -0.615" rpy="1.5708 0 -1.5708"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_7.obj" scale="1 1 1" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0.474 0 -0.615" rpy="1.5708 0 -1.5708"/>
      <geometry>
        <mesh filename="package://urdf_collection/meshes/kr3cr/link_7.obj" scale="1 1 1" />
      </geometry>
    </collision>
    <inertial>
      <mass value="1" />
      <origin xyz="0.474 0 -0.615" rpy="0 -0 0"/>
      <inertia ixx="0.4" ixy="0" ixz="0" iyy="0.4" iyz="0" izz="0.4"/>
    </inertial>
  </link>

  <joint name="j1" type="revolute">
    <parent link="link1"/>
    <child  link="link2"/>
    <origin xyz="0 0 0" rpy="3.14159 0 0 "/>
    <axis   xyz="0 0 1"/>
    <limit lower="-3.14159" upper="3.14159" effort="50" velocity="4.18879" />
    <dynamics damping="0.2" friction="0" />
  </joint>

  <joint name="j2" type="revolute">
    <parent link="link2"/>
    <child  link="link3"/>
    <origin xyz="0.1 0 -0.35" rpy="1.5708 0 0 "/>
    <axis   xyz="0 0 1"/>
    <limit lower="-0.785398" upper="2.35619" effort="50" velocity="3.66519" />
    <dynamics damping="0.2" friction="0" />
  </joint>

<!-- BAD POSITIONING FOR LINKS FROM HERE -->
  <joint name="j3" type="revolute">
    <parent link="link3"/>
    <child  link="link4"/>
    <origin xyz="-0.1 0 -0.265" rpy="0 0 0 "/>
    <axis   xyz="0 0 1"/>
    <limit lower="-2.35619" upper="2.35619" effort="50" velocity="4.18879" />
    <dynamics damping="0.2" friction="0" />
  </joint>

  <joint name="j4" type="revolute">
    <parent link="link4"/>
    <child  link="link5"/>
    <origin xyz="0 0 0" rpy="1.5708 0 -1.5708 "/>
    <axis   xyz="0 0 1"/>
    <limit lower="-3.14159" upper="3.14159" effort="50" velocity="6.54498" />
    <dynamics damping="0.2" friction="0" />
  </joint>

  <joint name="j5" type="revolute">
    <parent link="link5"/>
    <child  link="link6"/>
    <origin xyz="0 0 -0.27" rpy="-1.83705 1.5708 -0.266252 "/>
    <axis   xyz="0 0 1"/>
    <limit lower="-2.35619" upper="2.35619" effort="50" velocity="5.23599" />
    <dynamics damping="0.2" friction="0" />
  </joint>

  <joint name="j6" type="continuous">
    <parent link="link6"/>
    <child  link="link7"/>
    <origin xyz="0 0 0" rpy="1.5708 0 -1.5708 "/>
    <axis   xyz="0 0 1"/>
    <limit lower="-3.14159" upper="3.14159" effort="50" velocity="6.54498" />
    <dynamics damping="0.2" friction="0" />
  </joint>
</robot>

It took me some time to also find some decent specification of the robot (source: http://www.eurobots.net):

Axes specs

Dimensions - front

Dimensions - side

Can anyone give me some advise as to how to work this out? It seems weird that changes are not registered. I even added 1-2 meters to the translation of one of the links and still no visual change. :-/

EDIT: I've uploaded my files on github.


Originally posted by rbaleksandar on ROS Answers with karma: 299 on 2015-11-28

Post score: 1


Original comments

Comment by gvdhoorn on 2015-11-28:
I'd suggest to use the display.launch file from urdf_tutorial instead of the Setup Assistant to check your urdf. It will also allow you to make sure your axes are configured correctly.

Comment by rbaleksandar on 2015-11-28:
Thanks. The moveit setup assistant actually does provide an extensive info about the file that is loaded. I'll give you suggestion a go though. This still doesn't explain why changing the values inside the URDF file doesn't result in any visual change. :-/

Comment by gvdhoorn on 2015-11-30:
If you can make the files + meshes available somewhere, I'm willing to take a look. As far as the colours go: OBJ supports materials, so it may be that any material tags are ignored in favour of the info in the OBJ.

Comment by rbaleksandar on 2015-12-02:
Takes a lot for the offer. If you don't mind, I'll take you up on it. ;) I have updated my question at the end to include a git repo with the files. I have also merged my stuff with the urdf_tutorial package.

Comment by gvdhoorn on 2015-12-03:
If this is still an issue, I'll take a look tomorrow.

Comment by rbaleksandar on 2015-12-04:
If it's not a problem for you, I'd appreciate it. Still working on it.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I've just opened a pull request against your repository, see aleksandaratanasov/urdf_collection#1.

A copy/paste of the PR description, so it doesn't get lost:

Basically, I haven't even tried to diagnose the original URDF, as there were too many issues with it, probably due to the conversion done by collada_to_urdf. I also suspect a discrepancy between the joint transforms in the original urdf and the meshes that were converted separately.

In the end, I:

  • converted everything to a xacro macro (added top-level xacro as well)
  • made naming consistent with ROS standards (base_link, etc)
  • cleaned up all urdf joint transforms: based on data from a KR 3 CR datasheet
  • removed collada->urdf conversion artefacts (unnecessary xml ns decls, etc)
  • changed origins of all meshes to be relative to the joint zero, instead of to the global robot zero
  • scaled meshes (ROS uses meters, meshes were in millimeters)
  • fixed orientations of all meshes: X forward, Y to the left, Z up (ROS standard)
  • created collision quality meshes (convex hulls)
  • split out visual and collision quality meshes of KR 3 CR into separate directories

Note:

  • origins of all intertial elements has been reset to zeros as I don't know what the real values should be
  • masses, origins and values for inertia elements are incorrect
  • effort limits of all joints have suspicious values (if unknown, just leave them at zero, unless you need to simulate with Gazebo obviously)
  • dynamics element attributes seem to have standard values

I also added two convenience launch files to easily load and display the model in RViz (roslaunch urdf_collection test_kr3cr.launch).

Most of this is based on the Create a URDF for an Industrial Robot and Working with ROS-Industrial Robot Support Packages tutorials from ROS-Industrial.

I also created a test MoveIt configuration to verify the model and could successfully plan for it.


Originally posted by gvdhoorn with karma: 86574 on 2015-12-05

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.