Example #1
0
    def from_string(cls, text):
        """Parse URDF from a string.

        Parameters
        ----------
        text : :obj:`str`
            XML string.

        Examples
        --------
        >>> from compas.files import URDF
        >>> urdf = URDF.from_string('<robot name="panda"/>')
        """
        return cls(XML.from_string(text))
Example #2
0
    def from_file(cls, source):
        """Parse a URDF file from a file path or file-like object.

        Parameters
        ----------
        source : str or file
            File path or file-like object.

        Examples
        --------
        >>> from compas.files import URDF
        >>> urdf = URDF.from_file('/urdf/ur5.urdf')
        """
        return cls(XML.from_file(source))