Genesis icon indicating copy to clipboard operation
Genesis copied to clipboard

Support capsule and better error messages?

Open dementrock opened this issue 11 months ago • 5 comments

Is there any plan to support capsule as one of the primitive geoms? So that there's better feature parity with Mujoco.

Also right now, loading URDF with capsule geom gives a cryptic error message like below:

  File "/opt/conda/envs/ros_env/lib/python3.11/site-packages/genesis/ext/urdfpy/urdf.py", line 144, in _parse_simple_elements
    v = [t._from_xml(n, path) for n in vs]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/ros_env/lib/python3.11/site-packages/genesis/ext/urdfpy/urdf.py", line 144, in <listcomp>
    v = [t._from_xml(n, path) for n in vs]
         ^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/ros_env/lib/python3.11/site-packages/genesis/ext/urdfpy/urdf.py", line 1001, in _from_xml
    kwargs = cls._parse(node, path)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/ros_env/lib/python3.11/site-packages/genesis/ext/urdfpy/urdf.py", line 168, in _parse
    kwargs.update(cls._parse_simple_elements(node, path))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/ros_env/lib/python3.11/site-packages/genesis/ext/urdfpy/urdf.py", line 136, in _parse_simple_elements
    v = t._from_xml(v, path)
        ^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/ros_env/lib/python3.11/site-packages/genesis/ext/urdfpy/urdf.py", line 188, in _from_xml
    return cls(**cls._parse(node, path))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/ros_env/lib/python3.11/site-packages/genesis/ext/urdfpy/urdf.py", line 662, in __init__
    raise ValueError("At least one geometry element must be set")

Would be better if it more explicitly says capsules are not supported yet.

dementrock avatar Jan 16 '25 20:01 dementrock

is capsule a standard element in URDF? In my understanding it's actually not let me know if there's any reference

zhouxian avatar Jan 17 '25 09:01 zhouxian

@zhouxian ah good point. Indeed it was not mentioned in https://wiki.ros.org/urdf/XML/link. However, we have seen it in some of the robot definitions (perhaps the vendor just used urdf as format but imported it to mujoco?). A bit tricky for me to find public examples, but one was referenced in https://github.com/bulletphysics/bullet3/blob/e9c461b0ace140d5c73972760781d94b7b5eee53/data/capsule.urdf#L16

dementrock avatar Jan 17 '25 22:01 dementrock

ok i see we used urdfpy for parsing urdfs, i think we should be able to add capsule

Genesis-Embodied-AI avatar Jan 18 '25 02:01 Genesis-Embodied-AI

Thanks @Genesis-Embodied-AI ! Also thanks for reminding me that actually the mujoco import supports capsule. I am unblocked right now so this is not urgent for me, but seems like good to support if easy so there's more parity with mujoco.

dementrock avatar Jan 19 '25 05:01 dementrock

Related to https://github.com/Genesis-Embodied-AI/Genesis/issues/564

duburcqa avatar May 24 '25 08:05 duburcqa