smach.state module

class smach.state.CBState(cb, cb_args=[], cb_kwargs={}, outcomes=[], input_keys=[], output_keys=[], io_keys=[])

Bases: State

execute(ud)

Called when executing a state. In the base class this raises a NotImplementedError.

@type ud: L{UserData} structure @param ud: Userdata for the scope in which this state is executing

class smach.state.State(outcomes=[], input_keys=[], output_keys=[], io_keys=[])

Bases: object

Base class for SMACH states.

A SMACH state interacts with SMACH containers in two ways. The first is its outcome identifier, and the second is the set of userdata variables which it reads from and writes to at runtime. Both of these interactions are declared before the state goes active (when its C{execute()} method is called) and are checked during construction.

execute(ud)

Called when executing a state. In the base class this raises a NotImplementedError.

@type ud: L{UserData} structure @param ud: Userdata for the scope in which this state is executing

get_registered_input_keys()

Get a tuple of registered input keys.

get_registered_outcomes()

Get a list of registered outcomes. @rtype: tuple of str @return: Tuple of registered outcome strings.

get_registered_output_keys()

Get a tuple of registered output keys.

preempt_requested()

True if a preempt has been requested.

recall_preempt()

Sets preempt_requested to False

register_input_keys(keys)

Add keys to the set of keys from which this state may read. @type keys: list of str @param keys: List of keys which may be read from when this state is active.

register_io_keys(keys)

Add keys to the set of keys from which this state may read and write. @type keys: list of str @param keys: List of keys which may be read from and written to when this state is active.

register_outcomes(new_outcomes)

Add outcomes to the outcome set.

register_output_keys(keys)

Add keys to the set of keys to which this state may write. @type keys: list of str @param keys: List of keys which may be written to when this state is active.

request_preempt()

Sets preempt_requested to True

service_preempt()

Sets preempt_requested to False