From 0a3e3a8f3ce0914916606623373f1a7a8eb91397 Mon Sep 17 00:00:00 2001 From: wuziji <2193177243@qq.com> Date: Tue, 14 Nov 2023 17:31:13 +0800 Subject: [PATCH] =?UTF-8?q?FIX:=20=E5=A2=9E=E5=8A=A0sub=5Ftask=5Fseq?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E7=9A=84=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= =?UTF-8?q?=EF=BC=8C=E7=94=B1=E5=BC=82=E5=B8=B8=E6=9B=B4=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E8=AD=A6=E5=91=8A=E2=9A=A0=EF=BC=88=E9=97=AE=E9=A2=98=E5=B9=B6?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=AE=8C=E5=85=A8=E8=A7=A3=E5=86=B3=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- robowaiter/behavior_lib/cond/HasSubTask.py | 2 +- robowaiter/robot/robot.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/robowaiter/behavior_lib/cond/HasSubTask.py b/robowaiter/behavior_lib/cond/HasSubTask.py index 3bbc52f..571c8c0 100644 --- a/robowaiter/behavior_lib/cond/HasSubTask.py +++ b/robowaiter/behavior_lib/cond/HasSubTask.py @@ -8,7 +8,7 @@ class HasSubTask(Cond): def _update(self) -> ptree.common.Status: # if self.scene.status? - if self.scene.sub_task_seq.children == []: + if not self.scene.sub_task_seq or not self.scene.sub_task_seq.children: return ptree.common.Status.FAILURE else: return ptree.common.Status.SUCCESS diff --git a/robowaiter/robot/robot.py b/robowaiter/robot/robot.py index 6d7b275..185c7d7 100644 --- a/robowaiter/robot/robot.py +++ b/robowaiter/robot/robot.py @@ -70,7 +70,11 @@ class Robot(object): del_sub_tree.set_scene(self.scene) seq.add_child(del_sub_tree) - self.scene.sub_task_seq.add_child(seq) + if self.scene.sub_task_seq: + self.scene.sub_task_seq.add_child(seq) + else: + print('Warning: have none sub task sequence') + self.scene.sub_task_seq = seq print("当前行为树为:") print_tree_from_root(self.bt.root)