xacro package
Submodules
Module contents
- class xacro.ConstructUnits(value)
Bases:
Enum
utility enumeration to construct a values with a unit from yaml
- angle_degrees = ('!degrees', 0.017453292519943295)
- angle_radians = ('!radians', 1.0)
- constructor(loader, node)
utility function to construct a values with a unit from yaml
- length_foot = ('!foot', 0.3048)
- length_inches = ('!inches', 0.0254)
- length_meters = ('!meters', 1.0)
- length_millimeters = ('!millimeters', 0.001)
- class xacro.Macro
Bases:
object
- exception xacro.XacroException(msg=None, suffix=None, exc=None, macro=None)
Bases:
Exception
XacroException allows to wrap another exception (exc) and to augment its error message: prefixing with msg and suffixing with suffix. str(e) finally prints: msg str(exc) suffix
- class xacro.YamlDictWrapper
Bases:
dict
Wrapper class providing dotted access to dict items
- class xacro.YamlListWrapper(iterable=(), /)
Bases:
list
Wrapper class for yaml lists to allow recursive inheritance of wrapper property
- static wrap(item)
This static method, used by both YamlListWrapper and YamlDictWrapper, dispatches to the correct wrapper class depending on the type of yaml item
- xacro.abs_filename_spec(filename_spec)
Prepend the dirname of the currently processed file if filename_spec is not yet absolute
- xacro.check_attrs(tag, required, optional)
Helper routine to fetch required and optional attributes and complain about any additional attributes. :param tag (xml.dom.Element): DOM element node :param required [str]: list of required attributes :param optional [str]: list of optional attributes
- xacro.create_global_symbols()
- xacro.eval_all(node, macros, symbols)
Recursively evaluate node, expanding macros, replacing properties, and evaluating expressions
- xacro.eval_default_arg(forward_variable, default, symbols, macro)
- xacro.eval_extension(s)
- xacro.eval_text(text, symbols)
- xacro.get_boolean_value(value, condition)
Return a boolean value that corresponds to the given Xacro condition value. Values “true”, “1” and “1.0” are supposed to be True. Values “false”, “0” and “0.0” are supposed to be False. All other values raise an exception.
- Parameters:
value – The value to be evaluated. The value has to already be evaluated by Xacro.
condition – The original condition text in the XML.
- Returns:
The corresponding boolean value, or a Python expression that, converted to boolean, corresponds to it.
- Raises:
ValueError – If the condition value is incorrect.
- xacro.get_include_files(filename_spec, symbols)
- xacro.grab_macro(elt, macros)
- xacro.grab_property(elt, table)
- xacro.handle_dynamic_macro_call(node, macros, symbols)
- xacro.handle_macro_call(node, macros, symbols)
- xacro.import_xml_namespaces(parent, attributes)
import all namespace declarations into parent
- xacro.init_stacks(file)
- xacro.is_valid_name(name)
Checks whether name is a valid property or macro identifier. With python-based evaluation, we need to avoid name clashes with python keywords.
- xacro.load_yaml(filename)
- xacro.main()
- xacro.open_output(output_filename)
- xacro.parse(inp, filename=None)
Parse input or filename into a DOM tree. If inp is None, open filename and load from there. Otherwise, parse inp, either as string or file object. If inp is already a DOM tree, this function is a noop. :return:xml.dom.minidom.Document :raise: xml.parsers.expat.ExpatError
- xacro.parse_macro_arg(s)
parse the first param spec from a macro parameter string s accepting the following syntax: <param>[:=|=][^|]<default> :param s: param spec string :return: param, (forward, default), rest-of-string
forward will be either param or None (depending on whether ^ was specified) default will be the default string or None If there is no default spec at all, the middle pair will be replaced by None
- xacro.print_location()
- xacro.process(input_file_name, just_deps=False, xacro_ns=True, verbosity=1, mappings={})
Function to be used from python code, returning the processed XML
- xacro.process_doc(doc, mappings=None, **kwargs)
- xacro.process_file(input_file_name, **kwargs)
main processing pipeline
- xacro.process_include(elt, macros, symbols, func)
- xacro.remove_previous_comments(node)
remove consecutive comments in front of the xacro-specific node
- xacro.resolve_macro(fullname, macros, symbols)
- xacro.safe_eval(expr, globals, locals=None)
- xacro.tokenize(s, sep=',; ', skip_empty=True)