SDF to URDF conversion in 2025

Hi all,

it seems URDF, SDF and the conversion between them is a topic that keeps on giving. When I weekend-project created FusionSDF last year, I didn’t expect to actually still need URDFs anymore as SDFs can now be used for robot_description. Turns out I was too optimistic.

In either case, instead of porting 10+ years old ROS 1 code to ROS 2, I decided to leverage the more recent sdformat_urdf to convert SDF to URDF. Thanks to @sloretz, @quarkytale, @ahcorde and others for sdformat_urdf! My tool has the creative name sdf_to_urdf.

It consists of less then 50 lines of code, nearly all of it boilerplate. However, I didn’t find an already existing ROS 2 tool. Would be great to add the functionality directly to sdformat_urdf though (:wink:). Hence, here we are: sdf_to_urdf

Best,
Andreas

10 Likes

I didn’t expect to actually still need URDFs anymore as SDFs can now be used for robot_description.

This was our hope when we working on sdformat_urdf. I’m curious about where you ran into blockers to using SDF. Is it that sdformat_urdf isn’t being used or the XML is being accessed directly from robot_description? Or is there a more fundamental limitation?

The specific problem I ran into trying to work with only a SDF of a robot manipulator is finding the equivalent of the usual parameterized xacro includes for ros2_control to go back and forth between mock, sim and hardware control used in many URDF-based robot descriptions.

Edit: While it is possible to combine xacro with SDF, it is not something I have frequently seen in the wild and hence didn’t want to “pioneer” that route - thus far.