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:
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:
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):
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.