Skip to content

Commit 0a830b3

Browse files
committed
(states) add RateSleep
1 parent e5b3111 commit 0a830b3

File tree

1 file changed

+12
-0
lines changed
  • robot_smach_states/src/robot_smach_states

1 file changed

+12
-0
lines changed

robot_smach_states/src/robot_smach_states/utility.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,18 @@ def execute(self, userdata=None):
339339
return "not_yet"
340340

341341

342+
class RateSleep(smach.State):
343+
def __init__(self, rate: float):
344+
smach.State.__init__(self, outcomes=["slept"])
345+
346+
check_type(rate, float, int)
347+
self.rate = rospy.Rate(rate)
348+
349+
def execute(self, ud=None):
350+
self.rate.sleep()
351+
return "slept"
352+
353+
342354
class WaitForDesignator(smach.State):
343355
"""
344356
Waits for a given designator to answer. It will retry to resolve the designator a given number of times, with

0 commit comments

Comments
 (0)