Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
flexbe_core.behavior.Behavior Class Reference
Inheritance diagram for flexbe_core.behavior.Behavior:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self)
 
def add_behavior (self, behavior_class, behavior_id)
 
def add_parameter (self, name, default)
 
def confirm (self)
 
def create (self)
 
def execute (self)
 
def get_contained_behaviors (self)
 
def get_current_state (self)
 
def get_locked_state (self)
 
def preempt (self)
 
def prepare_for_execution (self, input_data=None)
 
def prepare_for_switch (self, state)
 
def set_parameter (self, name, value)
 
def set_up (self, id, autonomy_level, debug)
 
def use_behavior (self, behavior_class, behavior_id, default_keys=None, parameters=None)
 

Public Attributes

 contains
 
 id
 
 name
 
 requested_state_path
 

Private Member Functions

def _collect_contained (self, obj, path)
 
def _get_state_machine (self)
 
def _get_states_of_path (self, path, container)
 
def _set_typed_attribute (self, name, value)
 

Private Attributes

 _autonomy_level
 
 _behaviors
 
 _debug
 
 _state_machine
 

Detailed Description

This is the superclass for all implemented behaviors.

Definition at line 6 of file behavior.py.

Constructor & Destructor Documentation

def flexbe_core.behavior.Behavior.__init__ (   self)
Please call this superclass constructor first when overriding it with your behavior.

Definition at line 11 of file behavior.py.

Member Function Documentation

def flexbe_core.behavior.Behavior._collect_contained (   self,
  obj,
  path 
)
private

Definition at line 211 of file behavior.py.

def flexbe_core.behavior.Behavior._get_state_machine (   self)
private

Definition at line 206 of file behavior.py.

def flexbe_core.behavior.Behavior._get_states_of_path (   self,
  path,
  container 
)
private

Definition at line 242 of file behavior.py.

def flexbe_core.behavior.Behavior._set_typed_attribute (   self,
  name,
  value 
)
private

Definition at line 222 of file behavior.py.

def flexbe_core.behavior.Behavior.add_behavior (   self,
  behavior_class,
  behavior_id 
)
Adds another behavior as part of this behavior.
This other behavior should be declared as contained in the behavior manifest.

@type behavior_class: class
@param behavior_class: The class implementing the other behavior.

@type behavior_id: string
@param behavior_id: Unique identifier for this behavior instance.

Definition at line 54 of file behavior.py.

def flexbe_core.behavior.Behavior.add_parameter (   self,
  name,
  default 
)
Adds a parameter to this behavior.
The parameter should be declared in the behavior manifest.

@type name: string
@param name: The name of the parameter.

@type default: object
@param default: The default value of this parameter. Be sure to set it to the right type.

Definition at line 41 of file behavior.py.

def flexbe_core.behavior.Behavior.confirm (   self)
Confirms that this behavior is ready for execution.

Definition at line 150 of file behavior.py.

def flexbe_core.behavior.Behavior.create (   self)
Should create the state machine for this behavior and return it.
It is called immediately before executing the behavior,
so used parameters will have their final value when called.

@return The complete state machine for this behavior.

Definition at line 29 of file behavior.py.

def flexbe_core.behavior.Behavior.execute (   self)
Called when the behavior is executed.
Need to call self.execute_behavior when ready to start the state machine and return its result.

@return: A string containing the execution result such as finished or failed.

Definition at line 158 of file behavior.py.

def flexbe_core.behavior.Behavior.get_contained_behaviors (   self)

Definition at line 219 of file behavior.py.

def flexbe_core.behavior.Behavior.get_current_state (   self)

Definition at line 189 of file behavior.py.

def flexbe_core.behavior.Behavior.get_locked_state (   self)

Definition at line 192 of file behavior.py.

def flexbe_core.behavior.Behavior.preempt (   self)

Definition at line 201 of file behavior.py.

def flexbe_core.behavior.Behavior.prepare_for_execution (   self,
  input_data = None 
)
Prepares this behavior for execution by building its state machine.

Definition at line 109 of file behavior.py.

def flexbe_core.behavior.Behavior.prepare_for_switch (   self,
  state 
)
Prepares the behavior for being executed after a behavior switch.

@type name: string
@param name: The name of this behavior.

Definition at line 169 of file behavior.py.

def flexbe_core.behavior.Behavior.set_parameter (   self,
  name,
  value 
)
Set the given parameter of this behavior or any sub-behavior.
Use a path specification to refer to the corresponding sub-behavior.
The parameter value is propagated to all sub-behaviors according to the propagation rules.
Also, the value is casted to the type of the parameter if required.

@type name: string
@param name: Name of the parameter, possibly including the path to a sub-behavior.

@type value: object
@param value: New value of the parameter of same type as before (or can be casted to that type).

@return: Whether the parameter existed and could be set.

Definition at line 123 of file behavior.py.

def flexbe_core.behavior.Behavior.set_up (   self,
  id,
  autonomy_level,
  debug 
)

Definition at line 237 of file behavior.py.

def flexbe_core.behavior.Behavior.use_behavior (   self,
  behavior_class,
  behavior_id,
  default_keys = None,
  parameters = None 
)
Creates a state machine implementing the given behavior to use it in the behavior state machine.
Behavior has to be added first.

@type behavior_class: class
@param behavior_class: The class implementing the other behavior.

@type behavior_id: string
@param behavior_id: Same identifier as used for adding.

@type default_keys: list
@param default_keys: List of input keys of the behavior which should be ignored
             and instead use the default values as given by the behavior.

@type parameters: dict
@param parameters: Optional assignment of values to behavior parameters.
           Any assigned parameter will be ignored for runtime customization,
           i.e., cannot be overwritten by a user who runs the behavior.

Definition at line 70 of file behavior.py.

Member Data Documentation

flexbe_core.behavior.Behavior._autonomy_level
private

Definition at line 22 of file behavior.py.

flexbe_core.behavior.Behavior._behaviors
private

Definition at line 20 of file behavior.py.

flexbe_core.behavior.Behavior._debug
private

Definition at line 23 of file behavior.py.

flexbe_core.behavior.Behavior._state_machine
private

Definition at line 15 of file behavior.py.

flexbe_core.behavior.Behavior.contains

Definition at line 19 of file behavior.py.

flexbe_core.behavior.Behavior.id

Definition at line 17 of file behavior.py.

flexbe_core.behavior.Behavior.name

Definition at line 16 of file behavior.py.

flexbe_core.behavior.Behavior.requested_state_path

Definition at line 25 of file behavior.py.


The documentation for this class was generated from the following file:


flexbe_core
Author(s): Philipp Schillinger
autogenerated on Sun Dec 13 2020 04:01:39