Reusable Components in URDF

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

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

<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

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

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 .

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…

1 Like

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.

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

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.

Hi,

Is not ROBOTCad what you want?

PĂ©ter