robotflow-initiative / dipgrasp

10 stars 2 forks source link

Unable to load our custom hand model. #7

Closed CodingCatMountain closed 2 weeks ago

CodingCatMountain commented 2 weeks ago

@YoruCathy @SJTUzjy Hi. I fellow the instructions here and Readme, generated successfully the hand model xml file. After check the orientation of our custom hand model and the orientation of svh hand, I found their orientation is same. So I maintained the params self.sample_config in config.py as svh hand. However, When I try to run the main.py as python3 main.py gripper=left_hand, I met such error:

Error executing job with overrides: ['gripper=left_hand']
Traceback (most recent call last):
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/collada/__init__.py", line 201, in __init__
    self.xmlnode = ElementTree.ElementTree(element=None,
  File "src/lxml/etree.pyx", line 3224, in lxml.etree.ElementTree
  File "src/lxml/parser.pxi", line 1975, in lxml.etree._parseDocument
  File "src/lxml/parser.pxi", line 1995, in lxml.etree._parseMemoryDocument
  File "src/lxml/parser.pxi", line 1882, in lxml.etree._parseDoc
  File "src/lxml/parser.pxi", line 1164, in lxml.etree._BaseParser._parseDoc
  File "src/lxml/parser.pxi", line 633, in lxml.etree._ParserContext._handleParseResultDoc
  File "src/lxml/parser.pxi", line 743, in lxml.etree._handleParseResult
  File "src/lxml/parser.pxi", line 672, in lxml.etree._raiseParseError
  File "<string>", line 43
lxml.etree.XMLSyntaxError: xmlSAX2Characters: huge text node, line 43, column 10002715

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wjj/mdisk/dipgrasp/main.py", line 118, in main
    gripper = Gripper(gripper_name)
  File "/home/wjj/mdisk/dipgrasp/core/geometry/gripper.py", line 34, in __init__
    self.robot = urdfpy.URDF.load(osp.join(gripper_dir, f'{name}.urdf'))
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 3731, in load
    return URDF._from_xml(node, path)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 3928, in _from_xml
    kwargs = cls._parse(node, path)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 161, in _parse
    kwargs.update(cls._parse_simple_elements(node, path))
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 137, in _parse_simple_elements
    v = [t._from_xml(n, path) for n in vs]
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 137, in <listcomp>
    v = [t._from_xml(n, path) for n in vs]
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 181, in _from_xml
    return cls(**cls._parse(node, path))
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 161, in _parse
    kwargs.update(cls._parse_simple_elements(node, path))
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 137, in _parse_simple_elements
    v = [t._from_xml(n, path) for n in vs]
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 137, in <listcomp>
    v = [t._from_xml(n, path) for n in vs]
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 1146, in _from_xml
    kwargs = cls._parse(node, path)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 161, in _parse
    kwargs.update(cls._parse_simple_elements(node, path))
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 127, in _parse_simple_elements
    v = t._from_xml(v, path)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 181, in _from_xml
    return cls(**cls._parse(node, path))
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 161, in _parse
    kwargs.update(cls._parse_simple_elements(node, path))
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 127, in _parse_simple_elements
    v = t._from_xml(v, path)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 581, in _from_xml
    meshes = load_meshes(fn)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/utils.py", line 225, in load_meshes
    meshes = trimesh.load(filename)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/trimesh/exchange/load.py", line 126, in load
    loaded = load_mesh(file_obj, file_type=file_type, resolver=resolver, **kwargs)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/trimesh/exchange/load.py", line 202, in load_mesh
    results = loader(file_obj, file_type=file_type, resolver=resolver, **kwargs)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/trimesh/exchange/dae.py", line 52, in load_collada
    c = collada.Collada(file_obj, ignore=ignores)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/collada/__init__.py", line 204, in __init__
    raise DaeMalformedError("XML Parsing Error: %s" % e)
collada.common.DaeMalformedError: DaeMalformedError: XML Parsing Error: xmlSAX2Characters: huge text node, line 43, column 10002715 (<string>, line 43)

Do you have any idea to solve this problem? Looking forward to your reply. Your sincerely, Kacun.

SJTUzjy commented 2 weeks ago

Based on the error log entry:

File "/home/wjj/mdisk/dipgrasp/core/geometry/gripper.py", line 34, in __init__
self.robot = urdfpy.URDF.load(osp.join(gripper_dir, f'{name}.urdf'))

I suppose that there might be somthing wrong with your 'left_hand.urdf' file. I recommend trying to load the custom model using a URDF parser library like urdfpy or yourdfpy to see what happens.

CodingCatMountain commented 2 weeks ago

@SJTUzjy I met the same error about dae files when I use urdfpy to load my custom hand model. The details is as follow:

 self.xmlnode = ElementTree.ElementTree(element=None,
  File "src/lxml/etree.pyx", line 3224, in lxml.etree.ElementTree
  File "src/lxml/parser.pxi", line 1975, in lxml.etree._parseDocument
  File "src/lxml/parser.pxi", line 1995, in lxml.etree._parseMemoryDocument
  File "src/lxml/parser.pxi", line 1882, in lxml.etree._parseDoc
  File "src/lxml/parser.pxi", line 1164, in lxml.etree._BaseParser._parseDoc
  File "src/lxml/parser.pxi", line 633, in lxml.etree._ParserContext._handleParseResultDoc
  File "src/lxml/parser.pxi", line 743, in lxml.etree._handleParseResult
  File "src/lxml/parser.pxi", line 672, in lxml.etree._raiseParseError
  File "<string>", line 43
lxml.etree.XMLSyntaxError: xmlSAX2Characters: huge text node, line 43, column 10002715

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 3731, in load
    return URDF._from_xml(node, path)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 3928, in _from_xml
    kwargs = cls._parse(node, path)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 161, in _parse
    kwargs.update(cls._parse_simple_elements(node, path))
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 137, in _parse_simple_elements
    v = [t._from_xml(n, path) for n in vs]
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 137, in <listcomp>
    v = [t._from_xml(n, path) for n in vs]
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 181, in _from_xml
    return cls(**cls._parse(node, path))
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 161, in _parse
    kwargs.update(cls._parse_simple_elements(node, path))
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 137, in _parse_simple_elements
    v = [t._from_xml(n, path) for n in vs]
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 137, in <listcomp>
    v = [t._from_xml(n, path) for n in vs]
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 1146, in _from_xml
    kwargs = cls._parse(node, path)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 161, in _parse
    kwargs.update(cls._parse_simple_elements(node, path))
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 127, in _parse_simple_elements
    v = t._from_xml(v, path)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 181, in _from_xml
    return cls(**cls._parse(node, path))
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 161, in _parse
    kwargs.update(cls._parse_simple_elements(node, path))
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 127, in _parse_simple_elements
    v = t._from_xml(v, path)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/urdf.py", line 581, in _from_xml
    meshes = load_meshes(fn)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/urdfpy/utils.py", line 225, in load_meshes
    meshes = trimesh.load(filename)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/trimesh/exchange/load.py", line 126, in load
    loaded = load_mesh(file_obj, file_type=file_type, resolver=resolver, **kwargs)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/trimesh/exchange/load.py", line 202, in load_mesh
    results = loader(file_obj, file_type=file_type, resolver=resolver, **kwargs)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/trimesh/exchange/dae.py", line 52, in load_collada
    c = collada.Collada(file_obj, ignore=ignores)
  File "/home/wjj/mdisk/conda_envs/dipgrasp/lib/python3.10/site-packages/collada/__init__.py", line 204, in __init__
    raise DaeMalformedError("XML Parsing Error: %s" % e)
collada.common.DaeMalformedError: DaeMalformedError: XML Parsing Error: xmlSAX2Characters: huge text node, line 43, column 10002715 (<string>, line 43)

Moreover, I check the other hand model you provide, they are all use dae files for geometry tag in urdf. May I ask can I use STL files for geometry tag in urdf in this project.

CodingCatMountain commented 2 weeks ago

@SJTUzjy I think I found the reason... One of the dae files is too big in my urdf file. I could try to simplify this dae files.