# Include multiple robot description files in one sdf file

Hi everyone,

I got a robot description which consists of two sdf (model) files. A file for the robot base and a file for the robot arm. Right now I include the arm in the base file, if I want to spawn the complete robot in Gazebo. If I only need the base I have to comment out the arm include. This process is really annoying.

I would like to have two basic sdf model files which I can spawn/launch in Gazebo without commenting out includes or to change the code in two or more files, if I for example extend the base model.

One file (robot_base_only) should only have the include for the base, which works without problems.

<?xml version="1.0" ?>
<sdf version="1.3">

<!-- BASE MODEL INCLUDE incl. base plugins in the base sdf-->
<include>
<!-- Folder name of the model -->
<uri>model://scitos</uri>
<pose>0 0 0   0 0 0</pose>
</include>

</sdf>


And one file (robot_base_and_arm) with base and arm includes, which doesn't work. That is because the joint between the base and the arm, which originally used to be in the base, won't work under the SDF tag.

<?xml version="1.0" ?>
<sdf version="1.3">

<!-- BASE MODEL INCLUDE incl. base plugins in the base sdf-->
<include>
<!-- Folder name of the model -->
<uri>model://scitos</uri>
<name>scitos</name>
<pose>0 0 0   0 0 0</pose>
</include>

<joint name="base_to_arm_base_joint" type="revolute">
<!-- Namespace::name of the link where the arm will be connected -->
<axis>
<xyz>0 0 1</xyz>
<limit>
<upper>0</upper>
<lower>0</lower>
</limit>
</axis>
</joint>

<!-- ARM MODEL INCLUDE incl. arm model plugins in the arm sdf-->
<include>
<!-- Folder name of the model -->
<uri>model://scitos_arm</uri>
<name>scitos_arm</name>
<pose>0 0 0.63 0 0 0</pose>
</include>

</sdf>


Maybe you guys can help me.

Christoph

edit retag close merge delete

Sort by » oldest newest most voted

I tried to swap the connecting joint from the robot base to a new model description. There I wanted to include the base and the arm, but that way doesn't work either.

<?xml version="1.0" ?>
<sdf version="1.3">

<!-- Model Name = Namespace -->
<model name="scitos_arm_and_base">

<joint name="base_to_arm_base_joint" type="revolute">
<!-- Namespace::name of the link where the arm will be connected -->
<axis>
<xyz>0 0 1</xyz>
<limit>
<upper>0</upper>
<lower>0</lower>
</limit>
</axis>
</joint>

<!-- BASE MODEL INCLUDE incl. base plugins in the base sdf-->
<include>
<!-- Folder name of the model -->
<uri>model://scitos</uri>
<name>scitos</name>
<pose>0 0 0   0 0 0</pose>
</include>

<!-- ARM MODEL INCLUDE incl. arm model plugins in the arm sdf-->
<include>
<!-- Folder name of the model -->
<uri>model://scitos_arm</uri>
<name>scitos_arm</name>
<pose>-0.075 0 0.63 0 0 0</pose> <!-- x-Wert: (0 + -0.075) -->
</include>

</model>
</sdf>


The robot preview in Gazebo shows the whole robot with it's arm. But when I spawn it I got the following error:

gazebo: /usr/include/boost/smartptr/sharedptr.hpp:418: T* boost::shared_ptr<t>::operator->() const [with T = gazebo::physics::Joint]: Assertion px != 0' failed.

Playing around with the namespace definitions only result in error messages about links that could not be found.

more

Comment out the joint in this SDF, load the SDF, then save the world using the GUI. Take a look at the names given to links in the scitos and scitos_arm` models. Use those link names in the joint SDF.

( 2013-06-18 00:25:35 -0600 )edit

Hi! I followed your approach and saved the world. Therefore I had to pause the simulation because otherwise it would crash with just the same error message as before. In the SDF file I could see that the names are just the same as the ones I already use. An attempt to leave out one of the namespaces ended up with the following message: *Couldn't Find Child Link[arm_base_link]*. I think that indicates that the link itself was found.

( 2013-06-18 07:49:55 -0600 )edit

I am having a similar problem. I have two sub models, with the joint fixed. The model will spawn, but afterwards I am having problems access joints via plugins. Do you have plugins for the two models? Are the joint names being confused between the two sub models? In mine, I can get the joint pointers and read the joint limits, but the joint axes seem to have changed. One work around you could try is to test if a fixed joint solves the problem, and if so add an extra revolute joint in a submodel.

( 2017-06-06 18:53:50 -0600 )edit