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 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 smach
>>> @smach.cb_interface(output_keys=['processed_res'])
>>> def my_cb(ud, data):
>>> ud.processed_res = data
|
__init__(self,
cb,
outcomes=None,
input_keys=None,
output_keys=None,
io_keys=None)
x.__init__(...) initializes x; see help(type(x)) for signature |
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=None,
input_keys=None,
output_keys=None,
io_keys=None)
(Constructor)
| source code
|
x.__init__(...) initializes x; see help(type(x)) for signature
- Overrides:
object.__init__
- (inherited documentation)
|
Get a list of registered outcomes.
- Returns: tuple of string
- Tuple of registered outcome strings.
|