Skip to content

Commit 5c3e16c

Browse files
committed
(designator) add value_or_resolve
1 parent 00402b8 commit 5c3e16c

File tree

1 file changed

+7
-0
lines changed
  • robot_smach_states/src/robot_smach_states/util/designators

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
__author__ = 'loy'
1414

1515

16+
def value_or_resolve(value):
17+
"""
18+
If value is a designator, resolve it, otherwise return value
19+
"""
20+
return value.resolve() if hasattr(value, "resolve") else value
21+
22+
1623
class LockingDesignator(Designator):
1724
"""A designator's resolve() method may return a different object everytime.
1825
For some cases, this may be unwanted because a process has to be done with the same object.

0 commit comments

Comments
 (0)