Skip to content

Commit 3b874a7

Browse files
committed
(states) Designators can be reset
1 parent 8b0fd30 commit 3b874a7

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

robot_smach_states/src/robot_smach_states/util/designators/core.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ def resolve(self):
104104

105105
return result
106106

107+
def reset(self):
108+
"""
109+
Resets the designator
110+
"""
111+
raise NotImplementedError(f"Reset not implemented for {self.__class__.__name__}")
112+
107113
def fail_with_type_error(self, result_type, resolve_type):
108114
msg = "{} resolved to a '{}' instead of expected '{}'."
109115
raise TypeError(msg.format(self, result_type, resolve_type))
@@ -188,6 +194,12 @@ def _set_current_protected(self, value):
188194
"Expected a (subclass of) {1} but got a {2}".format(self, self.resolve_type, type(value)))
189195
self._current = value
190196

197+
def reset(self):
198+
"""
199+
Resets the designator
200+
"""
201+
self._current = None
202+
191203
def _resolve(self):
192204
return self._current
193205

robot_smach_states/src/robot_smach_states/util/designators/utility.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ def unlock(self):
8484
self._current = None
8585
self._locked = False
8686

87+
def reset(self):
88+
self.to_be_locked.reset()
89+
8790
def _resolve(self):
8891
if self._locked:
8992
if self._current is None:

0 commit comments

Comments
 (0)