log_state.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 from flexbe_core import EventState, Logger
4 
5 '''
6 Created on 09.12.2013
7 
8 @author: Philipp Schillinger
9 '''
10 
11 class LogState(EventState):
12  '''
13  A state that can log a predefined message to precisely inform the operator about what happened to the behavior.
14 
15  -- text string The message to be logged to the terminal.
16  -- severity uint8 Type of logging (Logger.REPORT_INFO / WARN / HINT / ERROR)
17 
18  <= done Indicates that the message has been logged.
19 
20  '''
21 
22  def __init__(self, text, severity = Logger.REPORT_HINT):
23  '''Constructor'''
24  super(LogState, self).__init__(outcomes=['done'])
25 
26  self._text = text
27  self._severity = severity
28 
29 
30  def execute(self, userdata):
31  '''Execute this state'''
32 
33  # Already logged. No need to wait for anything.
34  return 'done'
35 
36 
37  def on_enter(self, userdata):
38  '''Log upon entering the state.'''
39 
40  Logger.log(self._text, self._severity)
def execute(self, userdata)
Definition: log_state.py:30
def on_enter(self, userdata)
Definition: log_state.py:37
def __init__(self, text, severity=Logger.REPORT_HINT)
Definition: log_state.py:22


flexbe_states
Author(s): Philipp Schillinger
autogenerated on Wed Jun 5 2019 21:52:08