compas_robots.files
¤
This package provides the URDF file format parser used to load robot models from standard URDF descriptions.
Classes¤
URDF
¤
Class for working with URDF files.
Abstracts away the underlying XML of the Unified Robot Description Format (URDF) and represents it as an object graph.
Attributes:
-
xml(XML) –Instance of the XML reader/parser class.
-
robot(object) –Root element of the URDF model, i.e. a robot instance.
References
A detailed description of the model is available on the URDF Model wiki. This package parses URDF v1.0 according to the URDF XSD Schema.
Functions¤
from_file
classmethod
¤
from_robot
classmethod
¤
from_robot(robot: RobotModel) -> URDF
Construct a URDF from a robot.
Parameters:
-
robot(RobotModel) –The robot model to be converted to URDF.
from_string
classmethod
¤
to_file
¤
Writes the string representation of this URDF instance,
including all sub-elements, to the destination.
Parameters:
to_string
¤
write
¤
Writes the string representation of this URDF instance,
including all sub-elements, to the destination.
Parameters:
URDFGenericElement
¤
Generic representation for all URDF elements that are not explicitly supported.
URDFParser
¤
Class for parsing URDF elements into an object graph.
Functions¤
install_parser
classmethod
¤
Installs an URDF parser type for a defined tag.
Parameters:
-
parser_type(type) –Python class handling URDF parsing of the tag.
-
*tags(str, default:()) –One or more URDF string tag that the parser can parse.
Other Parameters:
-
proxy_type(type) –In some cases, the parser type is a general class without knowledge of URDF, and it requires a proxy class to add URDF-related functions to it.
Raises:
-
ValueError–If
tagsis empty.
parse_element
classmethod
¤
parse_element(
element: XMLElement, path: str = "", element_default_namespace: str | None = None
) -> object
Recursively parse URDF element and its children.
If the parser type implements a class method from_urdf,
it will use it to parse the element, otherwise
a generic implementation that relies on conventions
will be used.
Parameters:
-
element(XMLElement) –XML Element node.
-
path(str, default:'') –Full path to the element.
-
element_default_namespace(str | None, default:None) –Default namespace at the current level current document.
Returns:
-
object–An instance of the model object represented by the given element.
Raises:
-
TypeError–If the element instance cannot be created.