rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core#

1.  Module Contents#

1.1.  Classes#

Path

ValueType

Primitive value type

BasicType

ListType

VectorType

RawType

Simple, raw XML value. Need to bugfix putting this back into a document

SimpleElementType

Extractor that retrieves data from an element, given a specified attribute, casted to value_type.

ObjectType

FactoryType

DuckTypedFactory

Param

Mirroring Gazebo’s SDF api

Attribute

Element

AggregateElement

Info

Small container for keeping track of what’s been consumed

Reflection

Object

Raw python object for yaml / xml representation

1.2.  Functions#

reflect

Simple wrapper to add XML reflection to an xml_reflection.Object class

on_error_stderr

What to do on an error. This can be changed to raise an exception.

start_namespace

Basic mechanism to prevent conflicts for string types for URDF and SDF @note Does not handle nesting!

end_namespace

add_type

get_type

Can wrap value types if needed

make_type

1.3.  Data#

on_error

skip_default

value_types

value_type_prefix

1.4.  API#

rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.reflect(cls, *args, **kwargs)[source]#

Simple wrapper to add XML reflection to an xml_reflection.Object class

rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.on_error_stderr(message)[source]#

What to do on an error. This can be changed to raise an exception.

rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.on_error = None#
rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.skip_default = False#
rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.value_types = None#
rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.value_type_prefix = <Multiline-String>#
rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.start_namespace(namespace)[source]#

Basic mechanism to prevent conflicts for string types for URDF and SDF @note Does not handle nesting!

rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.end_namespace()[source]#
rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.add_type(key, value)[source]#
rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.get_type(cur_type)[source]#

Can wrap value types if needed

rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.make_type(cur_type)[source]#
class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.Path(tag, parent=None, suffix='', tree=None)[source]#

Bases: object

Initialization

exception rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.ParseError(e, path)[source]#

Bases: Exception

class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.ValueType[source]#

Bases: object

Primitive value type

from_xml(node, path)[source]#
write_xml(node, value)[source]#

If type has ‘write_xml’, this function should expect to have it’s own XML already created i.e., In Axis.to_sdf(self, node), ‘node’ would be the ‘axis’ element. @todo Add function that makes an XML node completely independently?

equals(a, b)[source]#
class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.BasicType(cur_type)[source]#

Bases: rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.ValueType

to_string(value)[source]#
from_string(value)[source]#
class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.ListType[source]#

Bases: rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.ValueType

to_string(values)[source]#
from_string(text)[source]#
equals(aValues, bValues)[source]#
class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.VectorType(count=None)[source]#

Bases: rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.ListType

check(values)[source]#
to_string(values)[source]#
from_string(text)[source]#
class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.RawType[source]#

Bases: rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.ValueType

Simple, raw XML value. Need to bugfix putting this back into a document

from_xml(node, path)[source]#
write_xml(node, value)[source]#
class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.SimpleElementType(attribute, value_type)[source]#

Bases: rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.ValueType

Extractor that retrieves data from an element, given a specified attribute, casted to value_type.

Initialization

from_xml(node, path)[source]#
write_xml(node, value)[source]#
class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.ObjectType(cur_type)[source]#

Bases: rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.ValueType

from_xml(node, path)[source]#
write_xml(node, obj)[source]#
class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.FactoryType(name, typeMap)[source]#

Bases: rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.ValueType

from_xml(node, path)[source]#
get_name(obj)[source]#
write_xml(node, obj)[source]#
class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.DuckTypedFactory(name, typeOrder)[source]#

Bases: rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.ValueType

from_xml(node, path)[source]#
write_xml(node, obj)[source]#
class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.Param(xml_var, value_type, required=True, default=None, var=None)[source]#

Bases: object

Mirroring Gazebo’s SDF api

@param xml_var: Xml name
@todo If the value_type is an object with a tag defined in it’s

reflection, allow it to act as the default tag name?

@param var: Python class variable name. By default it’s the same as the

XML name

Initialization

set_default(obj)[source]#
class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.Attribute(xml_var, value_type, required=True, default=None, var=None)[source]#

Bases: rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.Param

set_from_string(obj, value)[source]#

Node is the parent node in this case

get_value(obj)[source]#
add_to_xml(obj, node)[source]#
class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.Element(xml_var, value_type, required=True, default=None, var=None, is_raw=False)[source]#

Bases: rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.Param

set_from_xml(obj, node, path)[source]#
add_to_xml(obj, parent)[source]#
add_scalar_to_xml(parent, value)[source]#
class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.AggregateElement(xml_var, value_type, var=None, is_raw=False)[source]#

Bases: rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.Element

add_from_xml(obj, node, path)[source]#
set_default(obj)[source]#
class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.Info(node)[source]#

Small container for keeping track of what’s been consumed

Initialization

class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.Reflection(params=[], parent_cls=None, tag=None)[source]#

Bases: object

Initialization

Construct a XML reflection thing @param parent_cls: Parent class, to use it’s reflection as well. @param tag: Only necessary if you intend to use Object.write_xml_doc()

This does not override the name supplied in the reflection definition thing.

set_from_xml(obj, node, path, info=None)[source]#
add_to_xml(obj, node)[source]#
class rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.core.Object[source]#

Bases: rofunc.utils.robolab.formatter.urdf_parser.xml_reflection.basics.YamlReflection

Raw python object for yaml / xml representation

XML_REFL = None#
get_refl_vars()[source]#
check_valid()[source]#
pre_write_xml()[source]#

If anything needs to be converted prior to dumping to xml i.e., getting the names of objects and such

write_xml(node)[source]#

Adds contents directly to XML node

to_xml()[source]#

Creates an overarching tag and adds its contents to the node

to_xml_string(addHeader=True)[source]#
post_read_xml()[source]#
read_xml(node, path)[source]#
classmethod from_xml(node, path)[source]#
classmethod from_xml_string(xml_string)[source]#
classmethod from_xml_file(file_path)[source]#
get_aggregate_list(xml_var)[source]#
aggregate_init()[source]#

Must be called in constructor!

add_aggregate(xml_var, obj)[source]#

NOTE: One must keep careful track of aggregate types for this system. Can use ‘lump_aggregates()’ before writing if you don’t care.

add_aggregates_to_xml(node)[source]#
remove_aggregate(obj)[source]#
lump_aggregates()[source]#

Put all aggregate types together, just because

parse(xml_string)[source]#