Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions skiros2_skill/src/skiros2_skill/core/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,32 @@ def processChildren(self, children, visitor):
return state
else:
return State.Success


class NoSuccess:
"""
@brief Returns only running or failure. Success state is converted in
Failure state.

This can be used for recovery procedures one wants to successfully
execute the recovery, but still fail towards the parent skill.
"""

def __init__(self, processor):
self._processor = processor

def reset(self):
self._processor.reset()

def printType(self):
return "NoSuccess({})".format(self._processor.printType())

def processChildren(self, children, visitor):
"""
Ignore successful execution
"""
state = self._processor.processChildren(children, visitor)
if state == State.Running:
return state
else:
return State.Failure