Wie man URDF in Mujoco mit urdf2mjcf konvertiert

Schritt 1: Installieren Sie urdf2mjcf

install_urdf2mjcf.sh
pip install -U urdf2mjcf==0.2.2

Die spezifische Version ist wichtig, um https://github.com/kscalelabs/urdf2mjcf/issues/18 zu vermeiden (ModuleNotFoundError: No module named ‘urdf2mjcf.postprocess’)

Schritt 2: Konvertieren Sie Ihr URDF

convert_urdf.sh
urdf2mjcf myrobot.urdf --output myrobot.mujoco.xml

Beispiel-Ausgabe

urdf2mjcf_warnings.txt
WARNING 2025-02-11 21:49:44 [urdf2mjcf.convert] Warning: off-diagonal inertia terms for link 'base' are nonzero and will be ignored.
WARNING 2025-02-11 21:49:44 [urdf2mjcf.convert] Warning: off-diagonal inertia terms for link 'shoulder' are nonzero and will be ignored.
WARNING 2025-02-11 21:49:44 [urdf2mjcf.convert] Warning: off-diagonal inertia terms for link 'upperarm' are nonzero and will be ignored.
WARNING 2025-02-11 21:49:44 [urdf2mjcf.convert] Warning: off-diagonal inertia terms for link 'elbow' are nonzero and will be ignored.
WARNING 2025-02-11 21:49:44 [urdf2mjcf.convert] Warning: off-diagonal inertia terms for link 'forearm' are nonzero and will be ignored.
WARNING 2025-02-11 21:49:44 [urdf2mjcf.convert] Warning: off-diagonal inertia terms for link 'wrist_1' are nonzero and will be ignored.
  INFO  2025-02-11 21:49:44 [urdf2mjcf.convert] Auto-detected base offset: -0.085 (min z = 0.085)

Check out similar posts by category: Mujoco, Robotics