Skip to content

Architecture Intents

David Chan edited this page Jul 12, 2016 · 2 revisions

Intents

Intents are the main way that modules can use to send information to another module or request that a loaded module perfom a task.

Structure

Intents can be any free-form string, and as they are sent to each module specifically (that is, no intent is broadcast without a target), any string could feasibly be used. However, for clarity, in our code we define a standard intent type, that is the Intent string should have the format:

 "Module-From/Module-To/Intent-Function/Arg1/Arg2/..../ArgN"

In this case, the Module-From would be the sending module, the Module-To would be the receiving module, the Intent-Function would be the function that should be called, and the Args each would be string value keys into the bazaar, which would allow the function to be called. Using this structure is human readable, as well as easy to parse. In fact, we provide a handy intent parsing tool, which takes the intent type that we specify below, and parses it into the other fields using Intent::Parse(Intent &i), which returns a ParsedIntent object. separating out each of these strings.

Remote Intents

Though the current version has no support, we will soon provide support for remote-intents over the network module. By sending an intent of the type:

 "REMOTE:Robot-From/Robot-To/Module-From/Module-To/Intent-Function/Arg1/Arg2/..../ArgN"

To the network manager, the intent will be broadcast to a receiving robot, and that given module, which allows for fun inter-robot processing.