Package smach :: Module sequence :: Class Sequence

Class Sequence

source code


Sequence Container

This container inherits functionality from smach.StateMachine and adds some auto-generated transitions that create a sequence of states from the order in which said states are added to the container.

Instance Methods
 
__init__(self, outcomes, connector_outcome, input_keys=[], output_keys=[])
Constructor.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

    Inherited from state_machine.StateMachine
smach.State
__getitem__(self, key)
Access child state by key.
source code
 
check_consistency(self)
Check the entire state machine for consistency.
source code
 
check_state_spec(self, label, state, transitions)
Validate full state specification (label, state, and transitions).
source code
 
execute(self, parent_ud=smach.UserData())
Run the state machine on entry to this state.
source code
list of string
get_active_states(self)
Get a description of the current states.
source code
dict of string: State
get_children(self)
Get the children of this container.
source code
list of string
get_initial_states(self)
Get the initial states description.
source code
list of 3-tuple
get_internal_edges(self)
Get the internal outcome edges of this container.
source code
 
is_running(self)
Returns true if the state machine is running.
source code
 
request_preempt(self)
Propagate preempt to currently active state.
source code
 
set_initial_state(self, initial_states, userdata=smach.UserData())
Set initial active states of a container.
source code
    Inherited from container.Container
 
__enter__(self) source code
 
__exit__(self, exc_type, exc_val, exc_tb) source code
 
assert_opened(self, msg='') source code
 
call_start_cbs(self)
Calls the registered start callbacks.
source code
 
call_termination_cbs(self, terminal_states, outcome)
Calls the registered termination callbacks.
source code
 
call_transition_cbs(self)
Calls the registered transition callbacks.
source code
 
close(self)
Close the container.
source code
bool
is_opened(self)
Returns True if this container is currently opened for construction.
source code
 
open(self)
Opens this container for modification.
source code
 
opened(self, **kwargs)
Context manager method for opening a smach container.
source code
 
register_start_cb(self, start_cb, cb_args=[])
Adds a start callback to this container.
source code
 
register_termination_cb(self, termination_cb, cb_args=[])
Adds a termination callback to this state machine.
source code
 
register_transition_cb(self, transition_cb, cb_args=[])
Adds a transition callback to this container.
source code
    Inherited from state.State
 
get_registered_input_keys(self)
Get a tuple of registered input keys.
source code
tuple of str
get_registered_outcomes(self)
Get a list of registered outcomes.
source code
 
get_registered_output_keys(self)
Get a tuple of registered output keys.
source code
 
preempt_requested(self)
True if a preempt has been requested.
source code
 
recall_preempt(self)
Sets preempt_requested to False
source code
 
register_input_keys(self, keys)
Add keys to the set of keys from which this state may read.
source code
 
register_io_keys(self, keys)
Add keys to the set of keys from which this state may read and write.
source code
 
register_outcomes(self, new_outcomes)
Add outcomes to the outcome set.
source code
 
register_output_keys(self, keys)
Add keys to the set of keys to which this state may write.
source code
 
service_preempt(self)
Sets preempt_requested to False
source code
Static Methods
 
add(label, state, transitions=None, remapping=None)
Add a state to the sequence.
source code
    Inherited from state_machine.StateMachine
 
add_auto(label, state, connector_outcomes, transitions=None, remapping=None)
Add a state to the state machine such that it automatically transitions to the next added state.
source code
Instance Variables
    Inherited from container.Container
  userdata
Userdata to be passed to child states.
Properties

Inherited from object: __class__

Method Details

__init__(self, outcomes, connector_outcome, input_keys=[], output_keys=[])
(Constructor)

source code 

Constructor.

Parameters:
  • outcomes (list of string) - The potential outcomes of this container.
  • connector_outcome (string) - The outcome used to connect states in the sequence.
Overrides: object.__init__

add(label, state, transitions=None, remapping=None)
Static Method

source code 

Add a state to the sequence. Each state added will receive an additional transition from it to the state which is added after it. The transition will follow the outcome specified at construction of this container.

Parameters:
  • label (string) - The label of the state being added.
  • state - An instance of a class implementing the State interface.
  • transitions - A dictionary mapping state outcomes to other state labels. If one of these transitions follows the connector outcome specified in the constructor, the provided transition will override the automatically generated connector transition.
Overrides: state_machine.StateMachine.add