File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ Release Notes
3
3
4
4
Forthcoming
5
5
-----------
6
+ * [decorators] a passthrough for debugging and visualisation, `#407 <https://github.com/splintered-reality/py_trees/pull/407 >`_
6
7
* ...
7
8
8
9
2.2.2 (2023-01-28)
Original file line number Diff line number Diff line change @@ -893,3 +893,30 @@ def update(self) -> common.Status:
893
893
if self .decorated .status == self .succeed_status :
894
894
return common .Status .SUCCESS
895
895
return common .Status .RUNNING
896
+
897
+
898
+ class PassThrough (Decorator ):
899
+ """
900
+ This decorator simply reflects the child's current status.
901
+
902
+ This behaviour is useful for debugging or visualisation purposes.
903
+ """
904
+
905
+ def __init__ (self , name : str , child : behaviour .Behaviour ):
906
+ """
907
+ Initialise with the standard decorator arguments.
908
+
909
+ Args:
910
+ name: the decorator name
911
+ child: the child to be decorated
912
+ """
913
+ super (PassThrough , self ).__init__ (name = name , child = child )
914
+
915
+ def update (self ) -> common .Status :
916
+ """
917
+ Just reflect the child status.
918
+
919
+ Returns:
920
+ the behaviour's new status :class:`~py_trees.common.Status`
921
+ """
922
+ return self .decorated .status
You can’t perform that action at this time.
0 commit comments