DEV Community

Ravindhar
Ravindhar

Posted on

Convert URDF to MuJoCo MJCF Without Installing Anything API + Python SDK

  1. The Problem (3 paragraphs)

    • MuJoCo is the fastest-growing robotics simulator
    • Converting URDF to MJCF is painful (./compile is buggy, urdf2mjcf ignores off-diagonal inertia, mesh paths break)
    • You just want to convert and start training your RL agent
  2. The Solution (show curl + Python code)
    curl -X POST .../api/urdf/convert-format?target=mjcf \
    -H "X-Api-Key: rk_..." -F "file=@robot.urdf"

import roboinfra
client = roboinfra.Client("rk_...")
result = client.urdf.convert_format("robot.urdf", "mjcf")
with open("robot.xml", "w") as f:
f.write(result.converted_xml)

  1. Real Example (use your preview_test_arm.urdf)

    • Show the input URDF (6 links, 5 joints)
    • Show the output MJCF (with actuators, floor, lighting)
    • "This would take 2-3 hours manually. API did it in 200ms."
  2. Also Converts to Gazebo SDF

    • Same API, just change target=sdf
    • Show the SDF output
  3. Bonus: Validate + Convert in CI

    • GitHub Action YAML (6 lines)
    • Validate URDF + convert to MJCF on every push
  4. Free 14-day Pro trial, no credit card
    Link: https://roboinfra-dashboard.azurewebsites.net

Top comments (1)

Collapse
 
ravindhar profile image
Ravindhar • Edited

I'm a solo developer building RoboInfra an API platform for
robotics developers.

The problem: everyone working with MuJoCo needs MJCF files, but
most robot definitions are in URDF format. The existing converters
(MuJoCo's ./compile, urdf2mjcf, etc.) all have issues — off-diagonal
inertia ignored, mesh paths broken, base links deleted.

My API handles:

  • All 6 URDF joint types → MJCF (revolute→hinge, prismatic→slide, etc.)
  • Full inertia tensors (not just diagonal)
  • Visual + collision geometry
  • Auto-generated actuators
  • Also converts to Gazebo SDF

14-day Pro trial (no credit card): [link]
Python SDK: pip install roboinfra-sdk