This is the top-level namespace of the rocon_uri ROS package. It provides parsing and formatting rules for uri’s that describe rocon devices and robots as resources in the rocon framework.
This module defines exceptions raised by the rocon_uri package. These exception names are all included in the main rocon_uri namespace. To catch one, import it this way:
from rocon_uri import RoconURIValueError
This module defines ebnf rules used in parsing rocon_uri strings. It should never be used directly, it is the engine for the core parsing and manipulation module.
Load our rules from yaml and construct an ebnf rules dictionary for parsing rocon uri strings.
Returns: | python dictionary of rules loaded from yaml. |
---|---|
Return type: | str |
Load the rules in rocon_uri/src/rocon_uri/rules/rules.yaml into a python dictionary object.
Returns: | python dictionary of rules loaded from yaml. |
---|---|
Return type: | str |
A generator which walks through the yaml list of rules. Works in almost exactly the same way as os.path.walk. If a root for a ebnf rules dictionary is not specified, it will load the default rules dictionary, see load_rules_into_dictionary().
Usage::
for name, group, elements in walk_yaml('hardware_platform', yaml_rules['hardware_platform']):
print("Name: %s" % name)
print(" Group: %s" % group)
print(" Elements: %s" % elements)
Parameters: |
---|
This module contains the public api and classes used to parse and compare rocon uri strings.
Bases: object
Initialises from a rocon uri string parsing the relevant information into fields internally. This class uses python decorators to establish the parsed fields into the following variables:
Since each field can contain one or more values, each of these variables can return either a string representation of the original field, or a list of the parsed field. e.g.
>>> rocon_uri_object = rocon_uri.parse('rocon:/turtlebot2|pr2/dude/hydro/precise#rocon_apps/chirp')
>>> print rocon_uri_object.hardware_platform.list
['turtlebot2', 'pr2']
>>> print rocon_uri_object.hardware_platform.string
turtlebot2|pr2
Initialise the rocon uri object from a rocon uri string.
Parameters: | rocon_uri_string (str) – a rocon uri in string format. |
---|---|
Raises: | rocon_uri.exceptions.RoconURIValueError if either rocon_uri string is not valid |
list of weak references to the object (if defined)
Checks if two rocon uri’s are compatible.
Parameters: | |
---|---|
Returns: | true if compatible, i.e. wildcards or intersections of fields are nonempty |
Return type: | bool |
Raises: | rocon_uri.exceptions.RoconURIValueError if either rocon_uri string is not valid |
Todo
tighten up the name pattern matching
Convenience method for creating RoconURI objects.
Parameters: | rocon_uri_string (str) – a rocon uri in string format. |
---|---|
Returns: | a validated rocon uri object |
Return type: | RoconURI. |
Raises: | rocon_uri.exceptions.RoconURIValueError |