太暗的异常检测

This commit is contained in:
ChenXL97 2023-11-19 21:55:42 +08:00
parent 5b9526b5d0
commit 69c3fea7f4
4 changed files with 40 additions and 1 deletions

View File

@ -6,6 +6,7 @@ from py_trees.common import Status
# _base Behavior
class Bahavior(ptree.behaviour.Behaviour):
can_be_expanded = False
num_params = 0
valid_params='''

View File

@ -0,0 +1,14 @@
import py_trees as ptree
from typing import Any
from robowaiter.behavior_lib._base.Act import Act
class ResolveAnomaly(Act):
def __init__(self, *args):
super().__init__(*args)
def _update(self) -> ptree.common.Status:
# explore algorithm
self.scene.state["chat_list"].insert(0,("Goal",'Is(HallLight,On)'))
return ptree.common.Status.RUNNING

View File

@ -0,0 +1,23 @@
import py_trees as ptree
from typing import Any
from robowaiter.behavior_lib._base.Cond import Cond
class AnomalyDetected(Cond):
def __init__(self):
super().__init__()
def _update(self) -> ptree.common.Status:
# if self.scene.status?
light_set = {'Is(HallLight,Off)', 'Is(TubeLight,Off)', 'Is(Curtain,Off)'}
if light_set.issubset(self.scene.state["condition_set"]):
self.scene.chat_bubble("太暗了,开灯")
self.scene.state["anomaly"] = "TooDark"
return ptree.common.Status.SUCCESS
return ptree.common.Status.FAILURE

View File

@ -76,7 +76,8 @@ class Scene:
"attention":{},
"serve_state":{},
"chat_history":{},
"wait_history":set()
"wait_history":set(),
"anomaly": None
}
"""
status: