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


flexbe_states
Author(s): Philipp Schillinger
autogenerated on Sun Dec 13 2020 04:01:46