Class CBInterface
source code
Decorator to describe the extension of a state's SMACH userdata and
outcome interface.
Some SMACH states can be extended with the use of user callbacks.
Since the SMACH interface and SMACH userdata are strictly controlled, the
ways in which these callbacks interact with SMACH must be delcared. This
decorator allows this information to be attached to a given callback
function.
If a callback adds a potential outcome to a state, suppose
'critical_failure', then one could write this when defining the
callback:
>>> import asmach as smach
>>> @smach.cb_interface(outcomes=['critical_failure'])
>>> def my_cb(x,y,z):
>>>
>>> return 'critical_failure'
Suppose a state retrieves data that it passes into a callback. If the
user wants to take that data and put some of all of it into userdata,
this interface must be declared. In this case, the user could write:
>>> import asmach as smach
>>> @smach.cb_interface(output_keys=['processed_res'])
>>> def my_cb(ud, data):
>>> ud.processed_res = data
|
__init__(self,
cb,
outcomes=[],
input_keys=[],
output_keys=[],
io_keys=[])
Describe callback SMACH interface. |
source code
|
|
|
|
|
get_registered_input_keys(self)
Get a tuple of registered input keys. |
source code
|
|
|
get_registered_output_keys(self)
Get a tuple of registered output keys. |
source code
|
|
tuple of string
|
|
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|
Inherited from object :
__class__
|
__init__(self,
cb,
outcomes=[],
input_keys=[],
output_keys=[],
io_keys=[])
(Constructor)
| source code
|
Describe callback SMACH interface.
- Parameters:
outcomes (array of strings) - Custom outcomes for this state.
input_keys (array of strings) - The userdata keys from which this state might read at runtime.
output_keys (array of strings) - The userdata keys to which this state might write at runtime.
io_keys (array of strings) - The userdata keys to which this state might write or from which
it might read at runtime.
- Overrides:
object.__init__
|
Get a list of registered outcomes.
- Returns: tuple of string
- Tuple of registered outcome strings.
|