urdf_parser_py icon indicating copy to clipboard operation
urdf_parser_py copied to clipboard

urdfdom_py transmission issue

Open drfenixion opened this issue 9 months ago • 0 comments

Looks like urdfdom and urdfdom_py are parsers with different behaviour and that should not be so.

I have issue with transmission what was fixed in https://github.com/ros/urdfdom/issues/36#issuecomment-78306077

problem urdf is:

  <transmission name="r_wrist_trans" type="pr2_mechanism_model/WristTransmission">
    <rightActuator mechanicalReduction="60.1714285714" name="r_wrist_r_motor"/>
    <leftActuator mechanicalReduction="60.1714285714" name="r_wrist_l_motor"/>
    <flexJoint mechanicalReduction="-1.0" name="r_wrist_flex_joint"/>
    <rollJoint mechanicalReduction="1.0" name="r_wrist_roll_joint"/>
  </transmission>

I see matches of needed tags (rightActuator) https://github.com/ros/urdfdom/blob/3f6bf9a608065464bb6c2828af6e96c8f577f2bf/xsd/urdf.xsd#L247 and therefore urdfdom should be ok with it (i did not tested)

but urdfdom_py leads to error and i dont see any matches of rightActuator https://github.com/search?q=repo%3Aros%2Furdf_parser_py%20rightActuator&type=code Looks like urdfdom_py cant work with it.

Error got by urdf_parser_py with urdf with that transmission.

  File "/home/user/.local/share/FreeCAD/Mod/freecad.robotcad/freecad/cross/urdf_loader.py", line 99, in load_from_file
    robot = Robot.from_xml_string(
            ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ros/jazzy/lib/python3.12/site-packages/urdf_parser_py/xml_reflection/core.py", line 612, in from_xml_string
    return cls.from_xml(node, path)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ros/jazzy/lib/python3.12/site-packages/urdf_parser_py/xml_reflection/core.py", line 606, in from_xml
    return cur_type.from_xml(node, path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ros/jazzy/lib/python3.12/site-packages/urdf_parser_py/xml_reflection/core.py", line 228, in from_xml
    obj.read_xml(node, path)
  File "/opt/ros/jazzy/lib/python3.12/site-packages/urdf_parser_py/xml_reflection/core.py", line 594, in read_xml
    self.XML_REFL.set_from_xml(self, node, path)
  File "/opt/ros/jazzy/lib/python3.12/site-packages/urdf_parser_py/xml_reflection/core.py", line 509, in set_from_xml
    element.add_from_xml(obj, child, element_path)
  File "/opt/ros/jazzy/lib/python3.12/site-packages/urdf_parser_py/xml_reflection/core.py", line 386, in add_from_xml
    value = self.value_type.from_xml(node, path)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ros/jazzy/lib/python3.12/site-packages/urdf_parser_py/xml_reflection/core.py", line 279, in from_xml
    raise ParseError(Exception(out), path)

ParseError in /robot[@name='pr2']/transmission[@name='r_wrist_trans']:
Could not perform duck-typed parsing.
Value Type: <class 'urdf_parser_py.urdf.Transmission'>
Exception: ParseError in /robot[@name='pr2']/transmission[@name='r_wrist_trans']:
Required element not set in XML: type

drfenixion avatar Mar 24 '25 08:03 drfenixion