Ask Your Question

# Revision history [back]

### Links and joints don't appear in generated SDF

I'm using ROS and Gazebo and I'm a bit mystified by the URDF to SDF conversion process. It appears that all links except the base_link, and all joints, are not added to the generated SDF file. What I get is a single link with 1 combined inertial section and multiple collision and visual sections. Most of the names are mangled.

I'm writing a plugin that applies force to some joints, and I need to get the joint poses. I see plugin code that enumerates links and joints looking at name matches, but I suppose that this is only possible if I hand-build an SDF file? Is there a preferred way to manage this?

For reference, here's a snippet of my roslaunch file showing how I'm injecting URDF files into Gazebo:

<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description -urdf -z 1 -model test"/>


### Links and joints don't appear in generated SDF

I'm using ROS and Gazebo and I'm a bit mystified by the URDF to SDF conversion process. It appears that all links except the base_link, and all joints, are not added to the generated SDF file. What I get is a single link with 1 combined inertial section and multiple collision and visual sections. Most of the names are mangled.

I'm writing a plugin that applies force to some joints, and I need to get the joint poses. I see plugin code that enumerates links and joints looking at name matches, but I suppose that this is only possible if I hand-build an SDF file? Is there a preferred way to manage this?

For reference, here's a snippet of my roslaunch file showing how I'm injecting URDF files into Gazebo:

<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description -urdf -z 1 -model test"/>


Updated: here's a stripped down URDF file that I used for testing:

<?xml version="1.0"?>
<robot name="test">
<link name="base_link">
<inertial>
<origin xyz="0 0 0"/>
<mass value="1"/>
<inertia
ixx="1.0" ixy="0.0" ixz="0.0"
iyy="1.0" iyz="0.0"
izz="1.0"/>
</inertial>
<visual>
<geometry>
<box size="1 1 1"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="1 1 1"/>
</geometry>
</collision>
</link>
<link name="two">
<inertial>
<origin xyz="0 0 0"/>
<mass value="2"/>
<inertia
ixx="1.0" ixy="0.0" ixz="0.0"
iyy="1.0" iyz="0.0"
izz="1.0"/>
</inertial>
<visual>
<geometry>
<box size="1 1 1"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="1 1 1"/>
</geometry>
</collision>
</link>
<joint name="base_link_to_two" type="fixed">
<origin rpy="0 0 0" xyz="0 0 0"/>
<parent link="base_link"/>
<child link="two"/>
</joint>
</robot>


Here's the resulting SDF:

<sdf version='1.6'>
<model name='test'>
<link name='base_link'>
<pose frame=''>0 0 0 0 -0 0</pose>
<inertial>
<pose frame=''>0 0 0 0 -0 0</pose>
<mass>3</mass>
<inertia>
<ixx>2</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>2</iyy>
<iyz>0</iyz>
<izz>2</izz>
</inertia>
</inertial>
<collision name='base_link_collision'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<box>
<size>1 1 1</size>
</box>
</geometry>
</collision>
<collision name='base_link_fixed_joint_lump__two_collision_1'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<box>
<size>1 1 1</size>
</box>
</geometry>
</collision>
<visual name='base_link_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<box>
<size>1 1 1</size>
</box>
</geometry>
</visual>
<visual name='base_link_fixed_joint_lump__two_visual_1'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<box>
<size>1 1 1</size>
</box>
</geometry>
</visual>
</link>
</model>
</sdf>