Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error parsing human URDF #49

Closed
evelyd opened this issue Nov 11, 2024 · 4 comments
Closed

Error parsing human URDF #49

evelyd opened this issue Nov 11, 2024 · 4 comments
Assignees

Comments

@evelyd
Copy link

evelyd commented Nov 11, 2024

I have been using Mujoco to visualize the robot model, and now I would like to do the same for the human model (I want to use this one: https://github.com/robotology/human-gazebo/tree/master/humanSubjectWithMeshes). I've been using jaxsim as a helper for this, but with the human model I get the following error when I call jaxsim's build_from_model_description on the human URDF:

Error Code 1: Msg: Error parsing XML in file [/tmp/tmpbdv_is_d/tmpup45_c3y.xml]: Error=XML_ERROR_PARSING_TEXT ErrorID=8 (0x8) Line number=1
Error: SDF parsing the xml failed.

Traceback (most recent call last):
  File "/home/evelyd/miniforge3/envs/baf/lib/python3.11/site-packages/rod/utils/gazebo.py", line 106, in process_model_description_with_sdformat
    cp = subprocess.run(
         ^^^^^^^^^^^^^^^
  File "/home/evelyd/miniforge3/envs/baf/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/home/evelyd/miniforge3/envs/baf/bin/gz', 'sdf', '-p', '/tmp/tmpbdv_is_d/tmpup45_c3y.xml']' returned non-zero exit status 255.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/evelyd/pi_learning_for_collaborative_carrying/scripts/retarget_onto_robot.py", line 49, in <module>
    js_model = js.model.JaxSimModel.build_from_model_description(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/evelyd/miniforge3/envs/baf/lib/python3.11/site-packages/jaxsim/api/model.py", line 120, in build_from_model_description
    intermediate_description = jaxsim.parsers.rod.build_model_description(
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/evelyd/miniforge3/envs/baf/lib/python3.11/site-packages/jaxsim/parsers/rod/parser.py", line 358, in build_model_description
    sdf_data = extract_model_data(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/evelyd/miniforge3/envs/baf/lib/python3.11/site-packages/jaxsim/parsers/rod/parser.py", line 58, in extract_model_data
    sdf_element = rod.Sdf.load(sdf=model_description, is_urdf=is_urdf)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/evelyd/miniforge3/envs/baf/lib/python3.11/site-packages/rod/sdf/sdf.py", line 95, in load
    sdf_string = GazeboHelper.process_model_description_with_sdformat(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/evelyd/miniforge3/envs/baf/lib/python3.11/site-packages/rod/utils/gazebo.py", line 116, in process_model_description_with_sdformat
    raise RuntimeError(
RuntimeError: Failed to process the input with sdformat

It seems to maybe be an issue with rod based on the error content. My versions of rod and jaxsim are as follows:

rod                       0.3.3              pyhd8ed1ab_0    conda-forge
jaxsim                    0.4.2              pyhd8ed1ab_1    conda-forge

Is there some intermediate step I need to perform here, or something I should change in the urdf file?

@flferretti flferretti self-assigned this Nov 11, 2024
@flferretti
Copy link
Collaborator

flferretti commented Nov 11, 2024

Hi @evelyd! I wasn't able to reproduce your error with the package versions that you mentioned. Could you please ensure that the argument passed to JaxSim is a pathlib.Path?

I report here what worked for me:

from pathlib import Path
urdf_path = Path(
    "/home/flferretti/human-gazebo/humanSubjectWithMeshes/humanSubjectWithMesh.urdf"
)

# Test 1: Try to load the URDF using ROD
from rod import Sdf
_ = Sdf.load(urdf_path)

# Test 2: Loading using JaxSim
import jaxsim.api as js
_ = js.model.JaxSimModel.build_from_model_description(model_description=urdf_path)
conda list

# packages in environment at /home/flferretti/miniforge3/envs/testjaxsim:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
absl-py                   2.1.0              pyhd8ed1ab_0    conda-forge
aom                       3.9.1                hac33072_0    conda-forge
asttokens                 2.4.1              pyhd8ed1ab_0    conda-forge
brotli                    1.1.0                hb9d3cd8_2    conda-forge
brotli-bin                1.1.0                hb9d3cd8_2    conda-forge
bzip2                     1.0.8                h4bc722e_7    conda-forge
c-ares                    1.34.3               heb4867d_0    conda-forge
ca-certificates           2024.8.30            hbcca054_0    conda-forge
cairo                     1.18.0               hebfffa5_3    conda-forge
certifi                   2024.8.30          pyhd8ed1ab_0    conda-forge
cli11                     2.4.1                h59595ed_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
coloredlogs               15.0.1             pyhd8ed1ab_3    conda-forge
console_bridge            1.0.2                h924138e_1    conda-forge
contourpy                 1.3.0           py313h33d0bda_2    conda-forge
cuda-crt-tools            12.6.77              ha770c72_2    conda-forge
cuda-cudart               12.6.77              h5888daf_0    conda-forge
cuda-cudart_linux-64      12.6.77              h3f2d84a_0    conda-forge
cuda-cupti                12.6.80              hbd13f7d_0    conda-forge
cuda-nvcc-tools           12.6.77              he02047a_2    conda-forge
cuda-nvrtc                12.6.77              hbd13f7d_0    conda-forge
cuda-nvtx                 12.6.77              hbd13f7d_0    conda-forge
cuda-nvvm-tools           12.6.77              he02047a_2    conda-forge
cuda-version              12.6                 h7480c83_3    conda-forge
cudnn                     9.3.0.75             h93bb076_0    conda-forge
cycler                    0.12.1             pyhd8ed1ab_0    conda-forge
dav1d                     1.2.1                hd590300_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
docstring_parser          0.16               pyhd8ed1ab_0    conda-forge
eigen                     3.4.0                h00ab1b0_0    conda-forge
elfutils                  0.192                h1fa0c75_0    conda-forge
etils                     1.10.0             pyhd8ed1ab_0    conda-forge
exceptiongroup            1.2.2              pyhd8ed1ab_0    conda-forge
executing                 2.1.0              pyhd8ed1ab_0    conda-forge
ffmpeg                    7.1.0           gpl_hbb807a5_703    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 h77eed37_3    conda-forge
fontconfig                2.15.0               h7e30c49_1    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
fonttools                 4.54.1          py313h8060acc_1    conda-forge
freetype                  2.12.1               h267a509_2    conda-forge
fribidi                   1.0.10               h36c2ea0_0    conda-forge
frozendict                2.4.6           py313h536fd9c_0    conda-forge
fsspec                    2024.10.0          pyhff2d567_0    conda-forge
gdbm                      1.18                 h0a1914f_2    conda-forge
gdk-pixbuf                2.42.12              hb9ae30d_0    conda-forge
gettext                   0.22.5               he02047a_3    conda-forge
gettext-tools             0.22.5               he02047a_3    conda-forge
glfw                      3.4                  hd590300_0    conda-forge
gmp                       6.3.0                hac33072_2    conda-forge
gnutls                    3.8.8                h2d3e045_0    conda-forge
graphite2                 1.3.13            h59595ed_1003    conda-forge
gz-tools2                 2.0.1                ha770c72_0    conda-forge
harfbuzz                  9.0.0                hda332d3_1    conda-forge
humanfriendly             10.0               pyhd81877a_7    conda-forge
icu                       75.1                 he02047a_0    conda-forge
importlib-metadata        8.5.0              pyha770c72_0    conda-forge
importlib_resources       6.4.5              pyhd8ed1ab_0    conda-forge
ipython                   8.29.0             pyh707e725_0    conda-forge
jax                       0.4.34             pyhd8ed1ab_0    conda-forge
jax-dataclasses           1.6.1              pyhd8ed1ab_0    conda-forge
jaxlib                    0.4.34          cuda120py313h3b1fb80_200    conda-forge
jaxlie                    1.4.1              pyhd8ed1ab_0    conda-forge
jaxsim                    0.4.2              pyhd8ed1ab_1    conda-forge
jedi                      0.19.1             pyhd8ed1ab_0    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
kiwisolver                1.4.7           py313h33d0bda_0    conda-forge
krb5                      1.21.3               h659f571_0    conda-forge
lame                      3.100             h166bdaf_1003    conda-forge
lcms2                     2.16                 hb7c19ff_0    conda-forge
ld_impl_linux-64          2.43                 h712a8e2_2    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libabseil                 20240722.0      cxx17_h5888daf_1    conda-forge
libarchive                3.7.4                hfca40fe_0    conda-forge
libasprintf               0.22.5               he8f35ee_3    conda-forge
libasprintf-devel         0.22.5               he8f35ee_3    conda-forge
libass                    0.17.3               h1dc1e6a_0    conda-forge
libblas                   3.9.0           25_linux64_openblas    conda-forge
libbrotlicommon           1.1.0                hb9d3cd8_2    conda-forge
libbrotlidec              1.1.0                hb9d3cd8_2    conda-forge
libbrotlienc              1.1.0                hb9d3cd8_2    conda-forge
libcblas                  3.9.0           25_linux64_openblas    conda-forge
libccd-double             2.1                  h59595ed_3    conda-forge
libcublas                 12.6.3.3             hbd13f7d_1    conda-forge
libcufft                  11.3.0.4             hbd13f7d_0    conda-forge
libcurand                 10.3.7.77            hbd13f7d_0    conda-forge
libcurl                   8.10.1               hbbe4b11_0    conda-forge
libcusolver               11.7.1.2             hbd13f7d_0    conda-forge
libcusparse               12.5.4.2             hbd13f7d_0    conda-forge
libdeflate                1.22                 hb9d3cd8_0    conda-forge
libdrm                    2.4.123              hb9d3cd8_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libegl                    1.7.0                ha4b6fd6_1    conda-forge
libev                     4.33                 hd590300_2    conda-forge
libexpat                  2.6.4                h5888daf_0    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc                    14.2.0               h77fa898_1    conda-forge
libgcc-ng                 14.2.0               h69a702a_1    conda-forge
libgettextpo              0.22.5               he02047a_3    conda-forge
libgettextpo-devel        0.22.5               he02047a_3    conda-forge
libgfortran               14.2.0               h69a702a_1    conda-forge
libgfortran5              14.2.0               hd5240d6_1    conda-forge
libgl                     1.7.0                ha4b6fd6_1    conda-forge
libglib                   2.82.2               h2ff4ddf_0    conda-forge
libglvnd                  1.7.0                ha4b6fd6_1    conda-forge
libglx                    1.7.0                ha4b6fd6_1    conda-forge
libgomp                   14.2.0               h77fa898_1    conda-forge
libgrpc                   1.65.5               hf5c653b_0    conda-forge
libgz-cmake3              3.5.3                hac33072_0    conda-forge
libgz-math7               7.5.1                h5888daf_2    conda-forge
libgz-tools2              2.0.1                h4149140_0    conda-forge
libgz-utils2              2.2.0                h5888daf_0    conda-forge
libhwloc                  2.11.2          default_he43201b_1000    conda-forge
libiconv                  1.17                 hd590300_2    conda-forge
libidn2                   2.3.7                hd590300_0    conda-forge
libjpeg-turbo             3.0.0                hd590300_1    conda-forge
liblapack                 3.9.0           25_linux64_openblas    conda-forge
libmicrohttpd             1.0.1                hbc5bc17_1    conda-forge
libmpdec                  4.0.0                h4bc722e_0    conda-forge
libmujoco                 3.2.5                h1419bf0_0    conda-forge
libnghttp2                1.64.0               h161d5f1_0    conda-forge
libnvjitlink              12.6.77              hbd13f7d_1    conda-forge
libopenblas               0.3.28          pthreads_h94d23a6_1    conda-forge
libopenvino               2024.4.0             hac27bb2_1    conda-forge
libopenvino-auto-batch-plugin 2024.4.0             h4d9b6c2_1    conda-forge
libopenvino-auto-plugin   2024.4.0             h4d9b6c2_1    conda-forge
libopenvino-hetero-plugin 2024.4.0             h3f63f65_1    conda-forge
libopenvino-intel-cpu-plugin 2024.4.0             hac27bb2_1    conda-forge
libopenvino-intel-gpu-plugin 2024.4.0             hac27bb2_1    conda-forge
libopenvino-intel-npu-plugin 2024.4.0             hac27bb2_1    conda-forge
libopenvino-ir-frontend   2024.4.0             h3f63f65_1    conda-forge
libopenvino-onnx-frontend 2024.4.0             he882d9a_1    conda-forge
libopenvino-paddle-frontend 2024.4.0             he882d9a_1    conda-forge
libopenvino-pytorch-frontend 2024.4.0             h5888daf_1    conda-forge
libopenvino-tensorflow-frontend 2024.4.0             h9718a47_1    conda-forge
libopenvino-tensorflow-lite-frontend 2024.4.0             h5888daf_1    conda-forge
libopus                   1.3.1                h7f98852_1    conda-forge
libpciaccess              0.18                 hd590300_0    conda-forge
libpng                    1.6.44               hadc24fc_0    conda-forge
libprotobuf               5.27.5               h5b01275_2    conda-forge
libre2-11                 2024.07.02           hbbce691_1    conda-forge
librsvg                   2.58.4               hc0ffecb_0    conda-forge
libsdformat13             13.6.0               h71010b8_5    conda-forge
libsqlite                 3.47.0               hadc24fc_1    conda-forge
libssh2                   1.11.0               h0841786_0    conda-forge
libstdcxx                 14.2.0               hc0a3c3a_1    conda-forge
libstdcxx-ng              14.2.0               h4852527_1    conda-forge
libtasn1                  4.19.0               h166bdaf_0    conda-forge
libtiff                   4.7.0                he137b08_1    conda-forge
libunistring              0.9.10               h7f98852_0    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libva                     2.22.0               h8a09558_1    conda-forge
libvpx                    1.14.1               hac33072_0    conda-forge
libwebp-base              1.4.0                hd590300_0    conda-forge
libxcb                    1.17.0               h8a09558_0    conda-forge
libxcrypt                 4.4.36               hd590300_1    conda-forge
libxkbcommon              1.7.0                h2c5496b_1    conda-forge
libxml2                   2.13.4               hb346dea_2    conda-forge
libxslt                   1.1.39               h76b75d6_0    conda-forge
libzlib                   1.3.1                hb9d3cd8_2    conda-forge
lodepng                   20220109             h924138e_0    conda-forge
lxml                      5.3.0           py313h6eb7059_2    conda-forge
lz4-c                     1.9.4                hcb278e6_0    conda-forge
lzo                       2.10              hd590300_1001    conda-forge
markdown-it-py            3.0.0              pyhd8ed1ab_0    conda-forge
mashumaro                 3.14               pyhd8ed1ab_0    conda-forge
matplotlib-base           3.9.2           py313h129903b_2    conda-forge
matplotlib-inline         0.1.7              pyhd8ed1ab_0    conda-forge
mdurl                     0.1.2              pyhd8ed1ab_0    conda-forge
mediapy                   1.2.2              pyhd8ed1ab_0    conda-forge
ml_dtypes                 0.5.0           py313ha87cce1_0    conda-forge
mujoco                    3.2.5                h38be061_0    conda-forge
mujoco-python             3.2.5           py313h41bf798_0    conda-forge
mujoco-samples            3.2.5                h5888daf_0    conda-forge
mujoco-simulate           3.2.5                h5888daf_0    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
nccl                      2.23.4.1             h52f6c39_2    conda-forge
ncurses                   6.5                  he02047a_1    conda-forge
nettle                    3.9.1                h7ab15ed_0    conda-forge
numpy                     2.1.3           py313h4bf6692_0    conda-forge
ocl-icd                   2.3.2                hd590300_1    conda-forge
openh264                  2.4.1                h59595ed_0    conda-forge
openjpeg                  2.5.2                h488ebb8_0    conda-forge
openssl                   3.3.2                hb9d3cd8_0    conda-forge
opt-einsum                3.4.0                hd8ed1ab_0    conda-forge
opt_einsum                3.4.0              pyhd8ed1ab_0    conda-forge
p11-kit                   0.24.1               hc5aa10d_0    conda-forge
packaging                 24.1               pyhd8ed1ab_0    conda-forge
pango                     1.54.0               h4c5309f_1    conda-forge
parso                     0.8.4              pyhd8ed1ab_0    conda-forge
pcre2                     10.44                hba22ea6_2    conda-forge
pexpect                   4.9.0              pyhd8ed1ab_0    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    11.0.0          py313h2d7ed13_0    conda-forge
pip                       24.3.1             pyh145f28c_0    conda-forge
pixman                    0.43.2               h59595ed_0    conda-forge
pptree                    3.1                pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.48             pyha770c72_0    conda-forge
pthread-stubs             0.4               hb9d3cd8_1002    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pugixml                   1.14                 h59595ed_0    conda-forge
pure_eval                 0.2.3              pyhd8ed1ab_0    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pyglfw                    2.7.0              pyha770c72_1    conda-forge
pygments                  2.18.0             pyhd8ed1ab_0    conda-forge
pyopengl                  3.1.6              pyhd8ed1ab_1    conda-forge
pyparsing                 3.2.0              pyhd8ed1ab_1    conda-forge
python                    3.13.0          h9ebbce0_100_cp313    conda-forge
python-dateutil           2.9.0              pyhd8ed1ab_0    conda-forge
python_abi                3.13                    5_cp313    conda-forge
pyyaml                    6.0.2           py313h536fd9c_1    conda-forge
qhull                     2020.2               h434a139_5    conda-forge
re2                       2024.07.02           h77b4e00_1    conda-forge
readline                  8.2                  h8228510_1    conda-forge
resolve-robotics-uri-py   0.3.0              pyhd8ed1ab_0    conda-forge
rich                      13.9.4             pyhd8ed1ab_0    conda-forge
rod                       0.3.3              pyhd8ed1ab_0    conda-forge
ruby                      3.3.6                he7af4c9_0    conda-forge
scipy                     1.14.1          py313h27c5614_1    conda-forge
shtab                     1.7.1              pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snappy                    1.2.1                ha2e4443_0    conda-forge
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
svt-av1                   2.3.0                h5888daf_0    conda-forge
tbb                       2022.0.0             hceb3a55_0    conda-forge
tinyxml2                  10.0.0               h59595ed_0    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
traitlets                 5.14.3             pyhd8ed1ab_0    conda-forge
trimesh                   4.5.2              pyhd8ed1ab_0    conda-forge
typing-extensions         4.12.2               hd8ed1ab_0    conda-forge
typing_extensions         4.12.2             pyha770c72_0    conda-forge
tyro                      0.8.14             pyhd8ed1ab_0    conda-forge
tzdata                    2024b                hc8b5060_0    conda-forge
urdfdom                   4.0.1                h7fd8c06_0    conda-forge
urdfdom_headers           1.1.2                h84d6215_0    conda-forge
wayland                   1.23.1               h3e06ad9_0    conda-forge
wayland-protocols         1.37                 hd8ed1ab_0    conda-forge
wcwidth                   0.2.13             pyhd8ed1ab_0    conda-forge
x264                      1!164.3095           h166bdaf_2    conda-forge
x265                      3.5                  h924138e_3    conda-forge
xkeyboard-config          2.43                 hb9d3cd8_0    conda-forge
xmltodict                 0.14.2             pyhd8ed1ab_0    conda-forge
xorg-libice               1.1.1                hb9d3cd8_1    conda-forge
xorg-libsm                1.2.4                he73a12e_1    conda-forge
xorg-libx11               1.8.10               h4f16b4b_0    conda-forge
xorg-libxau               1.0.11               hb9d3cd8_1    conda-forge
xorg-libxdmcp             1.1.5                hb9d3cd8_0    conda-forge
xorg-libxext              1.3.6                hb9d3cd8_0    conda-forge
xorg-libxfixes            6.0.1                hb9d3cd8_0    conda-forge
xorg-libxinerama          1.1.5                h5888daf_1    conda-forge
xorg-libxrender           0.9.11               hb9d3cd8_1    conda-forge
xorg-xorgproto            2024.1               hb9d3cd8_1    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
zipp                      3.21.0             pyhd8ed1ab_0    conda-forge
zlib                      1.3.1                hb9d3cd8_2    conda-forge

@evelyd
Copy link
Author

evelyd commented Nov 11, 2024

Thanks @flferretti! It turns out the error was caused simply by the path being wrong.

This error seems to be thrown because of the empty sdf file which contains only <sdf version='1.4'/>.

I'll close this issue then.

@evelyd evelyd closed this as completed Nov 11, 2024
@traversaro
Copy link
Collaborator

Not extremely problematic, but we may think of having a more clear if a file does not exists either in rod or jaxsim.

@flferretti
Copy link
Collaborator

Not extremely problematic, but we may think of having a more clear if a file does not exists either in rod or jaxsim.

Done in #50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants