00001 # Copyright (c) 2013, Felix Kolbe 00002 # All rights reserved. BSD License 00003 # 00004 # Redistribution and use in source and binary forms, with or without 00005 # modification, are permitted provided that the following conditions 00006 # are met: 00007 # 00008 # * Redistributions of source code must retain the above copyright 00009 # notice, this list of conditions and the following disclaimer. 00010 # 00011 # * Redistributions in binary form must reproduce the above copyright 00012 # notice, this list of conditions and the following disclaimer in the 00013 # documentation and/or other materials provided with the distribution. 00014 # 00015 # * Neither the name of the {organization} nor the names of its 00016 # contributors may be used to endorse or promote products derived 00017 # from this software without specific prior written permission. 00018 # 00019 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00020 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00021 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00022 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00023 # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00024 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00025 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00026 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00027 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00029 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 00031 00032 from common import WorldState, Condition 00033 from common import Precondition, Effect, VariableEffect 00034 from common import Goal, Action 00035 00036 from memory import Memory, MemoryCondition 00037 00038 from planning import Node, Planner, PlanExecutor 00039 00040 from runner import Runner 00041 00042 00043 ## shutdown check 00044 00045 def is_shutdown(): 00046 return False 00047 00048 def set_shutdown_check(cb): 00049 import sys 00050 sys.modules[__name__].is_shutdown = cb 00051 00052 ## logging 00053 00054 import logging 00055 _logger = logging.getLogger('rgoap') 00056 """The logger used in this library""" 00057 _logger.setLevel(logging.INFO) 00058 00059 # add default console output 00060 _loghandler = logging.StreamHandler() 00061 _loghandler.setLevel(logging.INFO) 00062 _loghandler.setFormatter(logging.Formatter('[%(levelname)s] %(message)s')) 00063 _logger.addHandler(_loghandler) 00064 00065 def remove_default_loghandler(): 00066 """Call this to mute this library or to prevent duplicate messages 00067 when adding another log handler to the logger named 'rgoap'.""" 00068 _logger.removeHandler(_loghandler)