Go to the documentation of this file.00001
00002
00003 from flexbe_core import EventState, Logger
00004
00005 '''
00006 Created on 09.12.2013
00007
00008 @author: Philipp Schillinger
00009 '''
00010
00011 class LogState(EventState):
00012 '''
00013 A state that can log a predefined message to precisely inform the operator about what happened to the behavior.
00014
00015 -- text string The message to be logged to the terminal.
00016 -- severity uint8 Type of logging (Logger.REPORT_INFO / WARN / HINT / ERROR)
00017
00018 <= done Indicates that the message has been logged.
00019
00020 '''
00021
00022 def __init__(self, text, severity = Logger.REPORT_HINT):
00023 '''Constructor'''
00024 super(LogState, self).__init__(outcomes=['done'])
00025
00026 self._text = text
00027 self._severity = severity
00028
00029
00030 def execute(self, userdata):
00031 '''Execute this state'''
00032
00033
00034 return 'done'
00035
00036
00037 def on_enter(self, userdata):
00038 '''Log upon entering the state.'''
00039
00040 Logger.log(self._text, self._severity)