Ask Your Question
2

Problem at URDF to SDF conversion using gzsdf

asked 2013-12-03 12:51:17 -0500

Sezgin S. gravatar image

updated 2014-01-28 17:18:42 -0500

ngrennan gravatar image

I've already created an urdf called "robot_arm.urdf". I want to spawn that model on Gazebo. Before trying to spawn, I used "gzsdf" to see it as a sdf file. However, the result was unexpected. Despite my urdf model includes 7 links and 6 joints, the created sdf file shows just one link called "__ default __". The only right thing in the converted file is the name of the model.

Edit #1: I used ROS Hydro and Gazebo come with it. Also Ubuntu 13.04.

Here are the result when I enter "$ gzsdf print robot_arm.urdf":

> <sdf version='1.4'>        
>   <model name='robot_arm'>
>     <link name='__default__'>
>       <velocity_decay>
>         <linear>0</linear>
>         <angular>0</angular>
>       </velocity_decay>
>     </link>   
>   </model> 
> </sdf>

Here is my urdf file which is in ~/catkin_ws/src/testbot_description/robot_arm.urdf:

<?xml version="1.0" ?>
<robot name="robot_arm">

  <link name="base">

    <visual>
      <geometry>
        <cylinder length="0.025" radius="0.08"/>
      </geometry>
      <material name="Orange">
        <color rgba="1 0.4 0 1"/>
      </material>
    </visual>

    <collision>
      <geometry>
        <cylinder length="0.025" radius="0.08"/>
      </geometry>
    </collision>    

  </link>

  <link name="link_0">

    <visual>
      <geometry>
        <cylinder length="0.2385" radius="0.0295"/>
      </geometry>
      <material name="Orange">
        <color rgba="1 0.4 0 1"/>
      </material>
      <origin rpy="0 0 0" xyz="0 0 0.13175"/>
    </visual>

    <collision>
      <geometry>
        <cylinder length="0.2385" radius="0.0295"/>
      </geometry>
      <origin rpy="0 0 0" xyz="0 0 0.13175"/>
    </collision>   

  </link>

  <joint name="base_to_link0" type="fixed">
    <parent link="base"/>
    <child link="link_0"/>
  </joint>

  <link name="link_1">

    <visual>
      <geometry>
        <cylinder length="0.103" radius="0.0295"/>
      </geometry>
      <material name="Black">
        <color rgba="0 0 0 1"/>
      </material>
      <origin rpy="0 -1.57079 1.57079" xyz="0 0.022 0.2805"/>
    </visual>

    <collision>
      <geometry>
        <cylinder length="0.103" radius="0.0295"/>
      </geometry>
      <origin rpy="0 -1.57079 1.57079" xyz="0 0.022 0.2805"/>
    </collision>    

  </link>

  <joint name="link0_to_link1" type="revolute">
    <limit effort="30" velocity="1.0" lower="-2.792526" upper="2.792526"/>
    <axis xyz="0 0 1"/>
    <parent link="link_0"/>
    <child link="link_1"/>
  </joint>

  <link name="link_2">

    <inertial>
      <mass value="17.4" />
      <inertia ixx="0.13" iyy="0.524" izz="0.539" ixy="0" ixz="0" iyz="0" />
    </inertial>

    <visual>
      <geometry>
        <box size="0.059 0.229 0.079"/>
      </geometry>
      <material name="Orange">
        <color rgba="1 0.4 0 1"/>
      </material>
      <origin rpy="0 0 -1.57079" xyz="0.054 0 0"/>
    </visual>

    <collision>
      <geometry>
        <box size="0.059 0.229 0.079"/>
      </geometry>
      <origin rpy="0 0 -1.57079" xyz="0.054 0 0"/>
    </collision>    

  </link>

  <joint name="link1_to_link2" type="revolute">
    <limit effort="30" velocity="1.0" lower="-3.906056" upper="0.785398"/>
    <axis xyz="0 1 0"/>
    <origin xyz="0 0.092 0.2805"/>
    <parent link="link_1"/>
    <child link="link_2"/>
  </joint>

  <link name="link_3">

    <inertial>
      <mass value="4.8" />
      <inertia ixx="0.066" iyy="0.0125" izz="0.086" ixy="0" ixz="0" iyz="0" />
    </inertial>

    <visual>
      <geometry>
        <box size="0.032 0.194 0.032"/>
      </geometry>
      <material name="Black">
        <color rgba="0 0 0 1 ...
(more)
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
3

answered 2014-01-24 23:52:52 -0500

Sezgin S. gravatar image

updated 2014-04-07 21:33:43 -0500

I've already solved this problem. I think the problem was inertial elements which I didn't specify any for the base link and link_0. I didn't specify their inertial properties at first. However when I specify inertial elements like mass and inertia, I successfully converted the exact urdf model to sdf.

Here is the new urdf file that the problem is solved in;

