diff --git a/bitbots_hcm/src/bitbots_hcm/hcm_dsd/actions/play_animation.py b/bitbots_hcm/src/bitbots_hcm/hcm_dsd/actions/play_animation.py index b88ea653..8b8bbea5 100644 --- a/bitbots_hcm/src/bitbots_hcm/hcm_dsd/actions/play_animation.py +++ b/bitbots_hcm/src/bitbots_hcm/hcm_dsd/actions/play_animation.py @@ -159,8 +159,6 @@ def __init__(self, blackboard, dsd, parameters=None): def perform(self, reevaluate=False): # we never want to leave the action when we play an animation # deactivate the reevaluate - if not self.blackboard.shut_down_request: - self.do_not_reevaluate() if self.first_perform: # get the animation that should be played diff --git a/bitbots_hcm/src/bitbots_hcm/hcm_dsd/actions/wait.py b/bitbots_hcm/src/bitbots_hcm/hcm_dsd/actions/wait.py new file mode 100644 index 00000000..ca2fff10 --- /dev/null +++ b/bitbots_hcm/src/bitbots_hcm/hcm_dsd/actions/wait.py @@ -0,0 +1,33 @@ +# -*- coding:utf-8 -*- +""" +Wait +^^^^ + +.. moduleauthor:: Martin Poppinga <1popping@informatik.uni-hamburg.de> + +Just waits for something (i.e. that preconditions will be fullfilled) +""" +import rospy + +from dynamic_stack_decider.abstract_action_element import AbstractActionElement + + +class Wait(AbstractActionElement): + """ + This action waits a specified time before it pops itself + """ + + def __init__(self, blackboard, dsd, parameters=None): + """ + :param parameters['time']: Time to wait in seconds + """ + super(Wait, self).__init__(blackboard, dsd) + self.time = rospy.get_time() + float(parameters['time']) + + def perform(self, reevaluate=False): + """ + Only pop when the wait-time has elapsed + """ + + if self.time < rospy.get_time(): + self.pop() diff --git a/bitbots_hcm/src/bitbots_hcm/hcm_dsd/hcm.dsd b/bitbots_hcm/src/bitbots_hcm/hcm_dsd/hcm.dsd index 8e427b8f..bedb592b 100644 --- a/bitbots_hcm/src/bitbots_hcm/hcm_dsd/hcm.dsd +++ b/bitbots_hcm/src/bitbots_hcm/hcm_dsd/hcm.dsd @@ -5,7 +5,7 @@ $Falling FALLING_FRONT --> @PlayAnimationFallingFront FALLING_BACK --> @PlayAnimationFallingBack NOT_FALLING --> $Fallen - FALLEN_FRONT --> @PlayAnimationStandUpFront, @PlayAnimationDynup + FALLEN_FRONT --> @PlayAnimationStandUpFront, @Wait + time:1, @PlayAnimationDynup FALLEN_BACK --> @SetFootZero, @PlayAnimationStandUpBack, @PlayAnimationDynup FALLEN_RIGHT --> @PlayAnimationStandUpRight, @PlayAnimationDynup FALLEN_LEFT --> @PlayAnimationStandUpLeft, @PlayAnimationDynup