# Reusable Components in URDF

**URL:** <https://discourse.openrobotics.org/t/reusable-components-in-urdf/42519>\
**Category:** robot description formats\
**Tags:** urdf\
**Created:** [March 13, 2025, 7:06pm UTC](https://discourse.openrobotics.org/t/reusable-components-in-urdf/42519 "2025-03-13T19:06:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![artineering](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/artineering/32/18635_2.png) [@artineering](https://discourse.openrobotics.org/u/artineering)\
**Post date:** [March 13, 2025, 7:06pm UTC](https://discourse.openrobotics.org/t/reusable-components-in-urdf/42519/1 "2025-03-13T19:06:47Z")

</div>

I am working on a MATLAB toolbox to build URDF files for robots in an object-oriented fashion. One of the features I am planning to add to the toolbox is to create a reusable component that can be added to a robot definition multiple times as instances with their own set of parameter values.

Here is the link to the toolbox: [GitHub - artineering/robotBuilder\_matlab: A MATLAB toolkit for programmatically creating, modifying, and managing URDF (Unified Robot Description Format) files](https://github.com/artineering/robotBuilder_matlab)

I would appreciate feedback on this idea. Also, I would like to start a conversation on how we can introduce the idea of reusable components in a typical URDF file.

For example:  
robot.urdf file: foo.urdf

```auto
<robot name="foo">
         <component name="bar" src="bar.urdf">
         ...
        <component_instance name="bar" instanceName="tango">
              <param name="prop1" value="42>
             ....
       </component_instance>
</robot>

```

component urdf file: bar.urdf

```auto
<component name="foo">
       <link name="link1">
         ....
       </link>
      <link name="link2">
         ....
       </link>
       <joint name="joint1">
         <parent name="link1">
         <child name="link2">
         ....
       </joint>
      <parameter name="prop1" path="foo.link1.someProperty" defaultValue=0>
       ...
</component>

```

thoughts?

For some of the complex urdf definitions I am trying out, components would reduce the size of the urdf file by an order of magnitude and make it much more readable as well.

---

<div class="post-metadata">

**Author:** ![peci1](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/peci1/32/10145_2.png) [@peci1](https://discourse.openrobotics.org/u/peci1)\
**Post date:** [March 13, 2025, 10:41pm UTC](https://discourse.openrobotics.org/t/reusable-components-in-urdf/42519/2 "2025-03-13T22:41:36Z")

</div>

This is a great initiative.

The current best practice is to provide Xacro macros that generate the “component”. See e.g. [depthai-ros/depthai\_descriptions/urdf at noetic · luxonis/depthai-ros · GitHub](https://github.com/luxonis/depthai-ros/tree/noetic/depthai_descriptions/urdf) .

However, the problem with this approach is that the structural information provided in Xacro is lost after the conversion to URDF is performed. And personally, I haven’t seen any tools that would allow editing the robot model directly as Xacro. All robot model editors assume URDF. So if you generate the model from Xacro and do some edits, there is no automated way of getting these edits back to the source Xacro.

If there were some similar structural elements in URDF itself, it would be much easier to do this kind of composition. But as discussed elsewhere recently, the probability of some radical changes to the URDF format is quite low at this moment…

---

<div class="post-metadata">

**Author:** ![artineering](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/artineering/32/18635_2.png) [@artineering](https://discourse.openrobotics.org/u/artineering)\
**Post date:** [March 14, 2025, 1:50pm UTC](https://discourse.openrobotics.org/t/reusable-components-in-urdf/42519/3 "2025-03-14T13:50:54Z")

</div>

Thank you for your insight, @peci1!

Yes, I have been looking at Xacro and have always felt its syntax is non-intuitive and has a difficult ramp-up for new users. That was the main reason for trying to build a toolkit that takes away some of that pain in having to understand xacro along with the urdf structure.

My end goal is to make a graphical editor that avoids having to edit the urdf file manually and treat urdf files as a final output which can be directly without having to go through an additional step of xacro compilation.

I am also planning to use the in-memory robot counterpart of the loaded urdf as the basis for developing further analytical tools.

---

<div class="post-metadata">

**Author:** ![peci1](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/peci1/32/10145_2.png) [@peci1](https://discourse.openrobotics.org/u/peci1)\
**Post date:** [March 14, 2025, 2:17pm UTC](https://discourse.openrobotics.org/t/reusable-components-in-urdf/42519/4 "2025-03-14T14:17:57Z")

</div>

If your only goal is to have a GUI for building URDF models, search this forum. There have been multiple such projects already announced.

---

<div class="post-metadata">

**Author:** ![artineering](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/artineering/32/18635_2.png) [@artineering](https://discourse.openrobotics.org/u/artineering)\
**Post date:** [March 14, 2025, 2:24pm UTC](https://discourse.openrobotics.org/t/reusable-components-in-urdf/42519/5 "2025-03-14T14:24:32Z")

</div>

The GUI is one of the options I am considering. The main goal is to build analytical tools for studying the kinematic structure of the robot.

---

<div class="post-metadata">

**Author:** ![borkutip](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/borkutip/32/21650_2.png) [@borkutip](https://discourse.openrobotics.org/u/borkutip)\
**Post date:** [March 14, 2025, 5:34pm UTC](https://discourse.openrobotics.org/t/reusable-components-in-urdf/42519/6 "2025-03-14T17:34:50Z")

</div>

Hi,

Is not ROBOTCad what you want?

> [@RobotCAD 6 - Reforged released!](http://discourse.ros.org/t/robotcad-6-reforged-released/42024):
>
> [robotcad\_reforged] It gives a set of new tools and improve old ones. Adds new controllers: Mecanum drive controller (with option to generate all code of wheels friction), GPIO controller. Adds new sensor - Wide angle camera. This release has fixed all found bugs and has reforged collision and inertia generation system that let you create collisions, meshes and calculation of inertia/mass for complex Parts (with many bodies inside) bound to the robot link. [Change log](https://github.com/drfenixion/freecad.robotcad/discussions/60)[https://github.com/drfen…](https://github.com/drfenixion/freecad.robotcad)

Péter

---

<div class="post-metadata">

**Author:** ![artineering](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/artineering/32/18635_2.png) [@artineering](https://discourse.openrobotics.org/u/artineering)\
**Post date:** [March 18, 2025, 1:59pm UTC](https://discourse.openrobotics.org/t/reusable-components-in-urdf/42519/7 "2025-03-18T13:59:56Z")

</div>

Indeed 🙂

I will take a look at it and see how it fits into my requirements.

---

<div class="post-metadata">

**Author:** ![artineering](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/artineering/32/18635_2.png) [@artineering](https://discourse.openrobotics.org/u/artineering)\
**Post date:** [March 18, 2025, 3:09pm UTC](https://discourse.openrobotics.org/t/reusable-components-in-urdf/42519/8 "2025-03-18T15:09:52Z")

</div>

why do all open-source tools have to be so difficult to install and run! So, I have failed to install RobotCad or even run it on the provided docker image.

This is one of the biggest bottlenecks I have faced as a student and researcher when it comes to using open-source software. There is just so much gap between what is documented and the reality that it almost feels not worth investing any time on it.

---

<div class="post-metadata">

**Author:** ![fenixionsoul](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/fenixionsoul/32/22355_2.png) [@fenixionsoul](https://discourse.openrobotics.org/u/fenixionsoul)\
**Post date:** [March 19, 2025, 2:48pm UTC](https://discourse.openrobotics.org/t/reusable-components-in-urdf/42519/9 "2025-03-19T14:48:32Z")

</div>

Hello, there is one line command to install and run RobotCAD on Ubuntu. [https://github.com/drfenixion/freecad.robotcad?tab=readme-ov-file#fast-install-and-run](https://github.com/drfenixion/freecad.robotcad?tab=readme-ov-file#fast-install-and-run)

If you have faced to “Segmentation fault” use that command for fix.  
[https://github.com/drfenixion/freecad.robotcad?tab=readme-ov-file#fix-segmentation-fault-if-faced](https://github.com/drfenixion/freecad.robotcad?tab=readme-ov-file#fix-segmentation-fault-if-faced)

You also can install RobotCAD by Addon Manager of FreeCAD.  
[https://github.com/drfenixion/freecad.robotcad#Installation](https://github.com/drfenixion/freecad.robotcad#Installation)

If you faced with any other problem please add issue to repository.

---

<div class="post-metadata">

**Author:** ![gavanderhoorn](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/gavanderhoorn/32/969_2.png) [@gavanderhoorn](https://discourse.openrobotics.org/u/gavanderhoorn)\
**Post date:** [March 19, 2025, 3:18pm UTC](https://discourse.openrobotics.org/t/reusable-components-in-urdf/42519/10 "2025-03-19T15:18:40Z")

</div>

> [@artineering](#):
>
> why do all open-source tools have to be so difficult to install and run!

perhaps because those tools / projects are labours of love and/or rely on volunteers instead of having a multi-million/billion dollar company behind them that has the resources to exhaustively test on `N` different systems / OS / software versions – so your system is likely to be unique among the deployed base of that tool and problems unique to your situation are likely to only be discovered by you.

(in other words: what gets tested & documented is whatever the author and his/her collaborators have access to & are using themselves)

Comparing this aspect of tools like the one created by @fenixionsoul to non-_open-source tools_ is not really realistic, exactly because of this.

(although having written that: the number of times commercial tools like SolidWorks, Catia or even Microsoft Word have unexplainably crashed or done strange things is also decidedly _non-zero_ for me and my colleagues)