<?xml version="1.0" ?>
<robot name="testbot">

    <!--platform-->

    <link name="pform">

        <inertial>
                <mass value="1"/>
            <inertia ixx="0.13" iyy="0.524" izz="0.539" ixy="0" ixz="0" iyz="0" />
            </inertial>

        <visual>
                <geometry>
                    <cylinder length="0.125" radius="0.08"/>
                </geometry>
                <material name="Orange">
                    <color rgba="1 0.4 0 1"/>
                </material>
                <origin rpy="0 0 0" xyz="0 0 0"/>
            </visual>

            <collision>
                <geometry>
                    <cylinder length="0.125" radius="0.08"/>
                </geometry>
            </collision>   

    </link>


    <!--base cylinder-->

    <link name="base">

        <inertial>
                <mass value="1"/>
            <inertia ixx="0.13" iyy="0.524" izz="0.539" ixy="0" ixz="0" iyz="0" />
            </inertial>

        <visual>
                <geometry>
                    <cylinder length="0.025" radius="0.08"/>
                </geometry>
                <material name="Orange">
                    <color rgba="1 0.4 0 1"/>
                </material>
                <origin rpy="0 0 0" xyz="0 0 0"/>
            </visual>

            <collision>
                <geometry>
                    <cylinder length="0.025" radius="0.08"/>
                </geometry>
            </collision>   

    </link>


    <!--joint between pform and base-->

    <joint name="pform_to_base" type="fixed">
        <origin xyz="0 0 0.075" rpy="0 0 0" />
        <axis xyz="0 0 0" />
            <parent link="pform"/>
            <child link="base"/>
    </joint>


    <!--link_0-->

    <link name="link_0">

        <inertial>
                <mass value="25" />
            <inertia ixx="0.13" iyy="0.524" izz="0.539" ixy="0" ixz="0" iyz="0" />
            </inertial>

            <visual>
                <geometry>
                    <cylinder length="0.2385" radius="0.0295"/>
                </geometry>
                <material name="Orange">
                    <color rgba="1 0.4 0 1"/>
                </material>
                <origin rpy="0 0 0" xyz="0 0 0.13175"/>
            </visual>

            <collision>
                <geometry>
                    <cylinder length="0.2385" radius="0.0295"/>
                </geometry>
                <origin rpy="0 0 0" xyz="0 0 0.13175"/>
            </collision>   

    </link>


    <!--joint between base and link0-->

    <joint name="base_to_link0" type="fixed">
        <origin xyz="0 0 0" rpy="0 0 0" />
        <axis xyz="0 0 0" />
            <parent link="base"/>
            <child link="link_0"/>
    </joint>


    <!--link_1-->

    <link name="link_1">

        <inertial>
                <mass value="10" />
            <inertia ixx="0.13" iyy="0.524" izz="0.539" ixy="0" ixz="0" iyz="0" />
            </inertial>

            <visual>
                <geometry>
                    <cylinder length="0.103" radius="0.0295"/>
                </geometry>
                <material name="Black">
                    <color rgba="0 0 0 1"/>
                </material>
                <origin rpy="0 -1.57079 1.57079" xyz="0 0.022 0.2805"/>
            </visual>

            <collision>
                <geometry>
                    <cylinder length="0.103" radius="0.0295"/>
                </geometry>
                <origin rpy="0 -1.57079 1.57079" xyz="0 0.022 0.2805"/>
            </collision>  

    </link>


    <!--joint between link0 and link1-->

    <joint name="link0_to_link1" type="revolute">
            <limit effort="30" velocity="1.0" lower="-2.792526" upper="2.792526"/>
            <axis xyz="0 0 1"/>
            <parent link="link_0"/>
            <child link="link_1"/>
    </joint>


    <!--link_2-->

    <link name="link_2">

            <inertial>
                <mass value="17.4" />
                <inertia ixx="0.13" iyy="0.524" izz="0.539" ixy="0" ixz="0" iyz="0" />
            </inertial>

            <visual>
                <geometry>
                    <box size="0 ...
(more)
edit flag offensive delete link more

Comments

I have the inertial properties specified but still get the error..Any ideas?

costashatz gravatar imagecostashatz ( 2014-01-25 04:15:29 -0500 )edit

Never mind..I was making an error on the inertial parameters...Thanks

costashatz gravatar imagecostashatz ( 2014-01-25 04:39:22 -0500 )edit

Would you mind updating the urdf file so that it shows how to successfully convert to sdf?

cstew gravatar imagecstew ( 2014-04-02 10:06:19 -0500 )edit
1

I updated the urdf file so that you can see the changes. Actually there are also some minor changes, however the important ones are about the "base" and "link_0" links. The problem is solved when I specify their inertial properties like mass and inertia.

Sezgin S. gravatar imageSezgin S. ( 2014-04-07 21:38:58 -0500 )edit
0

answered 2014-01-24 07:07:30 -0500

costashatz gravatar image

I have the exact same problem...@Sezgin S.: Did you come up with something?

edit flag offensive delete link more

Comments

The blank sdf output occurs when there is an error in parsing the URDF...

Yashodhan gravatar imageYashodhan ( 2014-04-17 05:29:03 -0500 )edit
0

answered 2014-06-24 03:22:41 -0500

peci1 gravatar image

There is also the issue that fixed joints disappeared in SDF. So if you have a fixed joint in your URDF, you have to convert it to a revolute joint with zero limits.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-12-03 12:51:17 -0500

Seen: 1,966 times

Last updated: Jun 24 '14